Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
2022-04-24 12:31:26 +03:00
parent a0328f1590
commit 4aa2cbfe04
26 changed files with 8529 additions and 2230 deletions

View File

@@ -10,9 +10,6 @@ var PO = function () {
this.items = [];
};
PO.prototype.save = function (filename, callback) {
require('fs').writeFile(filename, this.toString(), callback);
};
PO.prototype.toString = function () {
var lines = [];
@@ -62,16 +59,6 @@ PO.prototype.toString = function () {
return lines.join('\n');
};
PO.load = function (filename, callback) {
require('fs').readFile(filename, 'utf-8', function (err, data) {
if (err) {
return callback(err);
}
var po = PO.parse(data);
callback(null, po);
});
};
PO.parse = function (data) {
//support both unix and windows newline formats.
data = data.replace(/\r\n/g, '\n');