Socket
Socket
Sign inDemoInstall

mem-fs-editor

Package Overview
Dependencies
Maintainers
2
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mem-fs-editor - npm Package Compare versions

Comparing version 9.6.0 to 9.7.0

3

lib/actions/commit.js

@@ -8,2 +8,3 @@ 'use strict';

const { createPendingFilesPassthrough, createCommitTransform } = require('../transform');
const { isFilePending } = require('../state');

@@ -20,3 +21,3 @@ module.exports = function (filters, stream, cb) {

stream = stream || this.store.stream();
stream = stream || this.store.stream({ filter: (file) => isFilePending(file) });
filters = filters || [];

@@ -23,0 +24,0 @@

@@ -9,9 +9,8 @@ 'use strict';

module.exports = function (
cwd = process.cwd(),
filter = (file) => hasClearedState(file) || hasState(file)
) {
const defaultDumpFilter = (file) => hasClearedState(file) || hasState(file);
module.exports = function (cwd = process.cwd(), filter = defaultDumpFilter) {
if (typeof filter === 'string') {
const pattern = filter;
filter = (file) => minimatch(file.path, pattern);
filter = (file) => defaultDumpFilter(file) && minimatch(file.path, pattern);
}

@@ -18,0 +17,0 @@

@@ -46,2 +46,19 @@ const fs = require('fs');

/**
* Delete commit related states.
*/
const resetFileCommitStates = (file) => {
delete file[STATE_CLEARED];
delete file.committed;
};
/**
* Delete all mem-fs-editor`s related states.
*/
const resetFile = (file) => {
resetFileState(file);
resetFileCommitStates(file);
delete file[IS_NEW];
};
const clearFileState = (file) => {

@@ -74,2 +91,4 @@ if (file[STATE]) {

resetFileState,
resetFileCommitStates,
resetFile,
clearFileState,

@@ -76,0 +95,0 @@ hasState,

{
"name": "mem-fs-editor",
"version": "9.6.0",
"version": "9.7.0",
"description": "File edition helpers working on top of mem-fs",

@@ -23,4 +23,4 @@ "scripts": {

"globby": "^11.1.0",
"isbinaryfile": "^4.0.8",
"minimatch": "^3.1.2",
"isbinaryfile": "^5.0.0",
"minimatch": "^7.2.0",
"multimatch": "^5.0.0",

@@ -43,8 +43,8 @@ "normalize-path": "^3.0.0",

"eslint-config-prettier": "^8.3.0",
"eslint-config-xo": "^0.39.0",
"eslint-config-xo": "^0.43.1",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^27.0.6",
"mem-fs": "^2.2.1",
"jest": "^29.4.3",
"mem-fs": "^2.3.0",
"prettier": "^2.5.1",
"sinon": "^12.0.1"
"sinon": "^15.0.1"
},

@@ -51,0 +51,0 @@ "jest": {

@@ -155,2 +155,3 @@ # mem-fs-editor

Provide a `cwd` for relative path. Allows to omit temporary path.
Provide a `filter` function or glob to focus on specific files.
Provide a `filter` function or a pattern to focus on specific files.
`dump` returns only modified (committed or not) files when no filter or a pattern is provided.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc