JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 28707
  • Score
    100M100P100Q166364F
  • License MIT

The most interesting project in the world > Verb

Package Exports

  • load-helpers

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (load-helpers) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

load-helpers NPM version

The most interesting project in the world > Verb

Install

Install with npm

$ npm i load-helpers --save

Usage

var loader = require('load-helpers');
// optionally pass an object to use for caching the helpers
var cache = {};
var helpers = loader(cache);

// object of helpers
helpers({
  a: function(),
  b: function(),
  c: function()
});

// key-value pairs
helpers('d', function() {});
helpers('e', function() {});
helpers('f', function() {});

// glob pattern or file path, string or array
helpers('helpers/*.js'); // g, h, i

// required from node_modules
helpers('j');

Results in:

{
  a: function(){},
  b: function(){},
  c: function(){},
  d: function(){},
  e: function(){},
  f: function(){},
  g: function(){},
  h: function(){},
  i: function(){},
  j: function(){}
}

options.renameKey

When requiring helpers from a filepath or node_modules a renameKey function may be passed on the helper's options to customize how the key is named:

Example

helpers('for-own', {
  renameKey: function (key) {
    // naive camelize
    return key.replace(/\W(.)/g, function (_, ch) {
      return ch.toUpperCase();
    });
  }
});
//=> {forOwn: [function]}

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Author

Jon Schlinkert

License

Copyright © 2015 Jon Schlinkert Released under the MIT license.


This file was generated by verb-cli on September 11, 2015.