templates
Advanced tools
Comparing version 0.15.5 to 0.15.6
@@ -52,3 +52,3 @@ /*! | ||
Base.call(this, null, options); | ||
this.is('templates'); | ||
this.is(Templates); | ||
this.define('isApp', true); | ||
@@ -68,2 +68,3 @@ debug(this); | ||
Base.extend(Templates); | ||
Base.bubble(Templates, ['preInit', 'Init']); | ||
@@ -92,2 +93,4 @@ /** | ||
Templates.prototype.initTemplates = function() { | ||
Templates.emit('preInit', this); | ||
if (!this.plugins) { | ||
@@ -100,3 +103,2 @@ this.plugins = {}; | ||
this.inflections = {}; | ||
this.utils = utils; | ||
@@ -106,2 +108,3 @@ // listen for options events | ||
this.define('utils', utils); | ||
this.use(plugin.init); | ||
@@ -130,2 +133,3 @@ this.use(plugin.renameKey()); | ||
Templates.setup(this, 'Templates'); | ||
Templates.emit('init', this); | ||
}; | ||
@@ -132,0 +136,0 @@ |
@@ -27,2 +27,3 @@ 'use strict'; | ||
* ``` | ||
* @name .isApp | ||
* @param {Object} `val` The value to test. | ||
@@ -49,2 +50,3 @@ * @return {Boolean} | ||
* ``` | ||
* @name .isCollection | ||
* @param {Object} `val` The value to test. | ||
@@ -71,2 +73,3 @@ * @return {Boolean} | ||
* ``` | ||
* @name .isViews | ||
* @param {Object} `val` The value to test. | ||
@@ -94,2 +97,3 @@ * @return {Boolean} | ||
* ``` | ||
* @name .isList | ||
* @param {Object} `val` The value to test. | ||
@@ -117,2 +121,3 @@ * @return {Boolean} | ||
* ``` | ||
* @name .isGroup | ||
* @param {Object} `val` The value to test. | ||
@@ -142,2 +147,3 @@ * @return {Boolean} | ||
* ``` | ||
* @name .isView | ||
* @param {Object} `val` The value to test. | ||
@@ -167,2 +173,3 @@ * @return {Boolean} | ||
* ``` | ||
* @name .isItem | ||
* @param {Object} `val` The value to test. | ||
@@ -194,2 +201,3 @@ * @return {Boolean} | ||
* ``` | ||
* @name .isVinyl | ||
* @param {Object} `val` The value to test. | ||
@@ -196,0 +204,0 @@ * @return {Boolean} |
@@ -73,2 +73,10 @@ 'use strict'; | ||
/** | ||
* Asynchronously apply a layout to the given `view`. | ||
* | ||
* @name .applyLayoutAsync | ||
* @param {Object} `view` | ||
* @param {Function} `callback` | ||
*/ | ||
proto.applyLayoutAsync = function(view, cb) { | ||
@@ -75,0 +83,0 @@ this.debug.layout('applying layout to view "%s"', view.path); |
@@ -8,2 +8,3 @@ 'use strict'; | ||
var utils = require('./utils'); | ||
var List = require('./list'); | ||
@@ -290,2 +291,21 @@ /** | ||
/** | ||
* Group all collection `views` by the given property, | ||
* properties or compare functions. See [group-array][] | ||
* for the full range of available features and options. | ||
* | ||
* ```js | ||
* var collection = new Collection(); | ||
* collection.addViews(...); | ||
* var groups = collection.groupBy('data.date', 'data.slug'); | ||
* ``` | ||
* @return {Object} Returns an object of grouped views. | ||
* @api public | ||
*/ | ||
Views.prototype.groupBy = function() { | ||
var list = new List(this); | ||
return list.groupBy.apply(list, arguments); | ||
}; | ||
/** | ||
* Get view `name` from `collection.views`. | ||
@@ -292,0 +312,0 @@ * |
{ | ||
"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.15.5", | ||
"version": "0.15.6", | ||
"homepage": "https://github.com/jonschlinkert/templates", | ||
@@ -26,3 +26,3 @@ "author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"async": "^1.5.2", | ||
"base": "^0.7.9", | ||
"base": "^0.7.10", | ||
"base-data": "^0.4.0", | ||
@@ -29,0 +29,0 @@ "base-option": "^0.7.0", |
@@ -40,4 +40,2 @@ # templates [![NPM version](https://img.shields.io/npm/v/templates.svg)](https://www.npmjs.com/package/templates) [![Build Status](https://img.shields.io/travis/jonschlinkert/templates.svg)](https://travis-ci.org/jonschlinkert/templates) | ||
_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_ | ||
## Install | ||
@@ -168,3 +166,3 @@ | ||
### [.list](index.js#L183) | ||
### [.list](index.js#L187) | ||
@@ -189,3 +187,3 @@ Create a new list. See the [list docs](docs/lists.md) for more information about lists. | ||
### [.collection](index.js#L222) | ||
### [.collection](index.js#L226) | ||
@@ -202,3 +200,3 @@ Create a new collection. Collections are decorated with special methods for getting and setting items from the collection. Note that, unlike the [create](#create) method, collections created with `.collection()` are not cached. | ||
### [.create](index.js#L274) | ||
### [.create](index.js#L278) | ||
@@ -214,3 +212,3 @@ Create a new view collection to be stored on the `app.views` object. See | ||
### [.setup](index.js#L398) | ||
### [.setup](index.js#L402) | ||
@@ -672,3 +670,3 @@ Expose static `setup` method for providing access to an instance before any other use code is run. | ||
### [Views](lib/views.js#L26) | ||
### [Views](lib/views.js#L27) | ||
@@ -688,3 +686,3 @@ Create an instance of `Views` with the given `options`. | ||
### [.setView](lib/views.js#L137) | ||
### [.setView](lib/views.js#L138) | ||
@@ -705,3 +703,3 @@ Set a view on the collection. This is identical to [addView](#addView) except `setView` does not emit an event for each view. | ||
### [.addView](lib/views.js#L184) | ||
### [.addView](lib/views.js#L185) | ||
@@ -723,3 +721,3 @@ Similar to [setView](#setView), adds a view to the collection but also fires an event and iterates over the loading `queue` for loading views from the `addView` event listener. If the given view is not already an instance of `View`, it will be converted to one before being added to the `views` object. | ||
### [.deleteView](lib/views.js#L207) | ||
### [.deleteView](lib/views.js#L208) | ||
@@ -739,3 +737,3 @@ Delete a view from collection `views`. | ||
### [.addViews](lib/views.js#L231) | ||
### [.addViews](lib/views.js#L232) | ||
@@ -759,3 +757,3 @@ Load multiple views onto the collection. | ||
### [.addList](lib/views.js#L265) | ||
### [.addList](lib/views.js#L266) | ||
@@ -779,4 +777,18 @@ Load an array of views onto the collection. | ||
### [.getView](lib/views.js#L300) | ||
### [.groupBy](lib/views.js#L303) | ||
Group all collection `views` by the given property, properties or compare functions. See [group-array](https://github.com/doowb/group-array) for the full range of available features and options. | ||
* `returns` **{Object}**: Returns an object of grouped views. | ||
**Example** | ||
```js | ||
var collection = new Collection(); | ||
collection.addViews(...); | ||
var groups = collection.groupBy('data.date', 'data.slug'); | ||
``` | ||
### [.getView](lib/views.js#L320) | ||
Get view `name` from `collection.views`. | ||
@@ -796,3 +808,3 @@ | ||
### [.extendView](lib/views.js#L335) | ||
### [.extendView](lib/views.js#L355) | ||
@@ -812,3 +824,3 @@ Load a view from the file system. | ||
### [.isType](lib/views.js#L350) | ||
### [.isType](lib/views.js#L370) | ||
@@ -827,3 +839,3 @@ Return true if the collection belongs to the given view `type`. | ||
### [.viewTypes](lib/views.js#L397) | ||
### [.viewTypes](lib/views.js#L417) | ||
@@ -1724,4 +1736,6 @@ Alias for `viewType` | ||
### is | ||
### [.isApp](lib/plugins/is.js#L33) | ||
Static method that returns true if the given value is a `templates` instance (`App`). | ||
**Params** | ||
@@ -1745,2 +1759,6 @@ | ||
### [.isCollection](lib/plugins/is.js#L55) | ||
Static method that returns true if the given value is a templates `Collection` instance. | ||
**Params** | ||
@@ -1762,2 +1780,6 @@ | ||
### [.isViews](lib/plugins/is.js#L77) | ||
Static method that returns true if the given value is a templates `Views` instance. | ||
**Params** | ||
@@ -1779,2 +1801,6 @@ | ||
### [.isList](lib/plugins/is.js#L100) | ||
Static method that returns true if the given value is a templates `List` instance. | ||
**Params** | ||
@@ -1797,2 +1823,6 @@ | ||
### [.isGroup](lib/plugins/is.js#L123) | ||
Static method that returns true if the given value is a templates `Group` instance. | ||
**Params** | ||
@@ -1815,2 +1845,6 @@ | ||
### [.isView](lib/plugins/is.js#L148) | ||
Static method that returns true if the given value is a templates `View` instance. | ||
**Params** | ||
@@ -1835,2 +1869,6 @@ | ||
### [.isItem](lib/plugins/is.js#L173) | ||
Static method that returns true if the given value is a templates `Item` instance. | ||
**Params** | ||
@@ -1855,2 +1893,6 @@ | ||
### [.isVinyl](lib/plugins/is.js#L200) | ||
Static method that returns true if the given value is a vinyl `File` instance. | ||
**Params** | ||
@@ -1857,0 +1899,0 @@ |
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
171640
4125
2014
Updatedbase@^0.7.10