Create a collection for vinyl files.
Install with npm:
$ npm install --save vinyl-collection
var Collection = require('vinyl-collection');
Create a new Collection with the given options.
Params
options {Object}Example
var collection = new Collection();
Create a vinyl file.
Params
key {String|Object}: Optionally define a key to use if the file will be cached.file {Object}: Object or instance of [vinyl][].returns {Object}Example
var file = collection.file('foo', {path: 'a/b/c.js'});
Add a file to the collection.
Params
key {String|Object}: Either the key to use for caching the file, or a [vinyl][] file objectfile {Object}: Object or instance of Vinylreturns {Object}: Returns the instance for chainingExample
collection.addFile('foo', {path: 'a/b/c.js'});
Add an object or array of files to the collection.
Params
files {Array|Object}returns {Object}: Returns the instance for chainingExample
collection.addFiles(files);
Get a file from the collection.
Params
key {String|Object}: The key of the file to get. If key is a file object it is returned.returns {Object}: Returns the file if foundExample
var file = collection.getFile('foo');
Returns true if file is a collection file object.
Params
file {Object}returns {Boolean}Example
console.log(collection.isFile('foo'));
//=> false
console.log(collection.isFile(new Vinyl({path: 'foo'})));
//=> false
console.log(collection.isFile(collection.file({path: 'foo'})));
//=> true
Static method, returns true if file is a collection file object.
Params
file {Object}returns {Boolean}Example
console.log(Collection.isFile('foo'));
//=> false
console.log(Collection.isFile(new Vinyl({path: 'foo'})));
//=> false
console.log(Collection.isFile(collection.file({path: 'foo'})));
//=> true
This document was generated by [verb-readme-generator][] (a verb generator), please don't edit directly. Any changes to the readme must be made in .verb.md. See Building Docs.
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue. Or visit the [verb-readme-generator][] project to submit bug reports or pull requests for the readme layout template.
Generate readme and API documentation with verb:
$ npm install -g verb verb-readme-generator && verb
Install dev dependencies:
$ npm install -d && npm test
Jon Schlinkert
Copyright © 2016, Jon Schlinkert. Released under the MIT license.
This file was generated by verb, v0.9.0, on June 15, 2016.