New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

templates

Package Overview
Dependencies
Maintainers
2
Versions
154
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

templates - npm Package Compare versions

Comparing version 0.1.9 to 0.1.10

1

index.js

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

/**

@@ -1076,0 +1075,0 @@ * Expose `Templates`

54

lib/list.js
'use strict';
var define = require('define-property');
var sortBy = require('array-sort');
var Base = require('base-methods');

@@ -87,3 +86,28 @@ var utils = require('./utils');

/**
* Sort all registered `items` using the given property,
* Group all list `items` using the given property,
* properties or compare functions. See [group-array][]
* for the full range of available features and options.
*
* ```js
* var list = new List();
* list.addItems(...);
* var groups = list.groupBy('data.date', 'data.slug');
* ```
* @return {Object} Returns the grouped items.
* @api public
*/
List.prototype.groupBy = function() {
var args = [].slice.call(arguments);
var fn = utils.groupBy;
// Make `items` the first argument for group-array
args.unshift(this.items.slice());
// group the `items` and return the result
return fn.apply(fn, args);
};
/**
* Sort all list `items` using the given property,
* properties or compare functions. See [array-sort][]

@@ -95,5 +119,7 @@ * for the full range of available features and options.

* list.addItems(...);
* list.sortBy('data.date');
* var result = list.sortBy('data.date');
* //=> new sorted list
* ```
* @return {Object} Returns the `List` instance
* @return {Object} Returns a new `List` instance with sorted items.
* @api public
*/

@@ -112,19 +138,13 @@

// create the args to pass to array-sort
args.unshift(this.items);
args.unshift(this.items.slice());
args.push(opts);
// sort the `items` array
this.items = sortBy.apply(sortBy, args);
var len = this.items.length, i = -1;
// re-sort `keys` based on sorted items
this.keys = new Array(len);
while (++i < len) {
this.keys[i] = this.items[i].key;
}
return this;
// sort the `items` array, then sort `keys`
var items = utils.sortBy.apply(utils.sortBy, args);
var list = new List(this.options);
list.addItems(items);
return list;
};
define(List.prototype, 'count', {
utils.define(List.prototype, 'count', {
get: function() {

@@ -131,0 +151,0 @@ return this.items.length;

@@ -14,2 +14,4 @@ 'use strict';

lazy('is-buffer');
lazy('array-sort', 'sortBy');
lazy('group-array', 'groupBy');
lazy('define-property', 'define');

@@ -16,0 +18,0 @@ lazy('mixin-deep', 'merge');

{
"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.1.9",
"version": "0.1.10",
"homepage": "https://github.com/jonschlinkert/templates",

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

"globby": "^3.0.1",
"group-array": "^0.3.0",
"has-glob": "^0.1.0",

@@ -63,2 +64,3 @@ "helper-cache": "^0.7.2",

"should": "*",
"stringify-object": "jonschlinkert/stringify-object",
"swig": "^1.4.2",

@@ -65,0 +67,0 @@ "template-helpers": "^0.3.4"

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