mem-fs-editor
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -10,3 +10,2 @@ 'use strict'; | ||
var multimatch = require('multimatch'); | ||
var File = require('vinyl'); | ||
var util = require('../util'); | ||
@@ -19,3 +18,3 @@ | ||
exports.copy = function(from, to, options) { | ||
exports.copy = function (from, to, options) { | ||
from = util.globify(from); | ||
@@ -25,6 +24,6 @@ to = path.resolve(to); | ||
var globOptions = extend(options.globOptions || {}, { nodir: true }); | ||
var globOptions = extend(options.globOptions || {}, {nodir: true}); | ||
var diskFiles = globby.sync(from, globOptions); | ||
var storeFiles = []; | ||
this.store.each((file) => { | ||
this.store.each(file => { | ||
if (multimatch([file.path], from).length !== 0) { | ||
@@ -44,6 +43,6 @@ storeFiles.push(file.path); | ||
var root = util.getCommonPath(from); | ||
generateDestination = (filepath) => { | ||
generateDestination = filepath => { | ||
var toFile = path.relative(root, filepath); | ||
return path.join(to, toFile); | ||
} | ||
}; | ||
} | ||
@@ -54,3 +53,3 @@ | ||
files.forEach((file) => { | ||
files.forEach(file => { | ||
this._copySingle(file, generateDestination(file), options); | ||
@@ -57,0 +56,0 @@ }); |
'use strict'; | ||
var assert = require('assert'); | ||
var path = require('path'); | ||
@@ -5,0 +4,0 @@ var globby = require('globby'); |
'use strict'; | ||
var assert = require('assert'); | ||
module.exports = function (filepath, options) { | ||
options = options || { raw: false }; | ||
options = options || {raw: false}; | ||
var file = this.store.get(filepath); | ||
@@ -8,0 +6,0 @@ |
@@ -21,6 +21,7 @@ 'use strict'; | ||
filePath = this.globify(filePath); | ||
var globStartIndex = filePath.indexOf('*'); | ||
if (globStartIndex !== -1) { | ||
filePath = filePath.substring(0, globStartIndex + 1); | ||
} else if (fs.existsSync(filePath) && fs.statSync(filePath).isDirectory()) { | ||
return filePath; | ||
} | ||
@@ -27,0 +28,0 @@ |
{ | ||
"name": "mem-fs-editor", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "File edition helpers working on top of mem-fs", | ||
"scripts": { | ||
"test": "jest && eslint **/*.js", | ||
"pretest": "eslint **/*.js", | ||
"test": "jest", | ||
"prepublish": "nsp check" | ||
@@ -8,0 +9,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
16486
292