New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

engine

Package Overview
Dependencies
Maintainers
2
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

engine - npm Package Compare versions

Comparing version
0.1.11
to
0.1.12
+13
-0
index.js

@@ -94,2 +94,15 @@ /**

*
* ```js
* engine.helpers({
* upper: function(str) {
* return str.toUpperCase();
* },
* lower: function(str) {
* return str.toLowerCase();
* }
* });
*
* // Or, just require in `template-helpers`
* engine.helpers(require('template-helpers')._);
* ```
* @param {Object|Array} `helpers` Object or array of helper objects.

@@ -96,0 +109,0 @@ * @return {Object} Instance of `Engine` for chaining

+1
-1

@@ -7,3 +7,3 @@ The MIT License (MIT)

Available under MIT license <https://lodash.com/license>
Copyright (c) 2015 Jon Schlinkert
Copyright (c) 2015-2016 Jon Schlinkert

@@ -10,0 +10,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy

{
"name": "engine",
"description": "Template engine based on Lo-Dash template, but adds features like the ability to register helpers and more easily set data to be used as context in templates.",
"version": "0.1.11",
"version": "0.1.12",
"homepage": "https://github.com/jonschlinkert/engine",

@@ -14,3 +14,5 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)",

"index.js",
"lib"
"lib",
"LICENSE",
"README.md"
],

@@ -37,2 +39,3 @@ "main": "index.js",

"for-in": "^0.1.4",
"gulp-format-md": "^0.1.9",
"lodash": "^3.10.1",

@@ -61,12 +64,26 @@ "mocha": "*",

"verb": {
"toc": false,
"layout": "default",
"tasks": [
"readme"
],
"plugins": [
"gulp-format-md"
],
"related": {
"list": [
"assemble",
"template",
"assemble",
"verb",
"scaffold",
"snippet"
"template-helpers",
"verb"
]
},
"reflinks": [
"verb",
"verb-generate-readme"
],
"lint": {
"reflinks": true
}
}
}
+78
-82

@@ -1,29 +0,18 @@

# engine [![NPM version](https://img.shields.io/npm/v/engine.svg)](https://www.npmjs.com/package/engine)
# engine [![NPM version](https://img.shields.io/npm/v/engine.svg?style=flat)](https://www.npmjs.com/package/engine) [![NPM downloads](https://img.shields.io/npm/dm/engine.svg?style=flat)](https://npmjs.org/package/engine) [![Build Status](https://img.shields.io/travis/jonschlinkert/engine.svg?style=flat)](https://travis-ci.org/jonschlinkert/engine)
> Template engine based on Lo-Dash template, but adds features like the ability to register helpers and more easily set data to be used as context in templates.
Template engine based on Lo-Dash template, but adds features like the ability to register helpers and more easily set data to be used as context in templates.
This code is based on [Lo-Dash's][lodash] `_.template` method, with a few additions, like the ability to register helpers and more easily control context.
## Install
## Install
Install with [npm](https://www.npmjs.com/):
```sh
$ npm i engine --save
$ npm install --save engine
```
## Table of contents
- [Usage](#usage)
- [API](#api)
- [Related projects](#related-projects)
- [Running tests](#running-tests)
- [Contributing](#contributing)
- [Author](#author)
- [License](#license)
_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_
## Usage
```js
var engine = require('engine');
var Engine = require('engine');
var engine = new Engine();

@@ -41,13 +30,11 @@ engine.helper('upper', function(str) {

### [Engine](index.js#L28)
Create an instance of `Engine` with the given options.
**Params**
* `options` **{Object}**
* `options` **{Object}**
**Example**
```js

@@ -61,17 +48,14 @@ var Engine = require('engine');

### [.helper](index.js#L82)
### [.helper](index.js#L82)
Register a template helper.
**Params**
* `prop` **{String}**
* `fn` **{Function}**
* `returns` **{Object}**: Instance of `Engine` for chaining
* `prop` **{String}**
* `fn` **{Function}**
* `returns` **{Object}**: Instance of `Engine` for chaining
**Example**
```js

@@ -86,5 +70,4 @@ engine.helper('upper', function(str) {

### [.helpers](index.js#L112)
### [.helpers](index.js#L99)
Register an object of template helpers.

@@ -94,21 +77,33 @@

* `helpers` **{Object|Array}**: Object or array of helper objects.
* `returns` **{Object}**: Instance of `Engine` for chaining
* `helpers` **{Object|Array}**: Object or array of helper objects.
* `returns` **{Object}**: Instance of `Engine` for chaining
**Example**
```js
engine.helpers({
upper: function(str) {
return str.toUpperCase();
},
lower: function(str) {
return str.toLowerCase();
}
});
### [.data](index.js#L118)
// Or, just require in `template-helpers`
engine.helpers(require('template-helpers')._);
```
### [.data](index.js#L131)
Add data to be passed to templates as context.
**Params**
* `key` **{String|Object}**: Property key, or an object
* `value` **{any}**: If key is a string, this can be any typeof value
* `returns` **{Object}**: Engine instance, for chaining
* `key` **{String|Object}**: Property key, or an object
* `value` **{any}**: If key is a string, this can be any typeof value
* `returns` **{Object}**: Engine instance, for chaining
**Example**
```js

@@ -120,23 +115,20 @@ engine.data({first: 'Brian'});

### [.compile](index.js#L200)
### [.compile](index.js#L187)
Creates a compiled template function that can interpolate data properties in "interpolate" delimiters, HTML-escape interpolated data properties in "escape" delimiters, and execute JavaScript in "evaluate" delimiters. Data properties may be accessed as free variables in the template. If a setting object is provided it takes precedence over `engine.settings` values.
**Params**
* `str` **{string}**: The template string.
* `opts` **{Object}**: The options object.
* `escape` **{RegExp}**: The HTML "escape" delimiter.
* `evaluate` **{RegExp}**: The "evaluate" delimiter.
* `imports` **{Object}**: An object to import into the template as free variables.
* `interpolate` **{RegExp}**: The "interpolate" delimiter.
* `sourceURL` **{string}**: The sourceURL of the template's compiled source.
* `variable` **{string}**: The data object variable name.
* `returns` **{Function}**: Returns the compiled template function.
* `str` **{string}**: The template string.
* `opts` **{Object}**: The options object.
* `escape` **{RegExp}**: The HTML "escape" delimiter.
* `evaluate` **{RegExp}**: The "evaluate" delimiter.
* `imports` **{Object}**: An object to import into the template as free variables.
* `interpolate` **{RegExp}**: The "interpolate" delimiter.
* `sourceURL` **{string}**: The sourceURL of the template's compiled source.
* `variable` **{string}**: The data object variable name.
* `returns` **{Function}**: Returns the compiled template function.
**Example**
```js

@@ -153,17 +145,14 @@ var fn = engine.compile('Hello, <%= user %>!');

### [.render](index.js#L317)
### [.render](index.js#L304)
Renders templates with the given data and returns a string.
**Params**
* `str` **{String}**
* `data` **{Object}**
* `returns` **{String}**
* `str` **{String}**
* `data` **{Object}**
* `returns` **{String}**
**Example**
```js

@@ -174,40 +163,47 @@ engine.render('<%= user %>', {user: 'doowb'});

## About
### Related projects
## Related projects
* [assemble](https://www.npmjs.com/package/assemble): Assemble is a powerful, extendable and easy to use static site generator for node.js. Used… [more](https://www.npmjs.com/package/assemble) | [homepage](https://github.com/assemble/assemble)
* [scaffold](https://www.npmjs.com/package/scaffold): Conventions and API for creating declarative configuration objects for project scaffolds - similar in format… [more](https://www.npmjs.com/package/scaffold) | [homepage](https://github.com/jonschlinkert/scaffold)
* [snippet](https://www.npmjs.com/package/snippet): CLI and API for easily creating, reusing, sharing and generating snippets of code from the… [more](https://www.npmjs.com/package/snippet) | [homepage](https://github.com/jonschlinkert/snippet)
* [template](https://www.npmjs.com/package/template): Render templates using any engine. Supports, layouts, pages, partials and custom template types. Use template… [more](https://www.npmjs.com/package/template) | [homepage](https://github.com/jonschlinkert/template)
* [verb](https://www.npmjs.com/package/verb): Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… [more](https://www.npmjs.com/package/verb) | [homepage](https://github.com/verbose/verb)
* [assemble](https://www.npmjs.com/package/assemble): Get the rocks out of your socks! Assemble makes you fast at creating web projects… [more](https://github.com/assemble/assemble) | [homepage](https://github.com/assemble/assemble "Get the rocks out of your socks! Assemble makes you fast at creating web projects. Assemble is used by thousands of projects for rapid prototyping, creating themes, scaffolds, boilerplates, e-books, UI components, API documentation, blogs, building websit")
* [template-helpers](https://www.npmjs.com/package/template-helpers): Generic JavaScript helpers that can be used with any template engine. Handlebars, Lo-Dash, Underscore, or… [more](https://github.com/jonschlinkert/template-helpers) | [homepage](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.")
* [template](https://www.npmjs.com/package/template): Render templates using any engine. Supports, layouts, pages, partials and custom template types. Use template… [more](https://github.com/jonschlinkert/template) | [homepage](https://github.com/jonschlinkert/template "Render templates using any engine. Supports, layouts, pages, partials and custom template types. Use template helpers, middleware, routes, loaders, and lots more. Powers assemble, verb and other node.js apps.")
* [verb](https://www.npmjs.com/package/verb): Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… [more](https://github.com/verbose/verb) | [homepage](https://github.com/verbose/verb "Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used on hundreds of projects of all sizes to generate everything from API docs to readmes.")
## Running tests
Install dev dependencies:
### Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
### Building docs
_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_
To generate the readme and API documentation with [verb](https://github.com/verbose/verb):
```sh
$ npm i -d && npm test
$ npm install -g verb verb-generate-readme && verb
```
## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/engine/issues/new).
### Running tests
## Author
**Jon Schlinkert**
Install dev dependencies:
+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
```sh
$ npm install -d && npm test
```
## License
Copyright © 2016 [Jon Schlinkert](https://github.com/jonschlinkert)
Released under the MIT license.
### Author
***
**Jon Schlinkert**
_This file was generated by [verb](https://github.com/verbose/verb) on January 21, 2016._
* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
### License
Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT license](https://github.com/jonschlinkert/engine/blob/master/LICENSE).
***
[lodash]: https://lodash.com/
[verb]: https://github.com/verbose/verb
_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on July 19, 2016._