mem-fs-editor
Advanced tools
Comparing version 9.2.0 to 9.3.0
@@ -5,2 +5,3 @@ 'use strict'; | ||
const normalize = require('normalize-path'); | ||
const minimatch = require('minimatch'); | ||
@@ -10,4 +11,9 @@ const {hasClearedState, hasState, STATE, STATE_CLEARED} = require('../state'); | ||
module.exports = function (cwd = process.cwd(), filter = file => hasClearedState(file) || hasState(file)) { | ||
if (typeof filter === 'string') { | ||
const pattern = filter; | ||
filter = file => minimatch(file.path, pattern); | ||
} | ||
return Object.fromEntries( | ||
this.store.all().filter(file => filter(file)).map(file => { | ||
this.store.all().filter(file => filter(file, cwd)).map(file => { | ||
const filePath = normalize(cwd ? path.relative(cwd, file.path) : file.path); | ||
@@ -14,0 +20,0 @@ const fileDump = { |
{ | ||
"name": "mem-fs-editor", | ||
"version": "9.2.0", | ||
"version": "9.3.0", | ||
"description": "File edition helpers working on top of mem-fs", | ||
@@ -24,2 +24,3 @@ "scripts": { | ||
"isbinaryfile": "^4.0.8", | ||
"minimatch": "^3.0.4", | ||
"multimatch": "^5.0.0", | ||
@@ -26,0 +27,0 @@ "normalize-path": "^3.0.0", |
@@ -145,1 +145,7 @@ # mem-fs-editor [![Node.js CI](https://github.com/SBoudrias/mem-fs-editor/workflows/Node.js%20CI/badge.svg)](https://github.com/SBoudrias/mem-fs-editor/actions?query=workflow%3A%22Node.js+CI%22) [![NPM version](https://badge.fury.io/js/mem-fs-editor.svg)](http://badge.fury.io/js/mem-fs-editor) [![Coverage Status](https://coveralls.io/repos/github/SBoudrias/mem-fs-editor/badge.svg)](https://coveralls.io/github/SBoudrias/mem-fs-editor) | ||
`callback` is called once the files are updated on disk. | ||
### `#dump([cwd,] [filter])` | ||
Dump files to compare expected result. | ||
Provide a `cwd` for relative path. Allows to omit temporary path. | ||
Provide a `filter` function or glob to focus on specific files. |
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
29847
614
151
11
+ Addedminimatch@^3.0.4