+11
-21
@@ -12,9 +12,2 @@ /** | ||
| var utils = require('./lib/utils'); | ||
| var lazy = require('lazy-cache')(require); | ||
| lazy('set-value', 'set'); | ||
| lazy('get-value', 'get'); | ||
| lazy('kind-of', 'typeOf'); | ||
| lazy('collection-visit', 'visit'); | ||
| lazy('object.omit', 'omit'); | ||
| lazy('assign-deep', 'assign'); | ||
@@ -50,3 +43,2 @@ /** | ||
| this.imports = opts.imports || {}; | ||
| this.imports.engine = this; | ||
@@ -95,3 +87,3 @@ opts.variable = ''; | ||
| } else { | ||
| lazy.set(this.imports, prop, fn); | ||
| utils.set(this.imports, prop, fn); | ||
| } | ||
@@ -133,3 +125,3 @@ return this; | ||
| } else { | ||
| lazy.set(this.cache.data, prop, value); | ||
| utils.set(this.cache.data, prop, value); | ||
| } | ||
@@ -146,3 +138,3 @@ return this; | ||
| Engine.prototype._regex = function (opts) { | ||
| opts = lazy.assign({}, this.options, opts); | ||
| opts = utils.assign({}, this.options, opts); | ||
| if (!opts.interpolate && !opts.regex && !opts.escape && !opts.evaluate) { | ||
@@ -153,3 +145,3 @@ return utils.delimiters; | ||
| var interpolate = opts.interpolate || utils.reNoMatch; | ||
| if (lazy.typeOf(opts.regex) === 'regexp') { | ||
| if (utils.typeOf(opts.regex) === 'regexp') { | ||
| interpolate = opts.regex; | ||
@@ -201,7 +193,7 @@ } | ||
| Engine.prototype.compile = function (str, options, settings) { | ||
| var assign = lazy.assign; | ||
| var assign = utils.assign; | ||
| var engine = this; | ||
| if (!(this instanceof Engine)) { | ||
| if (lazy.typeOf(options) !== 'object') options = {}; | ||
| if (utils.typeOf(options) !== 'object') options = {}; | ||
| engine = new Engine(options); | ||
@@ -219,4 +211,4 @@ } | ||
| imports.escape = utils.escape; | ||
| assign(imports, lazy.omit(engine.imports, 'engine')); | ||
| assign(imports, lazy.omit(engine.cache.data, 'engine')); | ||
| assign(imports, utils.omit(engine.imports, 'engine')); | ||
| assign(imports, utils.omit(engine.cache.data, 'engine')); | ||
| imports.engine = engine; | ||
@@ -321,3 +313,3 @@ | ||
| var ctx = this.cache.data || {}; | ||
| var assign = lazy.assign; | ||
| var assign = utils.assign; | ||
@@ -331,5 +323,3 @@ ctx = assign({}, ctx, data); | ||
| } | ||
| var fn = this.compile(str); | ||
| return fn(ctx); | ||
| return this.compile(str)(ctx); | ||
| }; | ||
@@ -344,3 +334,3 @@ | ||
| Engine.prototype.visit = function(method, val) { | ||
| lazy.visit(this, method, val); | ||
| utils.visit(this, method, val); | ||
| return this; | ||
@@ -347,0 +337,0 @@ }; |
+10
-1
@@ -7,4 +7,13 @@ 'use strict'; | ||
| var utils = module.exports; | ||
| var lazy = module.exports = require('lazy-cache')(require); | ||
| lazy('set-value', 'set'); | ||
| lazy('get-value', 'get'); | ||
| lazy('kind-of', 'typeOf'); | ||
| lazy('collection-visit', 'visit'); | ||
| lazy('object.omit', 'omit'); | ||
| lazy('assign-deep', 'assign'); | ||
| var utils = lazy; | ||
| /* Used to match HTML entities and HTML characters. */ | ||
@@ -11,0 +20,0 @@ utils.reEscapedHtml = /&(?:amp|lt|gt|quot|#39|#96);/g; |
+3
-3
| { | ||
| "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.6", | ||
| "version": "0.1.7", | ||
| "homepage": "https://github.com/jonschlinkert/engine", | ||
@@ -25,4 +25,4 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
| "assign-deep": "^0.3.1", | ||
| "collection-visit": "^0.1.1", | ||
| "get-value": "^1.1.5", | ||
| "collection-visit": "^0.2.0", | ||
| "get-value": "^1.2.1", | ||
| "kind-of": "^2.0.1", | ||
@@ -29,0 +29,0 @@ "lazy-cache": "^0.2.3", |
+18
-18
@@ -27,3 +27,3 @@ # engine [](http://badge.fury.io/js/engine) | ||
| _(Table of contents generated by [verb](https://github.com/assemble/verb))_ | ||
| _(Table of contents generated by [verb](https://github.com/verbose/verb))_ | ||
@@ -47,3 +47,3 @@ <!-- tocstop --> | ||
| ### [Engine](index.js#L31) | ||
| ### [Engine](index.js#L28) | ||
@@ -66,3 +66,3 @@ Create an instance of `Engine` with the given options. | ||
| ### [.helper](index.js#L73) | ||
| ### [.helper](index.js#L81) | ||
@@ -73,3 +73,3 @@ Register a template helper. | ||
| * `key` **{String}** | ||
| * `prop` **{String}** | ||
| * `fn` **{Function}** | ||
@@ -89,3 +89,3 @@ * `returns` **{Object}**: Instance of `Engine` for chaining | ||
| ### [.helpers](index.js#L90) | ||
| ### [.helpers](index.js#L98) | ||
@@ -96,3 +96,3 @@ Register an object of template helpers. | ||
| * `obj` **{Object|Array}**: Object or array of helper objects. | ||
| * `helpers` **{Object|Array}**: Object or array of helper objects. | ||
| * `returns` **{Object}**: Instance of `Engine` for chaining | ||
@@ -116,3 +116,3 @@ | ||
| ### [.data](index.js#L109) | ||
| ### [.data](index.js#L117) | ||
@@ -135,3 +135,3 @@ Add data to be passed to templates as context. | ||
| ### [.compile](index.js#L169) | ||
| ### [.compile](index.js#L186) | ||
@@ -161,7 +161,7 @@ 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. | ||
| fn({user: 'jonschlinkert'}); | ||
| //=> 'Hello, jonschlinkert!' | ||
| fn({user: 'halle'}); | ||
| //=> 'Hello, halle!' | ||
| ``` | ||
| ### [.render](index.js#L283) | ||
| ### [.render](index.js#L303) | ||
@@ -185,7 +185,7 @@ Renders templates with the given data and returns a string. | ||
| * [assemble](http://assemble.io): Static site generator for Grunt.js, Yeoman and Node.js. Used by Zurb Foundation, Zurb Ink, H5BP/Effeckt,… [more](http://assemble.io) | ||
| * [scaffold](https://github.com/jonschlinkert/scaffold): Generate a project or files from scaffolds. | ||
| * [snippet](https://github.com/jonschlinkert/snippet): CLI and API for easily creating, reusing, sharing and generating snippets of code from the… [more](https://github.com/jonschlinkert/snippet) | ||
| * [template](https://github.com/jonschlinkert/template): Render templates using any engine. Supports, layouts, pages, partials and custom template types. Use template… [more](https://github.com/jonschlinkert/template) | ||
| * [verb](https://github.com/assemble/verb): Documentation generator for GitHub projects. Extremely powerful, easy to use, can generate anything from API… [more](https://github.com/assemble/verb) | ||
| * [assemble](https://www.npmjs.com/package/assemble): Static site generator for Grunt.js, Yeoman and Node.js. Used by Zurb Foundation, Zurb Ink, H5BP/Effeckt,… [more](https://www.npmjs.com/package/assemble) | [homepage](http://assemble.io) | ||
| * [scaffold](https://www.npmjs.com/package/scaffold): Conventions and API for creating scaffolds that can by used by any build system or… [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) | ||
@@ -202,3 +202,3 @@ ## Running tests | ||
| Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/engine/issues/new) | ||
| Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/engine/issues/new). | ||
@@ -219,2 +219,2 @@ ## Author | ||
| _This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on August 13, 2015._ | ||
| _This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on September 08, 2015._ |
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
20696
1.57%209
0.48%393
-0.51%+ Added
- Removed
- Removed
Updated
Updated