diff --git a/.github/workflows/test-macos.yml b/.github/workflows/test-macos.yml index 37d58e6..5396d2b 100644 --- a/.github/workflows/test-macos.yml +++ b/.github/workflows/test-macos.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - node: [current, 16, 14, 12, 10, 8, 6, 4] + node: [14, 16, 18] steps: - name: Setup repo uses: actions/checkout@v3 diff --git a/.github/workflows/test-ubuntu.yml b/.github/workflows/test-ubuntu.yml index dd059e2..29dd91e 100644 --- a/.github/workflows/test-ubuntu.yml +++ b/.github/workflows/test-ubuntu.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - node: [current, 16, 14, 12, 10, 8, 6, 4] + node: [14, 16, 18] steps: - name: Setup repo uses: actions/checkout@v3 diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index 9e3414f..f2c03e4 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - node: [current, 16, 14, 12, 10, 8, 6, 4] + node: [14, 16, 18] steps: - name: Setup repo uses: actions/checkout@v3 diff --git a/index.js b/index.js index b38d08f..f71bedb 100644 --- a/index.js +++ b/index.js @@ -1,24 +1,7 @@ 'use strict'; -function pify(fn, arg1, arg2) { - return new Promise(function(resolve, reject) { - fn(arg1, arg2, function(err, data) { - if (err) return reject(err); - resolve(data); - }); - }); -} - -// Node versions prior to 4.0.0 do not define have `startsWith`. -/* istanbul ignore if */ -if (!String.prototype.startsWith) { - // eslint-disable-next-line no-extend-native - String.prototype.startsWith = function(suffix) { - return this.substring(0, suffix.length) === suffix; - }; -} - -var pidtree = require('./lib/pidtree'); +const util = require('node:util'); +const pidtree = require('./lib/pidtree'); /** * Get the list of children pids of the given pid. @@ -43,7 +26,7 @@ function list(pid, options, callback) { return; } - return pify(pidtree, pid, options); + return util.promisify(pidtree)(pid, options); } module.exports = list; diff --git a/package.json b/package.json index 6e1e672..c877ee0 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "index.d.ts" ], "engines": { - "node": ">=0.10" + "node": ">= 14" }, "scripts": { "start": "node ./bin/pidtree.js",