load-helpers
Advanced tools
Comparing version 0.2.11 to 0.3.0
20
index.js
@@ -10,10 +10,12 @@ /*! | ||
var util = require('util'); | ||
var Emitter = require('component-emitter'); | ||
var utils = require('./utils'); | ||
module.exports = function(cache, options) { | ||
module.exports = Emitter(loadHelpers); | ||
function loadHelpers(cache, options) { | ||
options = options || {}; | ||
cache = cache || {}; | ||
function loadHelpers(key, val) { | ||
function loaderFn(key, val) { | ||
if (typeof key === 'function') { | ||
@@ -53,3 +55,5 @@ throw new TypeError('key should be an object, array or string.'); | ||
} | ||
cache[name] = fn; | ||
loadHelpers.emit(options.emit || 'helper', name, fn, !!fn.async); | ||
return cache; | ||
@@ -61,3 +65,3 @@ } | ||
helpers.forEach(function(helper) { | ||
loadHelpers(helper, opts); | ||
loaderFn(helper, opts); | ||
}); | ||
@@ -77,3 +81,3 @@ } else if (utils.isObject(helpers)) { | ||
helper.forEach(function(val) { | ||
utils.extend(obj[name], loadHelpers(val, opts)); | ||
utils.extend(obj[name], loaderFn(val, opts)); | ||
}); | ||
@@ -101,5 +105,5 @@ utils.extend(cache, obj); | ||
name = utils.renameKey(name, opts); | ||
loadHelpers(name, file); | ||
loaderFn(name, file); | ||
} else { | ||
loadHelpers(file, opts); | ||
loaderFn(file, opts); | ||
} | ||
@@ -110,3 +114,3 @@ } | ||
return loadHelpers; | ||
return loaderFn; | ||
}; |
{ | ||
"name": "load-helpers", | ||
"description": "Load helpers with patterns, as an object, key-value pair, or module.", | ||
"version": "0.2.11", | ||
"version": "0.3.0", | ||
"homepage": "https://github.com/jonschlinkert/load-helpers", | ||
@@ -14,2 +14,4 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"index.js", | ||
"LICENSE", | ||
"README.md", | ||
"utils.js" | ||
@@ -25,6 +27,7 @@ ], | ||
"dependencies": { | ||
"component-emitter": "^1.2.1", | ||
"extend-shallow": "^2.0.1", | ||
"is-valid-glob": "^0.3.0", | ||
"lazy-cache": "^2.0.1", | ||
"matched": "^0.4.1", | ||
"matched": "^0.4.3", | ||
"resolve-dir": "^0.1.0" | ||
@@ -34,7 +37,5 @@ }, | ||
"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" | ||
"gulp-eslint": "^3.0.1", | ||
"gulp-format-md": "^0.1.9", | ||
"mocha": "^2.5.3" | ||
}, | ||
@@ -55,2 +56,10 @@ "keywords": [ | ||
"verb": { | ||
"toc": false, | ||
"layout": "default", | ||
"tasks": [ | ||
"readme" | ||
], | ||
"plugins": [ | ||
"gulp-format-md" | ||
], | ||
"related": { | ||
@@ -60,6 +69,14 @@ "list": [ | ||
"helper-cache", | ||
"template-helpers" | ||
"template-helpers", | ||
"templates" | ||
] | ||
}, | ||
"reflinks": [ | ||
"verb", | ||
"verb-generate-readme" | ||
], | ||
"lint": { | ||
"reflinks": true | ||
} | ||
} | ||
} |
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
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
11106
4
5
142
0
120
6
+ Addedcomponent-emitter@^1.2.1
+ Addedcomponent-emitter@1.3.1(transitive)
Updatedmatched@^0.4.3