engine-cache
Advanced tools
Comparing version 0.11.0 to 0.12.1
36
index.js
@@ -225,2 +225,3 @@ 'use strict'; | ||
} | ||
self.asyncHelpers.resolve(key, function (err, value) { | ||
@@ -313,24 +314,3 @@ if (err) return next(err); | ||
/** | ||
* Get helpers that match the given `async` flag. | ||
* | ||
* @param {Object} `helpers` Helpers to filter | ||
* @param {Boolean} `async` Get either async or sync helpers | ||
* @return {Object} Filter helpers object | ||
*/ | ||
function filterHelpers(helpers, async) { | ||
var res = {}; | ||
for (var key in helpers) { | ||
if (helpers.hasOwnProperty(key)) { | ||
if (helpers[key].async == async) { | ||
res[key] = helpers[key]; | ||
} | ||
} | ||
} | ||
return res; | ||
} | ||
/** | ||
* Merge the local engine helpers with the options helpers. | ||
* Ensure only async helpers are passed to `async-helpers` for processing. | ||
* | ||
@@ -341,12 +321,6 @@ * @param {Object} `options` Options passed into `render` or `compile` | ||
function mergeHelpers (options) { | ||
this.asyncHelpers.helpers = _.merge({}, | ||
filterHelpers(this.helpers, true), | ||
filterHelpers(options.helpers, true)); | ||
options.helpers = _.merge({}, | ||
filterHelpers(this.helpers), | ||
filterHelpers(options.helpers), | ||
this.asyncHelpers.get({wrap: !!options.async})); | ||
return options; | ||
function mergeHelpers (opts) { | ||
_.merge(this.asyncHelpers.helpers, this.helpers, opts.helpers); | ||
opts.helpers = this.asyncHelpers.get({wrap: opts.async}); | ||
return opts; | ||
} |
{ | ||
"name": "engine-cache", | ||
"description": "express.js inspired template-engine manager.", | ||
"version": "0.11.0", | ||
"version": "0.12.1", | ||
"homepage": "https://github.com/jonschlinkert/engine-cache", | ||
@@ -10,3 +10,3 @@ "author": { | ||
}, | ||
"maintainers": [ | ||
"contributors": [ | ||
{ | ||
@@ -17,3 +17,3 @@ "name": "Brian Woodward", | ||
], | ||
"contributors": [ | ||
"maintainers": [ | ||
{ | ||
@@ -47,4 +47,5 @@ "name": "Brian Woodward", | ||
"async": "^0.9.0", | ||
"async-helpers": "^0.1.2", | ||
"helper-cache": "^0.6.0" | ||
"async-helpers": "^0.2.0", | ||
"helper-cache": "^0.7.0", | ||
"lodash": "^3.7.0" | ||
}, | ||
@@ -54,8 +55,7 @@ "devDependencies": { | ||
"engine-handlebars": "^0.6.1", | ||
"engine-lodash": "^0.6.2", | ||
"engine-lodash": "^0.6.3", | ||
"engines": "^0.4.0", | ||
"handlebars": "^3.0.1", | ||
"lodash": "^3.6.0", | ||
"mocha": "^2.2.1", | ||
"should": "^5.2.0", | ||
"handlebars": "^3.0.2", | ||
"mocha": "^2.2.4", | ||
"should": "^6.0.1", | ||
"swig": "^1.4.2" | ||
@@ -97,2 +97,2 @@ }, | ||
] | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# engine-cache [![NPM version](https://badge.fury.io/js/engine-cache.svg)](http://badge.fury.io/js/engine-cache) | ||
# engine-cache [![NPM version](https://badge.fury.io/js/engine-cache.svg)](http://badge.fury.io/js/engine-cache) [![Build Status](https://travis-ci.org/jonschlinkert/engine-cache.svg)](https://travis-ci.org/jonschlinkert/engine-cache) | ||
@@ -18,3 +18,3 @@ > express.js inspired template-engine manager. | ||
## API | ||
### [Engines](index.js#L26) | ||
### [Engines](index.js#L24) | ||
@@ -28,3 +28,3 @@ * `engines` **{Object}**: Optionally pass an object of engines to initialize with. | ||
### [.setEngine](index.js#L55) | ||
### [.setEngine](index.js#L53) | ||
@@ -43,3 +43,3 @@ Register the given view engine callback `fn` as `ext`. | ||
### [.getEngine](index.js#L125) | ||
### [.getEngine](index.js#L123) | ||
@@ -59,3 +59,3 @@ Return the engine stored by `ext`. If no `ext` is passed, the entire cache is returned. | ||
### [.load](index.js#L254) | ||
### [.load](index.js#L253) | ||
@@ -71,3 +71,3 @@ Load an object of engines onto the `cache`. Mostly useful for testing, but exposed as a public method. | ||
### [.helpers](index.js#L286) | ||
### [.helpers](index.js#L285) | ||
@@ -90,3 +90,3 @@ Get and set helpers for the given `ext` (engine). If no `ext` is passed, the entire helper cache is returned. | ||
### [.clear](index.js#L304) | ||
### [.clear](index.js#L303) | ||
@@ -104,7 +104,7 @@ Remove `ext` engine from the cache, or if no value is specified the entire cache is reset. | ||
## Related | ||
* [helper-cache](https://github.com/jonschlinkert/helper-cache): Easily register and get helper functions to be passed to any template engine or node.js application. Methods for both sync and async helpers. | ||
* [async-helpers](https://github.com/doowb/async-helpers): Use async helpers in template engines like Handlebars and Lodash. | ||
* [template](https://github.com/jonschlinkert/template): Render templates from any engine. Make custom template types, use layouts on pages, partials or any custom template type, custom delimiters, helpers, middleware, routes, loaders, and lots more. Powers Assemble v0.6.0, Verb v0.3.0 and your application. | ||
* [template-helpers](https://github.com/jonschlinkert/template-helpers): Generic JavaScript helpers that can be used with any template engine. Handlebars, Lo-Dash, Underscore, or any engine that supports helper functions. | ||
* [handlebars-helpers](https://github.com/assemble/handlebars-helpers): 120+ Handlebars helpers in ~20 categories, for Assemble, YUI, Ghost or any Handlebars project. Includes helpers like {{i18}}, {{markdown}}, {{relative}}, {{extend}}, {{moment}}, and so on. | ||
* [async-helpers](https://github.com/doowb/async-helpers): Use async helpers in templates with engines that typically only… [more](https://github.com/doowb/async-helpers) | ||
* [handlebars-helpers](https://github.com/assemble/handlebars-helpers): 120+ Handlebars helpers in ~20 categories, for Assemble, YUI, Ghost… [more](https://github.com/assemble/handlebars-helpers) | ||
* [helper-cache](https://github.com/jonschlinkert/helper-cache): Easily register and get helper functions to be passed to… [more](https://github.com/jonschlinkert/helper-cache) | ||
* [template-helpers](https://github.com/jonschlinkert/template-helpers): Generic JavaScript helpers that can be used with any template… [more](https://github.com/jonschlinkert/template-helpers) | ||
* [template](https://github.com/jonschlinkert/template): Render templates from any engine. Make custom template types, use… [more](https://github.com/jonschlinkert/template) | ||
@@ -122,10 +122,9 @@ ## Running tests | ||
## Author | ||
**Jon Schlinkert** | ||
+ [github/jonschlinkert](https://github.com/jonschlinkert) | ||
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) | ||
[github/jonschlinkert](https://github.com/jonschlinkert) | ||
[twitter/jonschlinkert](http://twitter.com/jonschlinkert) | ||
## License | ||
Copyright (c) 2014-2015 Jon Schlinkert | ||
Copyright (c) 2014-2015 Jon Schlinkert | ||
Released under the MIT license | ||
@@ -135,5 +134,5 @@ | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on April 21, 2015._ | ||
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on April 23, 2015._ | ||
[helper-cache]: https://github.com/jonschlinkert/helper-cache | ||
<!-- deps: swig lodash mocha engine-lodash handlebars --> |
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
8
14704
4
278
130
+ Addedlodash@^3.7.0
+ Addedasync-helpers@0.2.5(transitive)
+ Addedextend-shallow@2.0.1(transitive)
+ Addedhelper-cache@0.7.2(transitive)
+ Addedis-extendable@0.1.1(transitive)
+ Addedlazy-cache@0.2.7(transitive)
+ Addedlodash@3.10.1(transitive)
+ Addedlodash._createwrapper@3.2.0(transitive)
+ Addedlodash._replaceholders@3.0.0(transitive)
+ Addedlodash._root@3.0.1(transitive)
+ Addedlodash.bind@3.1.0(transitive)
+ Addedlodash.restparam@3.6.1(transitive)
- Removedasync-helpers@0.1.3(transitive)
- Removedhelper-cache@0.6.0(transitive)
- Removedlodash@2.4.2(transitive)
Updatedasync-helpers@^0.2.0
Updatedhelper-cache@^0.7.0