UNPKG

timers3000

Version:

Provides a graphical interface in your browser to create and manage incremental timers for your daily tasks.

18 lines (16 loc) 445 B
/** * * Predicate function for sorting arrays of JSON-Objects * by property * @param {String} prop The property to sort by * @param {Integer} order Defines the sorting order: 1 for ascending, -1 for descending */ exports.predicatBy = function(prop, order){ return function(a,b){ if( a[prop] > b[prop]){ return 1 * order; }else if( a[prop] < b[prop] ){ return -1 * order; } return 0; } }