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

load-helpers

Package Overview
Dependencies
Maintainers
2
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

load-helpers - npm Package Compare versions

Comparing version 0.2.10 to 0.2.11

35

index.js

@@ -10,5 +10,6 @@ /*!

var util = require('util');
var utils = require('./utils');
module.exports = function (cache, options) {
module.exports = function(cache, options) {
options = options || {};

@@ -25,5 +26,7 @@ cache = cache || {};

}
if (utils.isObject(key)) {
return addHelpers(key, val);
}
val = val || {};

@@ -40,6 +43,10 @@ key = utils.arrayify(key);

function addHelper(name, fn) {
var fn = typeof fn === 'string'
? utils.tryRequire(fn)
: fn;
if (typeof fn === 'string') {
fn = utils.tryRequire(fn);
}
if (typeof fn !== 'function' && !utils.isObject(fn)) {
throw new TypeError('expected a function or object');
}
if (options.async === true) {

@@ -54,8 +61,22 @@ fn.async = true;

if (Array.isArray(helpers) && helpers.length) {
helpers.forEach(function (helper) {
helpers.forEach(function(helper) {
loadHelpers(helper, opts);
});
} else {
} else if (utils.isObject(helpers)) {
for (var name in helpers) {
addHelper(name, helpers[name]);
var helper = helpers[name];
if (typeof helper === 'function') {
addHelper(name, helper);
} else if (utils.isObject(helper)) {
addHelpers(helper, opts);
} else if (typeof helper === 'string') {
addHelper(name, utils.tryRequire(helper));
} else if (Array.isArray(helper)) {
var obj = {};
obj[name] = {};
helper.forEach(function(val) {
utils.extend(obj[name], loadHelpers(val, opts));
});
utils.extend(cache, obj);
}
}

@@ -62,0 +83,0 @@ }

24

package.json
{
"name": "load-helpers",
"description": "Load helpers with patterns, as an object, key-value pair, or module.",
"version": "0.2.10",
"version": "0.2.11",
"homepage": "https://github.com/jonschlinkert/load-helpers",

@@ -24,15 +24,15 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

"dependencies": {
"extend-shallow": "^2.0.1",
"is-valid-glob": "^0.3.0",
"lazy-cache": "^0.2.3",
"matched": "^0.3.2",
"lazy-cache": "^2.0.1",
"matched": "^0.4.1",
"resolve-dir": "^0.1.0"
},
"devDependencies": {
"gulp": "^3.9.0",
"gulp-istanbul": "^0.10.0",
"gulp-jshint": "^1.11.2",
"gulp-mocha": "^2.1.3",
"jshint-stylish": "^2.0.1",
"mocha": "*",
"should": "*"
"gulp": "^3.9.1",
"gulp-eslint": "^2.0.0",
"gulp-istanbul": "^0.10.4",
"gulp-mocha": "^2.2.0",
"mocha": "^2.5.3",
"should": "^9.0.0"
},

@@ -55,5 +55,5 @@ "keywords": [

"list": [
"handlebars-helpers",
"helper-cache",
"template-helpers",
"handlebars-helpers"
"template-helpers"
]

@@ -60,0 +60,0 @@ }

@@ -5,2 +5,6 @@ 'use strict';

var utils = require('lazy-cache')(require);
var fn = require;
require = utils;
/**

@@ -10,9 +14,6 @@ * Lazily required module dependencies

var utils = require('lazy-cache')(require);
var fn = require;
require = utils;
require('extend-shallow', 'extend');
require('is-valid-glob', 'isGlob');
require('matched', 'glob');
require('resolve-dir');
require('is-valid-glob', 'isGlob');
require = fn;

@@ -30,3 +31,3 @@

return require(name);
} catch(err) {}
} catch (err) {}

@@ -36,3 +37,3 @@ // try to require by absolute path

return require(utils.resolve(name, opts));
} catch(err) {}
} catch (err) {}
return null;

@@ -39,0 +40,0 @@ };

Sorry, the diff of this file is not supported yet

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