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.5 to 0.10.6

33

index.js

@@ -170,12 +170,21 @@ 'use strict';

if (typeof str !== 'function') {
str = this.compile(str, options);
if (typeof cb !== 'function') {
throw new TypeError('engine-cache `render` expects a callback function.');
}
if (typeof str === 'function') {
return this.resolve(str(options), cb);
} else if (typeof str === 'string') {
str = this.compile(str, options);
} else {
return cb(new TypeError('engine-cache `render` expects a string or function.'));
}
var opts = merge({}, {async: true}, options);
var ctx = mergeHelpers.call(this, opts);
var self = this;
return render.call(this, str, mergeHelpers.call(this, opts), function (err, content) {
return render.call(this, str, ctx, function (err, content) {
if (err) return cb(err);

@@ -187,7 +196,10 @@ return self.resolve(content, cb);

engine.renderSync = function wrappedRenderSync(str, opts) {
if (typeof str !== 'function') {
str = this.compile(str, opts);
}
if (typeof str === 'function') {
return str(opts);
} else if (typeof str === 'string') {
str = this.compile(str, opts);
} else {
throw new TypeError('engine-cache `renderSync` expects a string or function.');
}

@@ -201,2 +213,9 @@

engine.resolve = function resolveHelpers(str, cb) {
if (typeof cb !== 'function') {
throw new TypeError('engine-cache `resolve` expects a callback function.');
}
if (typeof str !== 'string') {
return cb(new TypeError('engine-cache `resolve` expects a string.'));
}
var self = this;

@@ -291,3 +310,3 @@ // `stash` contains the objects created when rendering the template

if (ext) {
if (ext[0] !== '.') ext = '.' + ext;
if (ext && ext.charAt(0) !== '.') ext = '.' + ext;
delete this.cache[ext];

@@ -294,0 +313,0 @@ } else {

{
"name": "engine-cache",
"description": "express.js inspired template-engine manager.",
"version": "0.10.5",
"version": "0.10.6",
"homepage": "https://github.com/jonschlinkert/engine-cache",

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

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