load-helpers
Advanced tools
Comparing version 0.2.5 to 0.2.6
@@ -20,3 +20,3 @@ /*! | ||
if (typeof val === 'function') { | ||
if (typeof val === 'function' || typeof val === 'string') { | ||
return addHelper(key, val); | ||
@@ -38,3 +38,5 @@ } | ||
function addHelper(name, fn) { | ||
cache[name] = fn; | ||
cache[name] = typeof fn === 'string' | ||
? utils.tryRequire(fn) | ||
: fn; | ||
return cache; | ||
@@ -41,0 +43,0 @@ } |
{ | ||
"name": "load-helpers", | ||
"description": "The most interesting project in the world > Verb", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"homepage": "https://github.com/jonschlinkert/load-helpers", | ||
@@ -6,0 +6,0 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", |
@@ -107,2 +107,2 @@ # load-helpers [![NPM version](https://badge.fury.io/js/load-helpers.svg)](http://badge.fury.io/js/load-helpers) | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on September 11, 2015._ | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on September 21, 2015._ |
14
utils.js
@@ -20,11 +20,11 @@ 'use strict'; | ||
utils.tryRequire = function tryRequire(name, opts) { | ||
// try to require by `name` | ||
try { | ||
// try to require by `name` | ||
return require(name); | ||
} catch(err) { | ||
try { | ||
var fp = utils.resolve(name, opts); | ||
return require(fp); | ||
} catch(err) {} | ||
} | ||
} catch(err) {} | ||
// try to require by absolute path | ||
try { | ||
return require(utils.resolve(name, opts)); | ||
} catch(err) {} | ||
return null; | ||
@@ -31,0 +31,0 @@ }; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
7910
112
107