Created
June 29, 2021 20:54
-
-
Save isaacs/b588b542b5c99f57129fdaf44f5a386d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const {promisify} = require('util') | |
const rpj = promisify(require('read-package-json')) | |
const rpjf = require('read-package-json-fast') | |
const pj = require.resolve('./package.json') | |
Promise.all([ | |
rpj(pj), | |
rpjf(pj), | |
]).then(console.log) | |
/* | |
[ | |
{ | |
name: 'foo', | |
version: '1.2.3', | |
directories: { bin: 'bin' }, | |
dependencies: { | |
'read-package-json': '^3.0.1', | |
'read-package-json-fast': '^2.0.2' | |
}, | |
bin: { 'bar.js': 'bin/bar.js', 'foo.js': 'bin/foo.js' }, | |
readme: 'ERROR: No README data found!', | |
_id: '[email protected]', | |
[Symbol(newline)]: '\n', | |
[Symbol(indent)]: ' ' | |
}, | |
{ | |
name: 'foo', | |
version: '1.2.3', | |
directories: { bin: 'bin' }, | |
dependencies: { | |
'read-package-json': '^3.0.1', | |
'read-package-json-fast': '^2.0.2' | |
}, | |
_id: '[email protected]', | |
[Symbol(newline)]: '\n', | |
[Symbol(indent)]: ' ' | |
} | |
] | |
*/ |
Author
isaacs
commented
Jun 29, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment