vinyl-assign
Advanced tools
Comparing version 1.1.0 to 1.2.0
26
index.js
'use strict'; | ||
var objectAssign = require('object-assign'); | ||
var through = require('through2'); | ||
var Transform = require('readable-stream/transform'); | ||
@@ -9,15 +8,18 @@ module.exports = function (opts) { | ||
return through.obj(function (file, enc, cb) { | ||
if (file.isNull()) { | ||
cb(null, file); | ||
return; | ||
} | ||
return new Transform({ | ||
objectMode: true, | ||
transform: function (file, enc, cb) { | ||
if (file.isNull()) { | ||
cb(null, file); | ||
return; | ||
} | ||
if (file.isStream()) { | ||
cb(new Error('Streaming is not supported')); | ||
return; | ||
if (file.isStream()) { | ||
cb(new Error('Streaming is not supported')); | ||
return; | ||
} | ||
cb(null, objectAssign(file, opts)); | ||
} | ||
cb(null, objectAssign(file, opts)); | ||
}); | ||
}; |
{ | ||
"name": "vinyl-assign", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Apply custom attributes to vinyl files", | ||
@@ -23,4 +23,4 @@ "license": "MIT", | ||
"dependencies": { | ||
"object-assign": "^2.0.0", | ||
"through2": "^0.6.3" | ||
"object-assign": "^3.0.0", | ||
"readable-stream": "^2.0.0" | ||
}, | ||
@@ -27,0 +27,0 @@ "devDependencies": { |
@@ -5,8 +5,10 @@ # vinyl-assign [![Build Status](http://img.shields.io/travis/kevva/vinyl-assign.svg?style=flat)](https://travis-ci.org/kevva/vinyl-assign) | ||
## Install | ||
```bash | ||
``` | ||
$ npm install --save vinyl-assign | ||
``` | ||
## Usage | ||
@@ -25,4 +27,5 @@ | ||
## License | ||
MIT © [Kevin Mårtensson](https://github.com/kevva) |
Sorry, the diff of this file is not supported yet
2701
20
30
+ Addedreadable-stream@^2.0.0
+ Addedisarray@1.0.0(transitive)
+ Addedobject-assign@3.0.0(transitive)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedreadable-stream@2.3.8(transitive)
+ Addedsafe-buffer@5.1.2(transitive)
+ Addedstring_decoder@1.1.1(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
- Removedthrough2@^0.6.3
- Removedisarray@0.0.1(transitive)
- Removedobject-assign@2.1.1(transitive)
- Removedreadable-stream@1.0.34(transitive)
- Removedstring_decoder@0.10.31(transitive)
- Removedthrough2@0.6.5(transitive)
- Removedxtend@4.0.2(transitive)
Updatedobject-assign@^3.0.0