Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mem-fs-editor

Package Overview
Dependencies
Maintainers
1
Versions
54
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 2.0.0 to 2.0.1

5

actions/copy.js

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

var glob = require('glob');
var globby = require('globby');
var _ = require('lodash');

@@ -22,3 +23,3 @@ var File = require('vinyl');

if (!glob.hasMagic(from)) {
if (!Array.isArray(from) && !glob.hasMagic(from)) {
return this._copySingle(from, to, options);

@@ -33,3 +34,3 @@ }

var globOptions = _.extend(options.globOptions || {}, { nodir: true });
var files = glob.sync(from, globOptions);
var files = globby.sync(from, globOptions);
var root = util.getCommonPath(from);

@@ -36,0 +37,0 @@

16

actions/delete.js

@@ -5,3 +5,4 @@ 'use strict';

var _ = require('lodash');
var glob = require('glob');
var globby = require('globby');
var multimatch = require('multimatch');
var util = require('../util/util');

@@ -16,9 +17,8 @@

module.exports = function (path, options) {
path = util.globify(path);
options = options || { globOptions : {} };
module.exports = function (paths, options) {
paths = util.globify(paths);
options = options || {};
var globOptions = _.extend(options.globOptions, { sync: true });
var g = new glob.Glob(path, globOptions);
var files = g.found;
var globOptions = options.globOptions || {};
var files = globby.sync(paths, globOptions);
files.forEach(function (file) {

@@ -29,3 +29,3 @@ deleteFile(file, this.store);

this.store.each(function (file) {
if (g.minimatch.match(file.path)) {
if (multimatch(paths, file.path).length !== 0) {
deleteFile(file.path, this.store);

@@ -32,0 +32,0 @@ }

@@ -6,5 +6,5 @@ 'use strict';

module.exports = function (path, contents, replacer, space) {
var jsonStr = JSON.stringify(contents, replacer || null, space || DEFAULT_INDENTATION);
var jsonStr = JSON.stringify(contents, replacer || null, space || DEFAULT_INDENTATION) + '\n';
return this.write(path, jsonStr);
};
{
"name": "mem-fs-editor",
"version": "2.0.0",
"version": "2.0.1",
"description": "File edition helpers working on top of mem-fs",

@@ -17,6 +17,9 @@ "scripts": {

"dependencies": {
"commondir": "^1.0.1",
"ejs": "^2.3.1",
"glob": "^5.0.3",
"globby": "^2.0.0",
"lodash": "^3.6.0",
"mkdirp": "^0.5.0",
"multimatch": "^2.0.0",
"rimraf": "^2.2.8",

@@ -23,0 +26,0 @@ "sinon": "^1.12.2",

@@ -5,5 +5,18 @@ 'use strict';

var path = require('path');
var commondir = require('commondir');
var glob = require('glob');
function notNullOrExclusion(file) {
return file != null && file.charAt(0) !== '!';
}
exports.getCommonPath = function (filePath) {
if (Array.isArray(filePath)) {
filePath = filePath
.filter(notNullOrExclusion)
.map(this.getCommonPath.bind(this));
return commondir(filePath);
}
filePath = this.globify(filePath);

@@ -18,4 +31,7 @@ var globStartIndex = filePath.indexOf('*');

exports.globify = function (filePath) {
if (Array.isArray(filePath)) {
return filePath.map(this.globify.bind(this));
}
exports.globify = function (filePath) {
if (glob.hasMagic(filePath) || !fs.existsSync(filePath)) {

@@ -22,0 +38,0 @@ return filePath;

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