0.2.2 • Published 8 years ago

expand-utils v0.2.2

Weekly downloads
26
License
MIT
Repository
github
Last release
8 years ago

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

.is

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

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:

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.

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago