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.2.6 to 0.3.0

19

index.js

@@ -65,3 +65,3 @@ 'use strict';

Engines.prototype.register = function (ext, options, fn) {
Engines.prototype.register = function (ext, fn, options) {
var args = [].slice.call(arguments).filter(Boolean);

@@ -72,13 +72,12 @@

if (args.length === 3 && typeof options === 'function') {
var opts = fn;
fn = options;
options = opts;
if (args.length === 3) {
if (options && (typeof options === 'function' ||
options.hasOwnProperty('render') ||
options.hasOwnProperty('renderFile'))) {
var opts = fn;
fn = options;
options = opts;
}
}
if (args.length === 2) {
fn = options;
options = {};
}
if (typeof fn === 'function') {

@@ -85,0 +84,0 @@ engine = fn;

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

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

@@ -89,3 +89,41 @@ /*!

});
it('should allow options to be passed as the last argument.', function() {
engines
.register('a', {render: function () {}}, {foo: 'bar'})
.register('b', {render: function () {}}, {foo: 'bar'})
.register('c', {render: function () {}}, {foo: 'bar'})
.register('d', {render: function () {}}, {foo: 'bar'});
var a = engines.get('.a');
assert.equal(typeof a, 'object');
assert.equal(typeof a.render, 'function');
assert.equal(typeof a.options.foo, 'string');
engines.engines.should.have.property('.a');
engines.engines.should.have.property('.b');
engines.engines.should.have.property('.c');
engines.engines.should.have.property('.d');
Object.keys(engines.engines).length.should.equal(4);
});
it('should allow options to be passed as the second argument.', function() {
engines
.register('a', {foo: 'bar'}, {render: function () {}})
.register('b', {foo: 'bar'}, {render: function () {}})
.register('c', {foo: 'bar'}, {render: function () {}})
.register('d', {foo: 'bar'}, {render: function () {}});
var a = engines.get('.a');
assert.equal(typeof a, 'object');
assert.equal(typeof a.render, 'function');
assert.equal(typeof a.options.foo, 'string');
engines.engines.should.have.property('.a');
engines.engines.should.have.property('.b');
engines.engines.should.have.property('.c');
engines.engines.should.have.property('.d');
Object.keys(engines.engines).length.should.equal(4);
});
});
});
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