+12
-16
@@ -12,3 +12,3 @@ /*! | ||
| module.exports = function get(names, options = {}, cb) { | ||
| module.exports = (names, options, cb) => { | ||
| if (typeof options === 'function') { | ||
@@ -19,16 +19,12 @@ cb = options; | ||
| if (typeof names === 'string') { | ||
| names = [names]; | ||
| } | ||
| names = [].concat(names || []); | ||
| let opts = options || {}; | ||
| let pending = []; | ||
| let pkgs = []; | ||
| const pending = []; | ||
| const pkgs = []; | ||
| for (const name of names) { | ||
| const promise = pkg(name) | ||
| .then(res => { | ||
| if (res) pkgs.push(res); | ||
| }) | ||
| for (let name of names) { | ||
| let promise = pkg(name) | ||
| .then(res => res && pkgs.push(res)) | ||
| .catch(err => { | ||
| if (err.message === 'document not found' && options.silent) return; | ||
| if (err.message === 'document not found' && opts.silent) return; | ||
| return Promise.reject(err); | ||
@@ -40,10 +36,10 @@ }); | ||
| const promise = Promise.all(pending); | ||
| let p = Promise.all(pending); | ||
| if (typeof cb === 'function') { | ||
| promise.then(() => cb(null, pkgs)).catch(cb); | ||
| p.then(() => cb(null, pkgs)).catch(cb); | ||
| return; | ||
| } | ||
| return promise.then(() => pkgs); | ||
| return p.then(() => pkgs); | ||
| }; |
+6
-3
| { | ||
| "name": "get-pkgs", | ||
| "description": "Get the package.json for an array of repos from the npm registry, optionally filtering properties using glob patterns.", | ||
| "version": "1.0.0", | ||
| "version": "1.1.0", | ||
| "homepage": "https://github.com/jonschlinkert/get-pkgs", | ||
@@ -16,2 +16,5 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
| "main": "index.js", | ||
| "engines": { | ||
| "node": ">=4" | ||
| }, | ||
| "scripts": { | ||
@@ -21,6 +24,6 @@ "test": "mocha" | ||
| "dependencies": { | ||
| "get-pkg": "^1.0.0" | ||
| "get-pkg": "^1.1.0" | ||
| }, | ||
| "devDependencies": { | ||
| "gulp-format-md": "^1.0.0", | ||
| "gulp-format-md": "^2.0.0", | ||
| "mocha": "^5.2.0" | ||
@@ -27,0 +30,0 @@ }, |
+3
-3
@@ -70,3 +70,3 @@ # get-pkgs [](https://www.npmjs.com/package/get-pkgs) [](https://npmjs.org/package/get-pkgs) [](https://npmjs.org/package/get-pkgs) [](https://travis-ci.org/jonschlinkert/get-pkgs) | ||
| * [get-pkg](https://www.npmjs.com/package/get-pkg): Get the package.json for a project from npm. | [homepage](https://github.com/jonschlinkert/get-pkg "Get the package.json for a project from npm.") | ||
| * [github-base](https://www.npmjs.com/package/github-base): JavaScript wrapper that greatly simplifies working with GitHub's API. | [homepage](https://github.com/jonschlinkert/github-base "JavaScript wrapper that greatly simplifies working with GitHub's API.") | ||
| * [github-base](https://www.npmjs.com/package/github-base): Low-level methods for working with the GitHub API in node.js/JavaScript. | [homepage](https://github.com/jonschlinkert/github-base "Low-level methods for working with the GitHub API in node.js/JavaScript.") | ||
@@ -77,5 +77,5 @@ ### Author | ||
| * [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) | ||
| * [GitHub Profile](https://github.com/jonschlinkert) | ||
| * [Twitter Profile](https://twitter.com/jonschlinkert) | ||
| * [LinkedIn Profile](https://linkedin.com/in/jonschlinkert) | ||
@@ -89,2 +89,2 @@ ### License | ||
| _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on May 28, 2018._ | ||
| _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on December 08, 2018._ |
6462
-0.25%33
-8.33%Updated