{"_id":"vinyl-map2","_rev":"82-b7af72968693e0b9401a625805ce3595","name":"vinyl-map2","dist-tags":{"latest":"1.2.1"},"versions":{"1.1.0":{"name":"vinyl-map2","version":"1.1.0","keywords":["vinyl","gulp","gulpfriendly","file","stream","map"],"author":{"url":"http://hughsk.io/","name":"Hugh Kennedy","email":"hughskennedy@gmail.com"},"license":"MIT","_id":"vinyl-map2@1.1.0","maintainers":[{"name":"nymdev","email":"nymdev@nymag.com"}],"contributors":[{"name":"Nelson Pecora","email":"nelson@keats.me"}],"homepage":"https://github.com/yoshokatana/vinyl-map2","bugs":{"url":"https://github.com/yoshokatana/vinyl-map2/issues"},"dist":{"shasum":"466308d41e0801906289936f50eb3912572fce1b","tarball":"https://registry.npmjs.org/vinyl-map2/-/vinyl-map2-1.1.0.tgz","integrity":"sha512-142E2c8SjPAZ0crPBI2HC1V7/iETIhtdD1C7ZcTG+9HElXS/uETVi1ALMNxvnWeumOa85FbwE1zdGd+WkhddBg==","signatures":[{"sig":"MEQCIBoUUZe2Ayf46MVVu9fCrimF+B4LqHSwOrgnAvzAeIY7AiAh4iUGZJKTyTZBbmuTVe8rg7vpwPGYqVqVnGpO4RpFAw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"466308d41e0801906289936f50eb3912572fce1b","gitHead":"503faf40bb9647345fa7e58e9243e30178b2e5c3","scripts":{"test":"node test"},"_npmUser":{"name":"nymdev","email":"nymdev@nymag.com"},"repository":{"url":"git://github.com/yoshokatana/vinyl-map2.git","type":"git"},"_npmVersion":"2.14.2","description":"Map vinyl files' contents as strings, so you can easily use existing code without needing yet another gulp plugin!","directories":{},"_nodeVersion":"4.0.0","dependencies":{"bl":"^0.7.0","new-from":"0.0.3","through2":"^0.4.1"},"devDependencies":{"gulp":"~3.5.2","tape":"~2.3.2","vinyl":"~0.2.1","uglify-js":"~2.4.12","concat-stream":"^1.4.8"}},"1.1.1":{"name":"vinyl-map2","version":"1.1.1","keywords":["vinyl","gulp","gulpfriendly","file","stream","map"],"author":{"url":"http://hughsk.io/","name":"Hugh Kennedy","email":"hughskennedy@gmail.com"},"license":"MIT","_id":"vinyl-map2@1.1.1","maintainers":[{"name":"nymdev","email":"nymdev@nymag.com"}],"contributors":[{"name":"Nelson Pecora","email":"nelson@keats.me"}],"homepage":"https://github.com/yoshokatana/vinyl-map2","bugs":{"url":"https://github.com/yoshokatana/vinyl-map2/issues"},"dist":{"shasum":"748ce977f90a9ba982b024c7a62e6ec8ad03aa46","tarball":"https://registry.npmjs.org/vinyl-map2/-/vinyl-map2-1.1.1.tgz","integrity":"sha512-6cZVCWVYXM27fGiM+zJ6FrndrJZ3VOJkiPkNxoVqPzw10VLGvuRwGGW6pvlHxk2+pdDyQfCRh4nWCoMoB5Cimw==","signatures":[{"sig":"MEYCIQDVI6qB42ezD55cg77ucgciFB+o4N4c9cZGokdSt4LCGAIhAPMUjOZyPX/nfbXg39wpHV+/cq7ftqx+zSeGp45RbOlD","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"748ce977f90a9ba982b024c7a62e6ec8ad03aa46","gitHead":"8c9a0bf641dc55d7d7bbbabaebf778819088414d","scripts":{"test":"node test.js | node_modules/.bin/tap-spec"},"_npmUser":{"name":"nymdev","email":"nymdev@nymag.com"},"repository":{"url":"git://github.com/yoshokatana/vinyl-map2.git","type":"git"},"_npmVersion":"2.14.2","description":"Map vinyl files' contents as strings, so you can easily use existing code without needing yet another gulp plugin!","directories":{},"_nodeVersion":"4.0.0","dependencies":{"bl":"^0.7.0","new-from":"0.0.3","through2":"^0.4.1"},"devDependencies":{"gulp":"~3.5.2","tape":"~2.3.2","vinyl":"~0.2.1","tap-spec":"^4.1.0","uglify-js":"~2.4.12","concat-stream":"^1.4.8"}},"1.1.2":{"name":"vinyl-map2","version":"1.1.2","keywords":["vinyl","gulp","gulpfriendly","file","stream","map"],"author":{"url":"http://hughsk.io/","name":"Hugh Kennedy","email":"hughskennedy@gmail.com"},"license":"MIT","_id":"vinyl-map2@1.1.2","maintainers":[{"name":"nymdev","email":"nymdev@nymag.com"}],"contributors":[{"name":"Nelson Pecora","email":"nelson@keats.me"}],"homepage":"https://github.com/yoshokatana/vinyl-map2","bugs":{"url":"https://github.com/yoshokatana/vinyl-map2/issues"},"dist":{"shasum":"be799c113b4af66bfaca7529cc2cec428dfebffe","tarball":"https://registry.npmjs.org/vinyl-map2/-/vinyl-map2-1.1.2.tgz","integrity":"sha512-ES/6zwG7Gse3PvA8TwjwBK2erxskXMsChSSp0X4B0RtsAzUum++oDdSTpDkuhauVPiZUpm73Si76N4Si51MArA==","signatures":[{"sig":"MEUCIQDydi0LUQmBGubSfYwg4hMI5424m3n6hsDi5ddZmJCxZgIgEKJ0QBIpNOwDuTD+aZN3n+nE5TqLTZP99580Gb4Kpxg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"be799c113b4af66bfaca7529cc2cec428dfebffe","gitHead":"ef8a04af64c7126ff5f40559f30e4bc9e32c2df6","scripts":{"lint":"eslint index.js test.js","test":"npm run lint && node test.js | node_modules/.bin/tap-spec"},"_npmUser":{"name":"nymdev","email":"nymdev@nymag.com"},"repository":{"url":"git://github.com/yoshokatana/vinyl-map2.git","type":"git"},"_npmVersion":"2.14.2","description":"Map vinyl files' contents as strings, so you can easily use existing code without needing yet another gulp plugin!","directories":{},"_nodeVersion":"4.0.0","dependencies":{"bl":"^0.7.0","new-from":"0.0.3","through2":"^0.4.1"},"devDependencies":{"gulp":"~3.5.2","tape":"~2.3.2","vinyl":"~0.2.1","eslint":"^1.7.3","tap-spec":"^4.1.0","uglify-js":"~2.4.12","concat-stream":"^1.4.8"}},"1.2.0":{"name":"vinyl-map2","version":"1.2.0","keywords":["vinyl","gulp","gulpfriendly","file","stream","map"],"author":{"url":"http://hughsk.io/","name":"Hugh Kennedy","email":"hughskennedy@gmail.com"},"license":"MIT","_id":"vinyl-map2@1.2.0","maintainers":[{"name":"nymdev","email":"nymdev@nymag.com"},{"name":"yoshokatana","email":"nelson@keats.me"}],"contributors":[{"name":"Nelson Pecora","email":"nelson@keats.me"}],"homepage":"https://github.com/yoshokatana/vinyl-map2","bugs":{"url":"https://github.com/yoshokatana/vinyl-map2/issues"},"dist":{"shasum":"25996f2f68b9ef7de4f5bc05d8b8b6a41be4d0e4","tarball":"https://registry.npmjs.org/vinyl-map2/-/vinyl-map2-1.2.0.tgz","integrity":"sha512-ht2mlvaPKRwhcxhP13mX9oQ65VvUqahiUESn1o7oI2KAWPDSgvQKa19ai7yMXjf2BJcAL1kNrsdATwww4+PXGw==","signatures":[{"sig":"MEUCIGep4GpvrzpifxaAUCbclCtfBQxX9+8zoQ/hpwJj6Sq6AiEAusNvaayaPEXlYmBKMs+UnXrZAvq6Gm5Zk9iSBALj1qU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"25996f2f68b9ef7de4f5bc05d8b8b6a41be4d0e4","gitHead":"71f96f2911e1539e61253f422371947a212c4468","scripts":{"lint":"eslint index.js test.js","test":"npm run lint && node test.js"},"_npmUser":{"name":"nymdev","email":"nymdev@nymag.com"},"repository":{"url":"git://github.com/yoshokatana/vinyl-map2.git","type":"git"},"_npmVersion":"2.14.2","description":"Map vinyl files' contents as strings, so you can easily use existing code without needing yet another gulp plugin!","directories":{},"_nodeVersion":"4.0.0","dependencies":{"bl":"^0.7.0","new-from":"0.0.3","through2":"^0.4.1"},"devDependencies":{"gulp":"~3.5.2","tape":"^4.2.2","eslint":"^1.7.3","tap-spec":"^4.1.0","gulp-util":"^3.0.7"}},"1.2.1":{"name":"vinyl-map2","version":"1.2.1","keywords":["vinyl","gulp","gulpfriendly","file","stream","map"],"author":{"url":"http://hughsk.io/","name":"Hugh Kennedy","email":"hughskennedy@gmail.com"},"license":"MIT","_id":"vinyl-map2@1.2.1","maintainers":[{"name":"nymdev","email":"nymdev@nymag.com"},{"name":"yoshokatana","email":"nelson@keats.me"}],"contributors":[{"name":"Nelson Pecora","email":"nelson@keats.me"}],"homepage":"https://github.com/yoshokatana/vinyl-map2","bugs":{"url":"https://github.com/yoshokatana/vinyl-map2/issues"},"dist":{"shasum":"bdf70f96efae6f47015faa7f1453013b3a95893e","tarball":"https://registry.npmjs.org/vinyl-map2/-/vinyl-map2-1.2.1.tgz","integrity":"sha512-/BJ6Tawp19BDTLKa7JnA0PI4PKD/uyNOEI6R4bdjnJGu0CzfkFBcjjWoRRfREBZioJ0aAiSbQtep1YQOKkhOnw==","signatures":[{"sig":"MEYCIQCK5AxIomv41DU6GP+ow0UpLam3AVLQIcMcR29fF4ylvgIhAK3ofyez6tE8wdwP8RrhLxBhbaKGD//Myl7JsY2WXGdy","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"bdf70f96efae6f47015faa7f1453013b3a95893e","gitHead":"337ca9f3e99530e2403a65bc8866153946adc5d3","scripts":{"lint":"eslint index.js test.js","test":"npm run lint && node test.js"},"_npmUser":{"name":"nymdev","email":"nymdev@nymag.com"},"repository":{"url":"git://github.com/yoshokatana/vinyl-map2.git","type":"git"},"_npmVersion":"2.14.2","description":"Map vinyl files' contents as strings, so you can easily use existing code without needing yet another gulp plugin!","directories":{},"_nodeVersion":"4.0.0","dependencies":{"bl":"^1.0.0","new-from":"0.0.3","through2":"^2.0.0"},"devDependencies":{"gulp":"~3.9.0","tape":"^4.2.2","eslint":"^1.7.3","tap-spec":"^4.1.0","gulp-util":"^3.0.7"}}},"time":{"created":"2015-10-28T16:19:29.938Z","modified":"2026-09-22T21:37:56.773Z","1.1.0":"2015-10-28T16:19:29.938Z","1.1.1":"2015-10-28T17:01:48.422Z","1.1.2":"2015-10-28T17:10:25.276Z","1.2.0":"2015-10-28T21:19:11.782Z","1.2.1":"2015-10-28T21:33:06.221Z"},"bugs":{"url":"https://github.com/yoshokatana/vinyl-map2/issues"},"author":{"url":"http://hughsk.io/","name":"Hugh Kennedy","email":"hughskennedy@gmail.com"},"license":"MIT","homepage":"https://github.com/yoshokatana/vinyl-map2","keywords":["vinyl","gulp","gulpfriendly","file","stream","map"],"repository":{"url":"git://github.com/yoshokatana/vinyl-map2.git","type":"git"},"description":"Map vinyl files' contents as strings, so you can easily use existing code without needing yet another gulp plugin!","contributors":[{"name":"Nelson Pecora","email":"nelson@keats.me"}],"maintainers":[{"email":"dontae.malone@voxmedia.com","name":"dontae-vox-media"},{"email":"nymdev@nymag.com","name":"nymdev"},{"email":"lchevres@nymag.com","name":"nymdocker"},{"email":"reuben.son@nymag.com","name":"reubenson"},{"email":"Keren.Lerner@nymag.com","name":"kerenlerner"},{"email":"adelina.pepenella@nymag.com","name":"nymedia"},{"email":"webops@nymag.com","name":"nymagwebops"},{"email":"daniel@daniel.sh","name":"phyllisstein"},{"email":"jordanp9312@gmail.com","name":"jordanp9312"},{"email":"ealcantara22@gmail.com","name":"ealcantara22"},{"email":"wendy.ramirez@voxmedia.com","name":"wramirez92"},{"email":"alex.brand@voxmedia.com","name":"alex-vox-media"},{"email":"tara.siegel@voxmedia.com","name":"tara.siegel"},{"email":"shilpa.shetty@voxmedia.com","name":"shilpa.shetty"},{"email":"jesscastillo28@hotmail.com","name":"jess2896"},{"email":"nelson@keats.me","name":"yoshokatana"}],"readme":"# vinyl-map2\n\n[![Circle CI](https://circleci.com/gh/yoshokatana/vinyl-map2/tree/master.svg?style=svg)](https://circleci.com/gh/yoshokatana/vinyl-map2/tree/master)\n\nMap [vinyl](https://github.com/wearefractal/vinyl) files' contents as strings, so you can easily use existing code without needing yet another [gulp](https://github.com/gulpjs/gulp) plugin!\n\nEssentially, with the hope of reducing the number of gulp plugins out there which are *just* doing this:\n\n``` javascript\nvar through = require('through'),\n  uglify = require('uglify-js');\n\nmodule.exports = function() {\n  return through(function(file) {\n    if (file.isNull()) return this.queue(file);\n    if (file.isStream()) throw new Error('no support');\n\n    file.contents = file.contents.toString();\n\n    var minified = uglify.minify(file.contents, {\n      fromString: true\n    })\n\n    file = file.clone();\n    file.contents = new Buffer(minified.code);\n    this.queue(file);\n  });\n}\n```\n\nOf course, sometimes that's fine too, but this might help save some complexity for when it's too much hassle. It also takes care of the differences between handling Buffer, Stream and null values for your `file.contents`.\n\n## Usage\n\n```\nnpm install --save vinyl-map2\n```\n\nHere's a simple example, using gulp:\n\n``` javascript\nvar uglify = require('uglify-js'),\n  map = require('vinyl-map2'),\n  gulp = require('gulp');\n\ngulp.task('minify', function() {\n  var minify = map(function(code, filename) {\n    // file contents are handed\n    // over as buffers\n    code = code.toString();\n\n    return uglify.minify(code, {\n      fromString: true\n    }).code;\n  })\n\n  return gulp.src(['./index.js'])\n    .pipe(minify)\n    .pipe(gulp.dest('./dist'));\n})\n```\n\n## API\n\n### `map(mapper(contents, filename[, done]))`\n\nReturns a transform stream that takes vinyl files as input and spits out their modified copies as output.\n\n`mapper` is a function which will be called once for each file, with three arguments:\n\n* `contents` is a string or [Buffer](http://nodejs.org/api/buffer.html)\n* `filename` is the value of `file.path`, which should generally be the file's\n  absolute path. Might be convenient if you want to filter based on file\n  extension etc.\n* `done` is an _optional_ callback function. If your `mapper` function has a third argument, it will be called asynchronously. If not, the `mapper` will be called synchronously.\n\nThe `mapper` function is expected to return a modified string value for the updated file contents. If nothing is returned, no modifications will be made to the file contents, but the output file will be cloned.\n\nIf you run the `mapper` function asynchronously (by passing in a third `done` argument), you must call it instead of returning the file contents. It is a node-style callback: `done(err, contents)`\n\n## License\n\nMIT. See [LICENSE.md](http://github.com/yoshokatana/vinyl-map2/blob/master/LICENSE.md) for details.\n\n## Contributing\n\nThis project was forked from [hughsk/vinyl-map](https://github.com/hughsk/vinyl-map), and will be actively maintained. I welcome contributions in the form of both bug reports and pull requests!\n\nFork the project and submit a PR on a branch that is not named `master`. We use linting tools and unit tests, which are built constantly using continuous integration. If you find a bug, it would be appreciated if you could also submit a branch with a failing unit test to show your case.\n","readmeFilename":"README.md"}