Skip to content

Commit 5ebe846

Browse files
authored
Check if startsWith exists before setting it (#14)
* Check if startsWith exists before setting it * fix linting issue * Try updating nyc * Remove node 4 and node 6 from CI * Ignore outdated bits from coverage
1 parent 138eb22 commit 5ebe846

File tree

5 files changed

+12
-9
lines changed

5 files changed

+12
-9
lines changed

.github/workflows/test-macos.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
node: [12, 10, 8, 6, 4]
16+
node: [12, 10, 8]
1717
steps:
1818
- name: Setup repo
1919
uses: actions/checkout@v2

.github/workflows/test-ubuntu.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
node: [12, 10, 8, 6, 4]
16+
node: [12, 10, 8]
1717
steps:
1818
- name: Setup repo
1919
uses: actions/checkout@v2

.github/workflows/test-windows.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
fail-fast: false
1515
matrix:
16-
node: [12, 10, 8, 6, 4]
16+
node: [12, 10, 8]
1717
steps:
1818
- name: Setup repo
1919
uses: actions/checkout@v2

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+
/* istanbul ignore next */
13+
if (!String.prototype.startsWith) {
14+
// The method startsWith is not defined on string objects in node 0.10
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

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"mockery": "^2.1.0",
5656
"np": "^2.20.1",
5757
"npm-check": "^5.9.2",
58-
"nyc": "^11.6.0",
58+
"nyc": "^15.1.0",
5959
"pify": "^3.0.0",
6060
"string-to-stream": "^1.1.0",
6161
"through": "^2.3.8",

0 commit comments

Comments
 (0)