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

engine-cache

Package Overview
Dependencies
Maintainers
2
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

engine-cache - npm Package Compare versions

Comparing version 0.10.1 to 0.10.2

57

index.js

@@ -170,5 +170,4 @@ 'use strict';

var opts = extend({}, options);
this.asyncHelpers.helpers = extend({}, this.helpers, opts.helpers);
opts.helpers = this.asyncHelpers.get({wrap: opts.async});
return compile(str, opts);
var res = compile(str, mergeHelpers.call(this, opts));
return res;
}

@@ -189,8 +188,5 @@

var opts = extend({}, options);
this.asyncHelpers.helpers = extend({}, this.helpers, opts.helpers);
opts.helpers = this.asyncHelpers.get({wrap: true});
var opts = extend({async: true}, options);
var self = this;
return render.call(this, str, opts, function (err, content) {
return render.call(this, str, mergeHelpers.call(this, opts), function (err, content) {
if (err) return callback(err);

@@ -226,3 +222,3 @@ return self.resolve(content, callback);

// replace the async ID with the resolved value
str = str.replace(key, value);
str = str.split(key).join(value);
next(null);

@@ -317,1 +313,44 @@ });

};
/**
* 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 = {};
var keys = Object.keys(helpers || {});
var len = keys.length;
var i = 0;
while (len--) {
var key = keys[i++];
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.
*
* @param {Object} `options` Options passed into `render` or `compile`
* @return {Object} Options object with merged helpers
*/
function mergeHelpers (options) {
this.asyncHelpers.helpers = extend({},
filterHelpers(this.helpers, true),
filterHelpers(options.helpers, true));
options.helpers = extend({},
filterHelpers(this.helpers),
filterHelpers(options.helpers),
this.asyncHelpers.get({wrap: options.async}));
return options;
}

2

package.json
{
"name": "engine-cache",
"description": "express.js inspired template-engine manager.",
"version": "0.10.1",
"version": "0.10.2",
"homepage": "https://github.com/jonschlinkert/engine-cache",

@@ -6,0 +6,0 @@ "author": {

@@ -56,3 +56,3 @@ # engine-cache [![NPM version](https://badge.fury.io/js/engine-cache.svg)](http://badge.fury.io/js/engine-cache)

### [.load](./index.js#L249)
### [.load](./index.js#L245)

@@ -68,3 +68,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#L282)

@@ -87,3 +87,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#L300)

@@ -114,4 +114,4 @@ Remove `ext` engine from the cache, or if no value is specified the entire cache is reset.

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on March 27, 2015._
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on March 31, 2015._
[helper-cache]: https://github.com/jonschlinkert/helper-cache
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