Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

get-pkgs

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-pkgs - npm Package Compare versions

Comparing version
0.2.3
to
0.3.0
+10
-28
index.js

@@ -12,33 +12,15 @@ /*!

module.exports = function get(repos, pattern, cb) {
if (typeof pattern === 'function') {
cb = pattern; pattern = '*';
module.exports = function get(repos, cb) {
if (typeof cb !== 'function') {
throw new TypeError('expected callback to be a function');
}
utils.async.reduce(arrayify(repos), [], function(acc, repo, next) {
pkg(repo, 'latest', function (err, json) {
if (err) {
console.log(utils.red(err + ': "') + utils.bold(repo) + '"');
return next(err);
}
next(null, acc.concat(utils.filter(json, pattern)));
});
}, cb);
};
if (typeof repos === 'string') {
repos = [repos];
}
function arrayify(val) {
return !Array.isArray(val) ? [val] : val;
}
function pkg(name, version, cb) {
var url = 'https://registry.npmjs.org/' + name + '/';
if (typeof version !== 'string') {
cb = version;
version = '';
if (!Array.isArray(repos)) {
throw new TypeError('expected the first argument to be a string or array');
}
utils.request(url + version, {}, function (err, res) {
if (err) return cb(err);
cb(null, JSON.parse(res.body));
});
}
utils.async.map(repos, utils.pkg, cb);
};
{
"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.2.3",
"version": "0.3.0",
"homepage": "https://github.com/jonschlinkert/get-pkgs",

@@ -24,8 +24,5 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

"dependencies": {
"ansi-bold": "^0.1.1",
"ansi-red": "^0.1.1",
"async": "^1.5.0",
"filter-object": "^2.1.0",
"lazy-cache": "^0.2.4",
"min-request": "^1.4.1"
"get-pkg": "^0.1.0",
"lazy-cache": "^0.2.4"
},

@@ -46,3 +43,12 @@ "devDependencies": {

"pkgs"
]
],
"verb": {
"related": {
"list": [
"get-pkg",
"github-base",
"get-first-commit"
]
}
}
}

@@ -5,2 +5,4 @@ # get-pkgs [![NPM version](https://badge.fury.io/js/get-pkgs.svg)](http://badge.fury.io/js/get-pkgs) [![Build Status](https://travis-ci.org/jonschlinkert/get-pkgs.svg)](https://travis-ci.org/jonschlinkert/get-pkgs)

## Install
Install with [npm](https://www.npmjs.com/)

@@ -15,6 +17,5 @@

```js
var get = require('get-pkgs');
var getPkgs = require('get-pkgs');
// filter out properties like `_shasum`
get(['assemble', 'verb'], '!_*', function(err, pkgs) {
getPkgs(['assemble', 'verb'], function(err, pkgs) {
console.log(pkgs);

@@ -26,5 +27,5 @@ });

* [filter-object](https://www.npmjs.com/package/filter-object): Filter an object by its keys or values. Returns a copy of an object filtered… [more](https://www.npmjs.com/package/filter-object) | [homepage](https://github.com/jonschlinkert/filter-object)
* [helper-reflinks](https://www.npmjs.com/package/helper-reflinks): Template helper for generating a list of markdown formatted reference links to github repos for… [more](https://www.npmjs.com/package/helper-reflinks) | [homepage](https://github.com/helpers/helper-reflinks)
* [helper-related](https://www.npmjs.com/package/helper-related): Template helper for generating a list of links to the homepages of related GitHub/npm projects. | [homepage](https://github.com/helpers/helper-related)
* [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)

@@ -57,2 +58,2 @@ ## Running tests

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on October 28, 2015._
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on November 22, 2015._

@@ -28,7 +28,4 @@ 'use strict';

require('ansi-bold', 'bold');
require('ansi-red', 'red');
require('async');
require('filter-object', 'filter');
require('min-request', 'request');
require('get-pkg', 'pkg');

@@ -35,0 +32,0 @@ /**