templates
Advanced tools
Comparing version 0.3.2 to 0.3.3
32
index.js
@@ -215,14 +215,32 @@ /*! | ||
// create loader functions for adding views to this collection | ||
this.define(plural, collection.addViews.bind(collection)); | ||
this.define(single, collection.addView.bind(collection)); | ||
utils.forward({ | ||
fromObj: collection, | ||
toObj: this, | ||
fromMethod: 'addViews', | ||
toMethod: plural | ||
}); | ||
// decorate loader methods with collection methods | ||
this[plural].__proto__ = collection; | ||
this[single].__proto__ = collection; | ||
utils.forward({ | ||
fromObj: collection, | ||
toObj: this, | ||
fromMethod: 'addView', | ||
toMethod: single | ||
}); | ||
// create aliases on the collection for | ||
// addView/addViews to support chaining | ||
collection.define(plural, this[plural]); | ||
collection.define(single, this[single]); | ||
utils.forward({ | ||
fromObj: collection, | ||
toObj: collection, | ||
fromMethod: 'addViews', | ||
toMethod: plural | ||
}); | ||
utils.forward({ | ||
fromObj: collection, | ||
toObj: collection, | ||
fromMethod: 'addView', | ||
toMethod: single | ||
}); | ||
// run collection plugins | ||
@@ -229,0 +247,0 @@ this.plugins.forEach(function (fn) { |
@@ -91,1 +91,14 @@ 'use strict'; | ||
}; | ||
utils.forward = function (opts) { | ||
var from = opts.fromObj; | ||
var to = opts.toObj; | ||
to.define(opts.toMethod, { | ||
configurable: true, | ||
get: function () { | ||
var fn = from[opts.fromMethod].bind(from); | ||
fn.__proto__ = from; | ||
return fn; | ||
} | ||
}); | ||
} |
{ | ||
"name": "templates", | ||
"description": "System for creating and managing template collections, and rendering templates with any node.js template engine. Can be used as the basis for creating a static site generator or blog framework.", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"homepage": "https://github.com/jonschlinkert/templates", | ||
@@ -6,0 +6,0 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
108214
2836