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

engine-cache

Package Overview
Dependencies
Maintainers
1
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.1.0 to 0.1.1

test/init.js

2

.verbrc.md

@@ -9,3 +9,3 @@ ---

## Install
{%= include("install") %}
{%= include("install-npm", {save: true}) %}

@@ -12,0 +12,0 @@ ## Usage

@@ -9,13 +9,7 @@ 'use strict';

/**
* Create a new instance of `Engines`, optionally
* passing the default `options` to use.
*
* **Example:**
*
* ```js
* var Engines = require('engine-cache')
* var engines = new Engines()
* var engines = require('engine-cache')
* ```
*
* @class `Engines`
* @method `engines`
* @param {Object} `options` Default options to use.

@@ -57,6 +51,6 @@ * @api public

debug('init', arguments);
engines.options = {};
engines.cache = {};
engines.extend(opts);
engines.defaultEngines();
this.options = {};
this.cache = {};
this.extend(opts);
this.defaultEngines();
};

@@ -73,4 +67,4 @@

debug('defaultEngines', arguments);
engines.register('tmpl', require('./defaults/lodash'));
engines.register('*', require('./defaults/noop'));
this.register('tmpl', require('./defaults/lodash'));
this.register('*', require('./defaults/noop'));
};

@@ -80,56 +74,2 @@

/**
* Extend the options with the given `obj`.
*
* ```js
* engines.extend('a', true)
* engines.extend('a')
* // => true
* ```
*
* @method extend
* @param {Object} `obj`
* @return {Object} `engines` to enable chaining.
* @api public
*/
engines.extend = function(obj) {
this.options = _.extend({}, this.options, obj);
return this;
};
/**
* Set or get an option.
*
* ```js
* engines.option('a', true)
* engines.option('a')
* // => true
* ```
*
* @method option
* @param {String} `key`
* @param {*} `value`
* @return {Object} `engines` to enable chaining.
* @api public
*/
engines.option = function(key, value) {
var args = [].slice.call(arguments);
if (args.length === 1 && typeof key === 'string') {
return engines.options[key];
}
if (typeof key === 'object') {
_.extend.apply(_, [engines.options].concat(args));
return engines;
}
engines.options[key] = value;
return engines;
};
/**
* Register the given view engine callback `fn` as `ext`.

@@ -145,3 +85,3 @@ *

* @param {Object} `options`
* @return {Object} `engine` to enable chaining
* @return {engines} to enable chaining.
* @api public

@@ -151,3 +91,3 @@ */

engines.register = function (ext, options, fn) {
debug('register', arguments);
debug('[register]', arguments);

@@ -165,3 +105,3 @@ var engine = {};

} else if (typeof fn === 'object') {
engine = fn || engines.noop;
engine = fn || this.noop;
engine.renderFile = fn.renderFile || fn.__express;

@@ -180,6 +120,6 @@ }

debug('registered %s: %j', ext, engine);
debug('[registered] %s: %j', ext, engine);
engines.cache[ext] = engine;
return engines;
this.cache[ext] = engine;
return this;
};

@@ -197,4 +137,4 @@

*
* @param {Object} `engines`
* @return {Object} `Engines` to enable chaining.
* @param {Object} `obj` Engines to load.
* @return {engines} to enable chaining.
* @api public

@@ -204,11 +144,11 @@ */

engines.load = function(obj) {
debug('load', arguments);
debug('[load]', arguments);
_.forIn(obj, function (value, key) {
if (value.hasOwnProperty('render')) {
engines.register(key, value);
this.register(key, value);
}
});
}, this);
return engines;
return this;
};

@@ -279,2 +219,56 @@

/**
* Set or get an option.
*
* ```js
* engines.option('a', true)
* engines.option('a')
* // => true
* ```
*
* @method option
* @param {String} `key`
* @param {*} `value`
* @return {engines} to enable chaining.
* @api public
*/
engines.option = function(key, value) {
var args = [].slice.call(arguments);
if (args.length === 1 && typeof key === 'string') {
return this.options[key];
}
if (typeof key === 'object') {
_.extend.apply(_, [this.options].concat(args));
return this;
}
this.options[key] = value;
return this;
};
/**
* Extend the options with the given `obj`.
*
* ```js
* engines.extend({a: 'b'})
* engines.option('a')
* // => 'b'
* ```
*
* @method extend
* @param {Object} `obj`
* @return {engines} to enable chaining.
* @api public
*/
engines.extend = function(obj) {
this.options = _.extend({}, this.options, obj);
return this;
};
module.exports = engines;
{
"name": "engine-cache",
"description": "express inspired template-engine manager.",
"version": "0.1.0",
"description": "express.js inspired template-engine manager.",
"version": "0.1.1",
"homepage": "https://github.com/jonschlinkert/engine-cache",

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

# engine-cache [![NPM version](https://badge.fury.io/js/engine-cache.png)](http://badge.fury.io/js/engine-cache)
> express inspired template-engine manager.
> express.js inspired template-engine manager.
## Install
#### Install with [npm](npmjs.org):
#### Install with [npm](npmjs.org)
```bash
npm i engine-cache --save-dev
npm i engine-cache --save
```

@@ -33,31 +33,2 @@

### .extend
Extend the options with the given `obj`.
* `obj` **{Object}**
* returns **{Object}** `engines`: to enable chaining.
```js
engines.extend('a', true)
engines.extend('a')
// => true
```
### .option
Set or get an option.
* `key` **{String}**
* `value` **{*}**
* returns **{Object}** `engines`: to enable chaining.
```js
engines.option('a', true)
engines.option('a')
// => true
```
### .register

@@ -70,3 +41,3 @@

* `options` **{Object}**
* returns **{Object}** `engine`: to enable chaining
* returns **{engines}**: to enable chaining.

@@ -83,4 +54,4 @@ ```js

* `engines` **{Object}**
* returns **{Object}** `Engines`: to enable chaining.
* `obj` **{Object}**: Engines to load.
* returns **{engines}**: to enable chaining.

@@ -118,2 +89,31 @@ ```js

### .option
Set or get an option.
* `key` **{String}**
* `value` **{*}**
* returns **{engines}**: to enable chaining.
```js
engines.option('a', true)
engines.option('a')
// => true
```
### .extend
Extend the options with the given `obj`.
* `obj` **{Object}**
* returns **{engines}**: to enable chaining.
```js
engines.extend({a: 'b'})
engines.option('a')
// => 'b'
```
## Author

@@ -132,2 +132,2 @@

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on August 09, 2014._
_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on August 10, 2014._

@@ -10,2 +10,3 @@ /*!

var assert = require('assert');
var should = require('should');

@@ -77,2 +78,7 @@ var engines = require('..');

var a = engines.get('.a');
assert.equal(typeof a, 'object');
assert.equal(typeof a.render, 'function');
engines.cache.should.have.property('.a');

@@ -79,0 +85,0 @@ engines.cache.should.have.property('.b');

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