boson

0.3.0 • Public • Published

boson NPM version

Use glob patterns to load an array of requireable files or npm modules - like plugins or middleware, optionally passing a config object to each module.

Install

Install with npm:

npm i boson --save-dev

API

resolve

Boson https://github.com/jonschlinkert/boson

Copyright (c) 2014 Jon Schlinkert, contributors. Licensed under the MIT license.

boson

Uses a simple require on each module found and attempts to pass a config object is one is specified, returning an array of functions or objects exported from local or named npm modules. Wildcard (glob) patterns may be used.

  • patterns {Array|String}: Glob patterns, file paths or named npm modules.
  • config {Object}: Optional config object to pass to each function.
  • options {Object}: Options to pass to resolve-dep.
  • returns: {Array}

Example:

boson('index.js', {foo: 'bar'}); // index.js file for boson
//=> [ { [Function] find: [Function], register: [Function] } ]

.find

Returns an array of resolved filepaths for local or named npm modules. Wildcard (glob) patterns may be used.

  • patterns {Array|String}: Glob patterns, file paths or named npm modules.
  • options {Object}: Options to pass to resolve-dep.
  • returns: {Array}

Example:

(Returned paths are shortened for example).

boson.find('mocha');
//=> ['~/boson/node_modules/mocha/index.js']
 
boson.find(['mocha', '*.js']);
//=> [ '~/boson/index.js', '~/boson/node_modules/mocha/index.js' ]
 
// Optionally pass a config object
boson.find(['mocha', '*.js'], {foo: 'bar'});
//=> [ '~/boson/index.js', '~/boson/node_modules/mocha/index.js' ]

.register

Uses a simple require on each module found, returning an array of functions or objects exported from local or named npm modules. Wildcard (glob) patterns may be used.

  • patterns {Array|String}: Glob patterns, file paths or named npm modules.
  • options {Object}: Options to pass to resolve-dep.
  • returns: {Array}

Example:

boson('index.js'); // index.js file for boson
//=> [ { [Function] find: [Function], register: [Function] } ]

Author

Jon Schlinkert

License

Copyright (c) 2014 Jon Schlinkert, contributors. Released under the MIT license


This file was generated by verb-cli on August 13, 2014.

Package Sidebar

Install

npm i boson

Weekly Downloads

1

Version

0.3.0

License

none

Last publish

Collaborators

  • jonschlinkert