Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

load-helpers

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

load-helpers

Load helpers with patterns, as an object, key-value pair, or module.

  • 0.2.9
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
26K
decreased by-13.92%
Maintainers
1
Weekly downloads
 
Created
Source

load-helpers NPM version

Load helpers with patterns, as an object, key-value pair, or module.

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]}
  • handlebars-helpers: 120+ Handlebars helpers in ~20 categories, for Assemble, YUI, Ghost or any Handlebars project. Includes… more | homepage
  • helper-cache: Easily register and get helper functions to be passed to any template engine or node.js… more | homepage
  • template-helpers: Generic JavaScript helpers that can be used with any template engine. Handlebars, Lo-Dash, Underscore, or… more | homepage

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 October 21, 2015.

Keywords

FAQs

Package last updated on 21 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc