Skip to content

Commit cafbb74

Browse files
Remove startsWith redefinition for node >= 4.0.0
Closes #14 #15 Co-Authored-By: Karthik Nadig <[email protected]>
1 parent 138eb22 commit cafbb74

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

index.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@ function pify(fn, arg1, arg2) {
99
});
1010
}
1111

12-
// The method startsWith is not defined on string objects in node 0.10
13-
// eslint-disable-next-line no-extend-native
14-
String.prototype.startsWith = function(suffix) {
15-
return this.substring(0, suffix.length) === suffix;
16-
};
12+
// Node versions prior to 4.0.0 do not define have `startsWith`.
13+
/* istanbul ignore if */
14+
if (!String.prototype.startsWith) {
15+
// eslint-disable-next-line no-extend-native
16+
String.prototype.startsWith = function(suffix) {
17+
return this.substring(0, suffix.length) === suffix;
18+
};
19+
}
1720

1821
var pidtree = require('./lib/pidtree');
1922

0 commit comments

Comments
 (0)