Skip to content

jonschlinkert/expand-utils

Repository files navigation

expand-utils NPM version NPM downloads Build Status

Utils shared by the expand libs.

Install

Install with npm:

$ npm install --save expand-utils

Usage

var util = require('expand-utils');

API

Decorates the given object with a is* method, where * is the given name.

Params

  • obj {Object}: The object to check
  • name {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 check

Example

exports.isBoilerplates({});

Return true if the given value has config properties

Params

  • config {Object}: The configuration object to check

Example

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 check

Example

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 check

Example

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 check

Example

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 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

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:

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.

About

Utils shared by the "expand" libs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published