Remove lodash.isarray (use native Array.isArray).
Other code was already depending on Object.keys() and Array.prototype.filter(), which are also ES5 along with Array.isArray().
This commit is contained in:
parent
e2330bd433
commit
79407fcf5e
@ -1,5 +1,4 @@
|
|||||||
var fs = require('fs');
|
var fs = require('fs');
|
||||||
var isArray = require('lodash.isarray');
|
|
||||||
|
|
||||||
function trim(string) {
|
function trim(string) {
|
||||||
return string.replace(/^\s+|\s+$/g, '');
|
return string.replace(/^\s+|\s+$/g, '');
|
||||||
@ -317,12 +316,12 @@ PO.Item.prototype.toString = function () {
|
|||||||
['msgctxt', 'msgid', 'msgid_plural', 'msgstr'].forEach(function (keyword) {
|
['msgctxt', 'msgid', 'msgid_plural', 'msgstr'].forEach(function (keyword) {
|
||||||
var text = self[keyword];
|
var text = self[keyword];
|
||||||
if (text != null) {
|
if (text != null) {
|
||||||
if (isArray(text) && text.length > 1) {
|
if (Array.isArray(text) && text.length > 1) {
|
||||||
text.forEach(function (t, i) {
|
text.forEach(function (t, i) {
|
||||||
lines = lines.concat(mkObsolete + _process(keyword, t, i));
|
lines = lines.concat(mkObsolete + _process(keyword, t, i));
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
text = isArray(text) ? text.join() : text;
|
text = Array.isArray(text) ? text.join() : text;
|
||||||
var processed = _process(keyword, text);
|
var processed = _process(keyword, text);
|
||||||
//handle \n in single-line texts (can not be handled in _escape)
|
//handle \n in single-line texts (can not be handled in _escape)
|
||||||
for (var i = 1; i < processed.length - 1; i++) {
|
for (var i = 1; i < processed.length - 1; i++) {
|
||||||
|
@ -46,7 +46,5 @@
|
|||||||
"grunt-jscs": "~3.0.1",
|
"grunt-jscs": "~3.0.1",
|
||||||
"grunt-mocha-cli": "~3.0.0"
|
"grunt-mocha-cli": "~3.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {}
|
||||||
"lodash.isarray": "~2.4.1"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user