Utils shared by the expand libs.
Install with npm:
$ npm install --save expand-utils
var util = require('expand-utils');
Decorates the given object with a is* method, where * is the given name.
Params
obj {Object}: The object to checkname {String}Example
var obj = {};
exports.is(obj, 'foo');
console.log(obj.isFoo);
//=> true
Run parent's plugins on the child object, specifying a key to use for decorating the child object with an is property.
Example
exports.run(parent, 'foo', obj);
Return true if the given value has boilerplate properties
Params
config {Object}: The configuration object to checkExample
exports.isBoilerplates({});
Return true if the given value has config properties
Params
config {Object}: The configuration object to checkExample
exports.isConfig({});
Return true if the given value has scaffold properties. Scaffolds are essentially the same configuration structure as tasks from expand-task. We use expand-task for expanding grunt-style configs. But we use scaffold when working with gulp configs.
Params
config {Object}: The configuration object to checkExample
console.log(exports.isScaffold({
foo: {
options: {},
files: []
},
bar: {
options: {},
files: []
}
}));
//=> true
Return true if the given value has task properties
Params
config {Object}: The configuration object to checkExample
console.log(exports.isTask({
foo: {
options: {},
files: []
},
bar: {
options: {},
files: []
}
}));
//=> true
Return true if the given value is has target properties.
Params
config {Object}: The configuration object to checkExample
console.log(exports.isTarget({
name: 'foo',
options: {},
files: []
}));
//=> true
Return true if the given value is an object and instance of expand-files, has an isFiles property, or returns true from hasFilesProps.
Params
config {Object}: The configuration object to checkExample
console.log(exports.hasFilesProps({isFiles: true}));
//=> true
console.log(exports.hasFilesProps({files: []}));
//=> true
console.log(exports.hasFilesProps({files: [{src: [], dest: ''}]}));
//=> true
console.log(exports.hasFilesProps({src: []}));
//=> true
console.log(exports.hasFilesProps({dest: ''}));
//=> true
console.log(exports.hasFilesProps({foo: ''}));
//=> false
Return true if the given value is an object that has src, dest or files properties.
Params
config {Object}: The configuration object to checkExample
console.log(exports.hasFilesProps({files: []}));
//=> true
console.log(exports.hasFilesProps({files: [{src: [], dest: ''}]}));
//=> true
console.log(exports.hasFilesProps({src: []}));
//=> true
console.log(exports.hasFilesProps({dest: ''}));
//=> true
console.log(exports.hasFilesProps({foo: ''}));
//=> false
You might also be interested in these projects:
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.
(This document was generated by verb-readme-generator (a verb generator), please don't edit the readme directly. Any changes to the readme must be made in .verb.md.)
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 27, 2016.