+21
-12
@@ -12,3 +12,8 @@ /*! | ||
| module.exports = function get(repos, cb) { | ||
| module.exports = function get(repos, options, cb) { | ||
| if (typeof options === 'function') { | ||
| cb = options; | ||
| options = {}; | ||
| } | ||
| if (typeof cb !== 'function') { | ||
@@ -27,19 +32,23 @@ throw new TypeError('expected a callback function'); | ||
| utils.reduce(repos, [], function(acc, name, next) { | ||
| options = options || {}; | ||
| utils.each(repos, function(name, next) { | ||
| utils.pkg(name, function(err, pkg) { | ||
| if (err) { | ||
| if (err.code === 404) { | ||
| var symbol = utils.yellow(utils.warning); | ||
| console.error('', symbol, 'WARNING: npm package "' + err.pkgName + '" does not exist'); | ||
| next(null, acc); | ||
| if (err.message === 'document not found' && options.silent) { | ||
| next(); | ||
| return; | ||
| } | ||
| if (err && err.message !== 'document not found') { | ||
| next(err); | ||
| return; | ||
| } | ||
| next(err); | ||
| return; | ||
| } | ||
| next(null, acc.concat(pkg || [])); | ||
| next(null, pkg); | ||
| }); | ||
| }, cb); | ||
| }, function(err, pkgs) { | ||
| if (err) { | ||
| cb(err); | ||
| return; | ||
| } | ||
| cb(null, pkgs.filter(Boolean)); | ||
| }); | ||
| }; |
+5
-8
| { | ||
| "name": "get-pkgs", | ||
| "description": "Get the package.json for an array of repos from the npm registry, optionally filtering properties using glob patterns.", | ||
| "version": "0.5.0", | ||
| "version": "0.6.0", | ||
| "homepage": "https://github.com/jonschlinkert/get-pkgs", | ||
@@ -24,12 +24,9 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
| "dependencies": { | ||
| "ansi-yellow": "^0.1.1", | ||
| "async-array-reduce": "^0.1.0", | ||
| "async-each": "^1.0.0", | ||
| "get-pkg": "^0.3.0", | ||
| "lazy-cache": "^1.0.3", | ||
| "warning-symbol": "^0.1.0" | ||
| "lazy-cache": "^2.0.1" | ||
| }, | ||
| "devDependencies": { | ||
| "gulp-format-md": "^0.1.7", | ||
| "mocha": "^2.4.5", | ||
| "should": "^8.3.0" | ||
| "gulp-format-md": "^0.1.9", | ||
| "mocha": "^2.5.3" | ||
| }, | ||
@@ -36,0 +33,0 @@ "keywords": [ |
+1
-3
@@ -11,6 +11,4 @@ 'use strict'; | ||
| require('async-array-reduce', 'reduce'); | ||
| require('async-each', 'each'); | ||
| require('get-pkg', 'pkg'); | ||
| require('warning-symbol', 'warning'); | ||
| require('ansi-yellow', 'yellow'); | ||
| require = fn; | ||
@@ -17,0 +15,0 @@ |
-71
| # get-pkgs [](https://www.npmjs.com/package/get-pkgs) [](https://npmjs.org/package/get-pkgs) [](https://travis-ci.org/jonschlinkert/get-pkgs) | ||
| > Get the package.json for an array of repos from the npm registry, optionally filtering properties using glob patterns. | ||
| ## Install | ||
| Install with [npm](https://www.npmjs.com/): | ||
| ```sh | ||
| $ npm install get-pkgs --save | ||
| ``` | ||
| ## Usage | ||
| ```js | ||
| var getPkgs = require('get-pkgs'); | ||
| getPkgs(['assemble', 'verb'], function(err, pkgs) { | ||
| console.log(pkgs); | ||
| }); | ||
| ``` | ||
| ## Related projects | ||
| You might also be interested in these projects: | ||
| * [get-first-commit](https://www.npmjs.com/package/get-first-commit): Returns a git repository's first commit as a JavaScript object. | [homepage](https://github.com/jonschlinkert/get-first-commit) | ||
| * [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) | ||
| * [github-base](https://www.npmjs.com/package/github-base): Base methods for creating node.js apps that work with the GitHub API. | [homepage](https://github.com/jonschlinkert/github-base) | ||
| ## Contributing | ||
| Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/get-pkgs/issues/new). | ||
| ## Building docs | ||
| Generate readme and API documentation with [verb](https://github.com/verbose/verb): | ||
| ```sh | ||
| $ npm install verb && npm run docs | ||
| ``` | ||
| Or, if [verb](https://github.com/verbose/verb) is installed globally: | ||
| ```sh | ||
| $ verb | ||
| ``` | ||
| ## Running tests | ||
| Install dev dependencies: | ||
| ```sh | ||
| $ npm install -d && npm test | ||
| ``` | ||
| ## Author | ||
| **Jon Schlinkert** | ||
| * [github/jonschlinkert](https://github.com/jonschlinkert) | ||
| * [twitter/jonschlinkert](http://twitter.com/jonschlinkert) | ||
| ## License | ||
| Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert). | ||
| Released under the [MIT license](https://github.com/jonschlinkert/get-pkgs/blob/master/LICENSE). | ||
| *** | ||
| _This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on April 11, 2016._ |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
3
-40%2
-33.33%58
9.43%3680
-39.78%4
-20%2
100%0
-100%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
- Removed
Updated