Comparing version 5.0.0 to 6.0.0
23
index.js
@@ -6,3 +6,2 @@ 'use strict'; | ||
var glob = require('glob'); | ||
var arrify = require('arrify'); | ||
var pify = require('pify'); | ||
@@ -16,6 +15,18 @@ | ||
function isString(value) { | ||
return typeof value === 'string'; | ||
} | ||
function assertPatternsInput(patterns) { | ||
if (!patterns.every(isString)) { | ||
throw new TypeError('patterns must be a string or an array of strings'); | ||
} | ||
} | ||
function generateGlobTasks(patterns, opts) { | ||
patterns = Array.isArray(patterns) ? patterns : [patterns]; | ||
assertPatternsInput(patterns); | ||
var globTasks = []; | ||
patterns = arrify(patterns); | ||
opts = objectAssign({ | ||
@@ -50,4 +61,10 @@ cache: Object.create(null), | ||
module.exports = function (patterns, opts) { | ||
var globTasks = generateGlobTasks(patterns, opts); | ||
var globTasks; | ||
try { | ||
globTasks = generateGlobTasks(patterns, opts); | ||
} catch (err) { | ||
return Promise.reject(err); | ||
} | ||
return Promise.all(globTasks.map(function (task) { | ||
@@ -54,0 +71,0 @@ return globP(task.pattern, task.opts); |
{ | ||
"name": "globby", | ||
"version": "5.0.0", | ||
"version": "6.0.0", | ||
"description": "Extends `glob` with support for multiple patterns and exposes a Promise API", | ||
@@ -56,3 +56,2 @@ "license": "MIT", | ||
"array-union": "^1.0.1", | ||
"arrify": "^1.0.0", | ||
"glob": "^7.0.3", | ||
@@ -59,0 +58,0 @@ "object-assign": "^4.0.1", |
@@ -45,3 +45,3 @@ # globby [![Build Status](https://travis-ci.org/sindresorhus/globby.svg?branch=master)](https://travis-ci.org/sindresorhus/globby) | ||
Note that you should avoid running the same tasks multiple times as they contain a file system cache. Instead, create a new tasks list to ensure that file system changes are taken in consideration. | ||
Note that you should avoid running the same tasks multiple times as they contain a file system cache. Instead, run this method each time to ensure file system changes are taken into consideration. | ||
@@ -48,0 +48,0 @@ #### patterns |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
6487
5
65
0
- Removedarrify@^1.0.0
- Removedarrify@1.0.1(transitive)