Awesome
expand-utils
Utils shared by the expand libs.
Install
Install with npm:
$ npm install --save expand-utils
Usage
var util = require('expand-utils');
API
.is
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
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);
.isBoilerplate
Return true if the given value has boilerplate properties
Params
config
{Object}: The configuration object to check
Example
exports.isBoilerplates({});
.isConfig
Return true if the given value has config properties
Params
config
{Object}: The configuration object to check
Example
exports.isConfig({});
.isScaffold
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 check
Example
console.log(exports.isScaffold({
foo: {
options: {},
files: []
},
bar: {
options: {},
files: []
}
}));
//=> true
.isTask
Return true if the given value has task properties
Params
config
{Object}: The configuration object to check
Example
console.log(exports.isTask({
foo: {
options: {},
files: []
},
bar: {
options: {},
files: []
}
}));
//=> true
.isTarget
Return true if the given value is has target properties.
Params
config
{Object}: The configuration object to check
Example
console.log(exports.isTarget({
name: 'foo',
options: {},
files: []
}));
//=> true
.isFiles
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 check
Example
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
.hasFilesProps
Return true if the given value is an object that has src
, dest
or files
properties.
Params
config
{Object}: The configuration object to check
Example
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
Related projects
You might also be interested in these projects:
- expand-config: Expand tasks, targets and files in a declarative configuration. | homepage
- expand-files: Expand glob patterns in a declarative configuration into src-dest mappings. | homepage
- expand-target: Expand target definitions in a declarative configuration. | homepage
- expand-task: Expand and normalize task definitions in a declarative configuration. | homepage
- normalize-config: Normalize a declarative configuration with any combination of src-dest mappings, files arrays, files objects and… more | homepage
Contributing
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.
Building docs
(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
Running tests
Install dev dependencies:
$ npm install -d && npm test
Author
Jon Schlinkert
License
Copyright © 2016, Jon Schlinkert. Released under the MIT license.
This file was generated by verb, v0.9.0, on June 27, 2016.