@danmasta/walk
Advanced tools
Comparing version 4.0.1 to 4.1.0
@@ -330,2 +330,10 @@ const Readable = require('stream').Readable; | ||
then (...args) { | ||
return this.promise().then(...args); | ||
} | ||
catch (fn) { | ||
return this.promise().catch(fn); | ||
} | ||
static factory () { | ||
@@ -332,0 +340,0 @@ let Fn = this; |
{ | ||
"name": "@danmasta/walk", | ||
"version": "4.0.1", | ||
"version": "4.1.0", | ||
"author": "Daniel Smith <dannmasta@gmail.com>", | ||
@@ -5,0 +5,0 @@ "description": "Directory and file walking utility for node apps", |
@@ -29,3 +29,3 @@ # Walk | ||
``` | ||
*By default walk returns a readable stream interface. You can use the methods: `map()`, `each()`, and `promise()` to iterate file objects and return promises* | ||
*By default walk returns a readable stream interface. You can use the methods: `map()`, `each()`, `promise()`, `then()`, and `catch()` to iterate file objects and return promises* | ||
@@ -49,2 +49,4 @@ ### Options | ||
`promise` | Returns a promise that resolves with an `array` of file objects | ||
`then(fn)` | Run a callback when the promise is fulfilled. Returns a promise that resolves with an `array` of file objects | ||
`catch(fn)` | Run a callback when the promise is rejected. Returns a promise that resolves with an `array` of file objects | ||
@@ -110,3 +112,3 @@ ### File Objects | ||
```js | ||
walk('./', { src: '**/*.!(json)' }).promise().then(res => { | ||
walk('./', { src: '**/*.!(json)' }).then(res => { | ||
console.log('files:', res); | ||
@@ -117,3 +119,3 @@ }); | ||
```js | ||
walk('./config', { src: '**/*.json' }).promise().then(res => { | ||
walk('./config', { src: '**/*.json' }).then(res => { | ||
console.log('files:', res); | ||
@@ -124,3 +126,3 @@ }); | ||
```js | ||
walk('/usr/local').promise().then(res => { | ||
walk('/usr/local').then(res => { | ||
console.log('files:', res); | ||
@@ -127,0 +129,0 @@ }); |
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
30503
685
167