Skip to content

Commit 2056c8b

Browse files
realitykingmichaelficarra
authored andcommitted
Drop support for node < 4 (estools#355)
1 parent bcd240e commit 2056c8b

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

escodegen.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
SourceNode,
4444
estraverse,
4545
esutils,
46-
isArray,
4746
base,
4847
indent,
4948
json,
@@ -218,13 +217,6 @@
218217
return result;
219218
}
220219

221-
isArray = Array.isArray;
222-
if (!isArray) {
223-
isArray = function isArray(array) {
224-
return Object.prototype.toString.call(array) === '[object Array]';
225-
};
226-
}
227-
228220
function hasLineTerminator(str) {
229221
return (/[\r\n]/g).test(str);
230222
}
@@ -505,7 +497,7 @@
505497
var i, iz, elem, result = '';
506498
for (i = 0, iz = arr.length; i < iz; ++i) {
507499
elem = arr[i];
508-
result += isArray(elem) ? flattenToString(elem) : elem;
500+
result += Array.isArray(elem) ? flattenToString(elem) : elem;
509501
}
510502
return result;
511503
}
@@ -518,7 +510,7 @@
518510
// with no source maps, generated is either an
519511
// array or a string. if an array, flatten it.
520512
// if a string, just return it
521-
if (isArray(generated)) {
513+
if (Array.isArray(generated)) {
522514
return flattenToString(generated);
523515
} else {
524516
return generated;
@@ -1525,7 +1517,7 @@
15251517

15261518
// new interface
15271519
if (stmt.handler) {
1528-
if (isArray(stmt.handler)) {
1520+
if (Array.isArray(stmt.handler)) {
15291521
for (i = 0, iz = stmt.handler.length; i < iz; ++i) {
15301522
result = join(result, this.generateStatement(stmt.handler[i], S_TFFF));
15311523
if (stmt.finalizer || i + 1 !== iz) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
],
1717
"version": "1.9.0",
1818
"engines": {
19-
"node": ">=0.12.0"
19+
"node": ">=4.0"
2020
},
2121
"maintainers": [
2222
{

0 commit comments

Comments
 (0)