Comparing version 0.2.1 to 0.2.2
var path = require('path'); | ||
var clone = require('lodash.clone'); | ||
var cloneStats = require('clone-stats'); | ||
@@ -46,4 +46,4 @@ var isBuffer = require('./lib/isBuffer'); | ||
File.prototype.clone = function() { | ||
var clonedStat = clone(this.stat); | ||
var clonedContents = this.isBuffer() ? cloneBuffer(this.contents) : this.contents; | ||
var clonedStat = this.stat ? cloneStats(this.stat) : null; | ||
@@ -129,2 +129,2 @@ return new File({ | ||
module.exports = File; | ||
module.exports = File; |
{ | ||
"name": "vinyl", | ||
"description": "A virtual file format", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"homepage": "http://github.com/wearefractal/vinyl", | ||
@@ -10,3 +10,3 @@ "repository": "git://github.com/wearefractal/vinyl.git", | ||
"dependencies": { | ||
"lodash.clone": "~2.4.1" | ||
"clone-stats": "0.0.0" | ||
}, | ||
@@ -13,0 +13,0 @@ "devDependencies": { |
var File = require('../'); | ||
var Stream = require('stream'); | ||
var fs = require('fs'); | ||
@@ -232,4 +233,24 @@ var should = require('should'); | ||
}); | ||
it('should properly clone the `stat` property', function(done) { | ||
var options = { | ||
cwd: "/", | ||
base: "/test/", | ||
path: "/test/test.js", | ||
contents: new Buffer("test"), | ||
stat: fs.statSync(__filename) | ||
}; | ||
var file = new File(options); | ||
var copy = file.clone(); | ||
copy.stat.isFile().should.be.true; | ||
copy.stat.isDirectory().should.be.false; | ||
should(file.stat instanceof fs.Stats).be.true; | ||
should(copy.stat instanceof fs.Stats).be.true; | ||
done(); | ||
}); | ||
}); | ||
describe('pipe()', function() { | ||
@@ -520,2 +541,2 @@ it('should write to stream with Buffer', function(done) { | ||
}); | ||
}); |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
28995
739
2
+ Addedclone-stats@0.0.0
+ Addedclone-stats@0.0.0(transitive)
- Removedlodash.clone@~2.4.1
- Removedlodash._arraypool@2.4.1(transitive)
- Removedlodash._basebind@2.4.1(transitive)
- Removedlodash._baseclone@2.4.1(transitive)
- Removedlodash._basecreate@2.4.1(transitive)
- Removedlodash._basecreatecallback@2.4.1(transitive)
- Removedlodash._basecreatewrapper@2.4.1(transitive)
- Removedlodash._createwrapper@2.4.1(transitive)
- Removedlodash._getarray@2.4.1(transitive)
- Removedlodash._isnative@2.4.1(transitive)
- Removedlodash._maxpoolsize@2.4.1(transitive)
- Removedlodash._objecttypes@2.4.1(transitive)
- Removedlodash._releasearray@2.4.1(transitive)
- Removedlodash._setbinddata@2.4.1(transitive)
- Removedlodash._shimkeys@2.4.1(transitive)
- Removedlodash._slice@2.4.1(transitive)
- Removedlodash.assign@2.4.1(transitive)
- Removedlodash.bind@2.4.1(transitive)
- Removedlodash.clone@2.4.1(transitive)
- Removedlodash.foreach@2.4.1(transitive)
- Removedlodash.forown@2.4.1(transitive)
- Removedlodash.identity@2.4.1(transitive)
- Removedlodash.isarray@2.4.1(transitive)
- Removedlodash.isfunction@2.4.1(transitive)
- Removedlodash.isobject@2.4.1(transitive)
- Removedlodash.keys@2.4.1(transitive)
- Removedlodash.noop@2.4.1(transitive)
- Removedlodash.support@2.4.1(transitive)