lodash-contrib
Advanced tools
Comparing version 241.4.14 to 393.0.1
@@ -74,2 +74,26 @@ // lodash-contrib (lodash.function.arity.js 0.0.1) | ||
// Right curry variants | ||
// --------------------- | ||
var curryRight = function (func) { | ||
return curry.call(this, func, true); | ||
}; | ||
var curryRight2 = function (fun) { | ||
return enforcesUnary(function (last) { | ||
return enforcesUnary(function (first) { | ||
return fun.call(this, first, last); | ||
}); | ||
}); | ||
}; | ||
var curryRight3 = function (fun) { | ||
return enforcesUnary(function (last) { | ||
return enforcesUnary(function (second) { | ||
return enforcesUnary(function (first) { | ||
return fun.call(this, first, second, last); | ||
}); | ||
}); | ||
}); | ||
}; | ||
// Mixing in the arity functions | ||
@@ -134,5 +158,4 @@ // ----------------------------- | ||
// Flexible right to left curry with strict arity. | ||
rCurry: function (func) { | ||
return curry.call(this, func, true); | ||
}, | ||
curryRight: curryRight, | ||
rCurry: curryRight, // alias for backwards compatibility | ||
@@ -158,20 +181,9 @@ | ||
// reverse currying for functions taking two arguments. | ||
rcurry2: function (fun) { | ||
return enforcesUnary(function (last) { | ||
return enforcesUnary(function (first) { | ||
return fun.call(this, first, last); | ||
}); | ||
}); | ||
}, | ||
// reverse currying for functions taking two arguments. | ||
curryRight2: curryRight2, | ||
rcurry2: curryRight2, // alias for backwards compatibility | ||
rcurry3: function (fun) { | ||
return enforcesUnary(function (last) { | ||
return enforcesUnary(function (second) { | ||
return enforcesUnary(function (first) { | ||
return fun.call(this, first, second, last); | ||
}); | ||
}); | ||
}); | ||
}, | ||
curryRight3: curryRight3, | ||
rcurry3: curryRight3, // alias for backwards compatibility | ||
// Dynamic decorator to enforce function arity and defeat varargs. | ||
@@ -178,0 +190,0 @@ enforce: enforce |
@@ -61,3 +61,4 @@ // lodash-contrib (lodash.function.combinators.js 0.0.1) | ||
}, | ||
composeRight: _.pipeline, | ||
// Composes a bunch of predicates into a single predicate that | ||
@@ -64,0 +65,0 @@ // checks all elements of an array for conformance to all of the |
{ | ||
"name": "underscore-contrib", | ||
"version": "0.3.0", | ||
"main": "dist/underscore-contrib.min.js", | ||
"homepage": "https://github.com/documentcloud/underscore-contrib", | ||
"authors": [ | ||
"fogus <me@fogus.me>" | ||
], | ||
"description": "The brass buckles on Underscore's utility belt", | ||
"keywords": [ | ||
"underscore", | ||
"underscorejs", | ||
"documentcloud", | ||
"functional", | ||
"javascript" | ||
], | ||
"license": "MIT", | ||
"ignore": [ | ||
"**/.*", | ||
"node_modules", | ||
"bower_components", | ||
"test", | ||
"tests" | ||
], | ||
"dependencies" : { | ||
"underscore" : ">=1.6.0" | ||
} | ||
"name": "lodash-contrib", | ||
"description": "The brass buckles on lodash's utility belt", | ||
"repo": "TheNodeILs/lodash-contrib", | ||
"version": "393.0.0", | ||
"dependencies": { | ||
"lodash/lodash": "3.9.3" | ||
}, | ||
"main": "dist/lodash-contrib.js", | ||
"scripts": [ | ||
"dist/lodash-contrib.js" | ||
], | ||
"license": "MIT" | ||
} |
@@ -94,3 +94,3 @@ module.exports = function(_) { | ||
return _.filter(_.flatten(_.zip.apply(null, arguments), true), function(elem) { | ||
return _.filter(_.flatten(_.zip.apply(null, arguments), false), function(elem) { | ||
return elem != null; | ||
@@ -97,0 +97,0 @@ }); |
@@ -10,2 +10,11 @@ module.exports = function(_) { | ||
function nths(array, indices) { | ||
if (array == null) return void 0; | ||
if (isSeq(indices)) | ||
return _(indices).map(function(i){return array[i];}).valueOf(); | ||
else | ||
return nths(array, slice.call(arguments, 1)); | ||
} | ||
// Mixing in the array selectors | ||
@@ -36,2 +45,18 @@ // ---------------------------- | ||
// A function to get values via indices into an array | ||
nths: nths, | ||
valuesAt: nths, | ||
// A function to get at "truthily" indexed values | ||
// bin refers to "binary" nature of true/false values in binIndices | ||
// but can also be thought of as putting array values into either "take" or "don't" bins | ||
binPick: function binPick(array, binIndices) { | ||
if (array == null) return void 0; | ||
if (isSeq(binIndices)) | ||
return _.nths(array, _.range(binIndices.length).filter(function(i){return binIndices[i];})); | ||
else | ||
return binPick(array, slice.call(arguments, 1)); | ||
}, | ||
// Takes all items in an array while a given predicate returns truthy. | ||
@@ -38,0 +63,0 @@ takeWhile: function(array, pred) { |
## How to contribute to lodash-contrib | ||
* Before you open a ticket or send a pull request, [search](https://github.com/empeeric/lodash-contrib/issues) for previous discussions about the same feature or issue. Add to the earlier ticket if you find one. | ||
* Before you open a ticket or send a pull request, please [search](https://github.com/empeeric/lodash-contrib/issues) for previous discussions about the same feature or issue. Add to the earlier ticket if you find one. | ||
* Before sending a pull request for a feature, be sure to have [tests like found in lodash](http://lodashjs.org/test/). Tests may be run in a browser by opening `test/index.html`. Tests and linting can be run in the terminal by using the `grunt test` command, or `grunt watch:test` to automatically rerun after file save. | ||
* Use the same coding [style as lodash](https://github.com/documentcloud/lodash/blob/master/lodash.js). | ||
* Use the same coding [style as lodash](https://github.com/documentcloud/lodash/blob/master/lodash.js). | ||
* In your pull request, do not add documentation, edit the files in `dist/` or use grunt to re-build the files in `dist/`. We'll do those things before cutting a new release. |
@@ -1,2 +0,2 @@ | ||
// lodash-contrib v241.4.13 | ||
// lodash-contrib v393.0.1 | ||
// ========================= | ||
@@ -279,2 +279,26 @@ | ||
// Right curry variants | ||
// --------------------- | ||
var curryRight = function (func) { | ||
return curry.call(this, func, true); | ||
}; | ||
var curryRight2 = function (fun) { | ||
return enforcesUnary(function (last) { | ||
return enforcesUnary(function (first) { | ||
return fun.call(this, first, last); | ||
}); | ||
}); | ||
}; | ||
var curryRight3 = function (fun) { | ||
return enforcesUnary(function (last) { | ||
return enforcesUnary(function (second) { | ||
return enforcesUnary(function (first) { | ||
return fun.call(this, first, second, last); | ||
}); | ||
}); | ||
}); | ||
}; | ||
// Mixing in the arity functions | ||
@@ -339,5 +363,4 @@ // ----------------------------- | ||
// Flexible right to left curry with strict arity. | ||
rCurry: function (func) { | ||
return curry.call(this, func, true); | ||
}, | ||
curryRight: curryRight, | ||
rCurry: curryRight, // alias for backwards compatibility | ||
@@ -363,20 +386,9 @@ | ||
// reverse currying for functions taking two arguments. | ||
rcurry2: function (fun) { | ||
return enforcesUnary(function (last) { | ||
return enforcesUnary(function (first) { | ||
return fun.call(this, first, last); | ||
}); | ||
}); | ||
}, | ||
// reverse currying for functions taking two arguments. | ||
curryRight2: curryRight2, | ||
rcurry2: curryRight2, // alias for backwards compatibility | ||
rcurry3: function (fun) { | ||
return enforcesUnary(function (last) { | ||
return enforcesUnary(function (second) { | ||
return enforcesUnary(function (first) { | ||
return fun.call(this, first, second, last); | ||
}); | ||
}); | ||
}); | ||
}, | ||
curryRight3: curryRight3, | ||
rcurry3: curryRight3, // alias for backwards compatibility | ||
// Dynamic decorator to enforce function arity and defeat varargs. | ||
@@ -470,3 +482,4 @@ enforce: enforce | ||
}, | ||
composeRight: _.pipeline, | ||
// Composes a bunch of predicates into a single predicate that | ||
@@ -1762,3 +1775,3 @@ // checks all elements of an array for conformance to all of the | ||
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
module.exports = function(_) { | ||
@@ -1857,3 +1870,3 @@ // Create quick reference variables for speed access to core prototypes. | ||
return _.filter(_.flatten(_.zip.apply(null, arguments), true), function(elem) { | ||
return _.filter(_.flatten(_.zip.apply(null, arguments), false), function(elem) { | ||
return elem != null; | ||
@@ -1990,2 +2003,11 @@ }); | ||
function nths(array, indices) { | ||
if (array == null) return void 0; | ||
if (isSeq(indices)) | ||
return _(indices).map(function(i){return array[i];}).valueOf(); | ||
else | ||
return nths(array, slice.call(arguments, 1)); | ||
} | ||
// Mixing in the array selectors | ||
@@ -2016,2 +2038,18 @@ // ---------------------------- | ||
// A function to get values via indices into an array | ||
nths: nths, | ||
valuesAt: nths, | ||
// A function to get at "truthily" indexed values | ||
// bin refers to "binary" nature of true/false values in binIndices | ||
// but can also be thought of as putting array values into either "take" or "don't" bins | ||
binPick: function binPick(array, binIndices) { | ||
if (array == null) return void 0; | ||
if (isSeq(binIndices)) | ||
return _.nths(array, _.range(binIndices.length).filter(function(i){return binIndices[i];})); | ||
else | ||
return binPick(array, slice.call(arguments, 1)); | ||
}, | ||
// Takes all items in an array while a given predicate returns truthy. | ||
@@ -2118,2 +2156,2 @@ takeWhile: function(array, pred) { | ||
},{"../common-js/_.array.builders.js":1,"../common-js/_.array.selectors.js":2,"../common-js/_.util.existential.js":3}]},{},[4]) | ||
},{"../common-js/_.array.builders.js":1,"../common-js/_.array.selectors.js":2,"../common-js/_.util.existential.js":3}]},{},[4]); |
@@ -1,2 +0,2 @@ | ||
// lodash-contrib v241.4.13 | ||
// lodash-contrib v393.0.1 | ||
// ========================= | ||
@@ -9,2 +9,2 @@ | ||
!function(a){function b(a){return e.isElement(a)?a.children:a}function c(a,b,c,d,i,j){var k=[];return function l(a,m,n){if(e.isObject(a)){if(k.indexOf(a)>=0)throw new TypeError(h);k.push(a)}if(c){var o=c.call(i,a,m,n);if(o===g)return g;if(o===f)return}var p,q=b(a);if(e.isObject(q)&&!e.isEmpty(q)){j&&(p=e.isArray(a)?[]:{});var r=e.any(q,function(b,c){var d=l(b,c,a);return d===g?!0:void(p&&(p[c]=d))});if(r)return g}return d?d.call(i,a,m,n,p):void 0}(a)}function d(a,b,c){var d=[];return this.preorder(a,function(a,g){return c||g!=b?void(e.has(a,b)&&(d[d.length]=a[b])):f}),d}var e=a._||require("lodash"),f={},g={},h="Not a tree: same object found in two different branches",i={find:function(a,b,c){var d;return this.preorder(a,function(a,e,f){return b.call(c,a,e,f)?(d=a,g):void 0},c),d},filter:function(a,b,c,d){var e=[];return null==a?e:(b(a,function(a,b,f){c.call(d,a,b,f)&&e.push(a)},null,this._traversalStrategy),e)},reject:function(a,b,c,d){return this.filter(a,b,function(a,b,e){return!c.call(d,a,b,e)})},map:function(a,b,c,d){var e=[];return b(a,function(a,b,f){e[e.length]=c.call(d,a,b,f)},null,this._traversalStrategy),e},pluck:function(a,b){return d.call(this,a,b,!1)},pluckRec:function(a,b){return d.call(this,a,b,!0)},postorder:function(a,b,d,e){e=e||this._traversalStrategy,c(a,e,null,b,d)},preorder:function(a,b,d,e){e=e||this._traversalStrategy,c(a,e,b,null,d)},reduce:function(a,b,d,e){var f=function(a,c,e,f){return b(f||d,a,c,e)};return c(a,this._traversalStrategy,null,f,e,!0)}};i.collect=i.map,i.detect=i.find,i.select=i.filter,e.walk=function(a){var c=e.clone(i);return e.bindAll.apply(null,[c].concat(e.keys(c))),c._traversalStrategy=a||b,c},e.extend(e.walk,e.walk())}(this),function(a){function b(a){return function(){if(1===arguments.length)return a.apply(this,arguments);throw new RangeError("Only a single argument may be accepted.")}}var c=a._||require("lodash"),d=function(){function a(c,d,e,f,g,h){return h===!0?f.unshift(g):f.push(g),f.length==e?c.apply(d,f):b(function(){return a(c,d,e,f.slice(0),arguments[0],h)})}return function(c,d){var e=this;return b(function(){return a(c,e,c.length,[],arguments[0],d)})}}(),e=function(){var a=[];return function(b){if("function"!=typeof b)throw new Error("Argument 1 must be a function.");var c=b.length;return void 0===a[c]&&(a[c]=function(a){return function(){if(arguments.length!==c)throw new RangeError(c+" arguments must be applied.");return a.apply(this,arguments)}}),a[c](b)}}();c.mixin({fix:function(a){var b=c.rest(arguments),d=function(){for(var d=b.slice(),e=0,f=0;f<(d.length||e<arguments.length);f++)d[f]===c&&(d[f]=arguments[e++]);return a.apply(null,d)};return d._original=a,d},unary:function(a){return function(b){return a.call(this,b)}},binary:function(a){return function(b,c){return a.call(this,b,c)}},ternary:function(a){return function(b,c,d){return a.call(this,b,c,d)}},quaternary:function(a){return function(b,c,d,e){return a.call(this,b,c,d,e)}},curry:d,rCurry:function(a){return d.call(this,a,!0)},curry2:function(a){return b(function(c){return b(function(b){return a.call(this,c,b)})})},curry3:function(a){return b(function(c){return b(function(d){return b(function(b){return a.call(this,c,d,b)})})})},rcurry2:function(a){return b(function(c){return b(function(b){return a.call(this,b,c)})})},rcurry3:function(a){return b(function(c){return b(function(d){return b(function(b){return a.call(this,b,d,c)})})})},enforce:e}),c.arity=function(){var a={};return function b(c,d){if(null==a[c]){for(var e=new Array(c),f=0;c>f;++f)e[f]="__"+f;var g=e.join(),h="return function ("+g+") { return fun.apply(this, arguments); };";a[c]=new Function(["fun"],h)}return null==d?function(a){return b(c,a)}:a[c](d)}}()}(this),function(a){function b(a,b){return c.arity(a.length,function(){return a.apply(this,h.call(arguments,b))})}var c=a._||require("lodash"),d=function(a){return null!=a},e=function(a){return a!==!1&&d(a)},f=[].reverse,g=[].slice,h=[].map,i=function(a){return function(b,c){return 1===arguments.length?function(c){return a(b,c)}:a(b,c)}};c.mixin({always:c.constant,pipeline:function(){var a=c.isArray(arguments[0])?arguments[0]:arguments;return function(b){return c.reduce(a,function(a,b){return b(a)},b)}},conjoin:function(){var a=arguments;return function(b){return c.every(b,function(b){return c.every(a,function(a){return a(b)})})}},disjoin:function(){var a=arguments;return function(b){return c.some(b,function(b){return c.some(a,function(a){return a(b)})})}},comparator:function(a){return function(b,c){return e(a(b,c))?-1:e(a(c,b))?1:0}},complement:function(a){return function(){return!a.apply(this,arguments)}},splat:function(a){return function(b){return a.apply(this,b)}},unsplat:function(a){var b=a.length;return 1>b?a:1===b?function(){return a.call(this,g.call(arguments,0))}:function(){var c=arguments.length,d=g.call(arguments,0,b-1),e=Math.max(b-c-1,0),f=new Array(e),h=g.call(arguments,a.length-1);return a.apply(this,d.concat(f).concat([h]))}},unsplatl:function(a){var b=a.length;return 1>b?a:1===b?function(){return a.call(this,g.call(arguments,0))}:function(){var c=arguments.length,d=g.call(arguments,Math.max(c-b+1,0)),e=g.call(arguments,0,Math.max(c-b+1,0));return a.apply(this,[e].concat(d))}},mapArgs:i(b),juxt:function(){var a=arguments;return function(){var b=arguments;return c.map(a,function(a){return a.apply(this,b)},this)}},fnull:function(a){var b=c.rest(arguments);return function(){for(var e=c.toArray(arguments),f=c.size(b),g=0;f>g;g++)d(e[g])||(e[g]=b[g]);return a.apply(this,e)}},flip2:function(a){return function(){var b=g.call(arguments);return b[0]=arguments[1],b[1]=arguments[0],a.apply(this,b)}},flip:function(a){return function(){var b=f.call(arguments);return a.apply(this,b)}},functionalize:function(a){return function(b){return a.apply(b,c.rest(arguments))}},methodize:function(a){return function(){return a.apply(null,c.cons(this,arguments))}},k:c.always,t:c.pipeline}),c.unsplatr=c.unsplat,c.mapArgsWith=i(c.flip(b)),c.bound=function(a,b){var d=a[b];if(!c.isFunction(d))throw new TypeError("Expected property to be a function");return c.bind(d,a)}}(this),function(a){var b=a._||require("lodash"),c=Array.prototype.slice;b.mixin({attempt:function(a,d){if(null==a)return void 0;var e=a[d],f=c.call(arguments,2);return b.isFunction(e)?e.apply(a,f):void 0}})}(this),function(a){function b(a){return function(b){return a.call(this,b)}}function c(a,b,c){var d,e;for(d=void 0!==c?c:a(),e=a();null!=e;)d=b.call(e,d,e),e=a();return d}function d(a,b){var c=x;return function(){return c===x?c=a:null!=c&&(c=b.call(c,c)),c}}function e(a,b){var c,d,e=a;return function(){return null!=e?(c=b.call(e,e),d=c[1],e=null!=d?c[0]:void 0,d):void 0}}function f(a,b,c){var d=c;return function(){var c=a();return null==c?c:d=void 0===d?c:b.call(c,d,c)}}function g(a,b,c){var d,e,f=c;return function(){return e=a(),null==e?e:void 0===f?f=e:(d=b.call(e,f,e),f=d[0],d[1])}}function h(a,b){return function(){var c;return c=a(),null!=c?b.call(c,c):void 0}}function i(a,b){var c=null;return function(){var d,e;if(null==c){if(e=a(),null==e)return void(c=null);c=b.call(e,e)}for(;null==d;)if(d=c(),null==d){if(e=a(),null==e)return void(c=null);c=b.call(e,e)}return d}}function j(a,b){return function(){var c;for(c=a();null!=c;){if(b.call(c,c))return c;c=a()}return void 0}}function l(a,b){return j(a,function(a){return!b(a)})}function m(a,b){return j(a,b)()}function n(a,b,c){for(var d=0;b-->0;)a();return null!=c?function(){return++d<=c?a():void 0}:a}function o(a,b){return n(a,null==b?1:b)}function p(a,b){return n(a,0,null==b?1:b)}function q(a){var b=0;return function(){return a[b++]}}function r(a){var b,c,d;return b=0,d=[],c=function(){var e,f;return e=a[b++],e instanceof Array?(d.push({array:a,index:b}),a=e,b=0,c()):void 0===e?d.length>0?(f=d.pop(),a=f.array,b=f.index,c()):void 0:e}}function s(a){return function(){return a}}function t(a,b,c){return function(){var d;return a>b?void 0:(d=a,a+=c,d)}}function u(a,b,c){return function(){var d;return b>a?void 0:(d=a,a-=c,d)}}function v(a,b,c){return null==a?t(1,1/0,1):null==b?t(a,1/0,1):null==c?b>=a?t(a,b,1):u(a,b,1):c>0?t(a,b,c):0>c?u(a,b,Math.abs(c)):k(a)}var w=a._||require("lodash"),x={},y=b(v);w.iterators={accumulate:f,accumulateWithReturn:g,foldl:c,reduce:c,unfold:d,unfoldWithReturn:e,map:h,mapcat:i,select:j,reject:l,filter:j,find:m,slice:n,drop:o,take:p,List:q,Tree:r,constant:s,K:s,numbers:y,range:v}}(this,void 0),function(a){var b=a._||require("lodash");b.mixin({isInstanceOf:function(a,b){return a instanceof b},isAssociative:function(a){return b.isArray(a)||b.isObject(a)||b.isArguments(a)},isIndexed:function(a){return b.isArray(a)||b.isString(a)||b.isArguments(a)},isSequential:function(a){return b.isArray(a)||b.isArguments(a)},isZero:function(a){return 0===a},isEven:function(a){return b.isFinite(a)&&0===(1&a)},isOdd:function(a){return b.isFinite(a)&&!b.isEven(a)},isPositive:function(a){return a>0},isNegative:function(a){return 0>a},isValidDate:function(a){return b.isDate(a)&&!b.isNaN(a.getTime())},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},isInteger:function(a){return b.isNumeric(a)&&a%1===0},isFloat:function(a){return b.isNumeric(a)&&!b.isInteger(a)},isJSON:function(a){try{JSON.parse(a)}catch(b){return!1}return!0},isIncreasing:function(){var a=b.size(arguments);if(1===a)return!0;if(2===a)return arguments[0]<arguments[1];for(var c=1;a>c;c++)if(arguments[c-1]>=arguments[c])return!1;return!0},isDecreasing:function(){var a=b.size(arguments);if(1===a)return!0;if(2===a)return arguments[0]>arguments[1];for(var c=1;a>c;c++)if(arguments[c-1]<=arguments[c])return!1;return!0}})}(this),function(a){var b=a._||require("lodash"),c=(Array.prototype.slice,Array.prototype.concat),d=function(a){return null!=a},e=function(a){return a!==!1&&d(a)},f=function(a){return b.isArray(a)||b.isObject(a)},g=function(a){return function(b){return function(c){return a(c,b)}}};b.mixin({merge:function(){var a=b.some(arguments)?{}:null;return e(a)&&b.extend.apply(null,c.call([a],b.toArray(arguments))),a},renameKeys:function(a,e){return b.reduce(e,function(b,c,e){return d(a[e])?(b[c]=a[e],b):b},b.omit.apply(null,c.call([a],b.keys(e))))},snapshot:function(a){if(null==a||"object"!=typeof a)return a;var c=new a.constructor;for(var d in a)a.hasOwnProperty(d)&&(c[d]=b.snapshot(a[d]));return c},updatePath:function(a,c,e,g){if(!f(a))throw new TypeError("Attempted to update a non-associative object.");if(!d(e))return c(a);var h=b.isArray(e),i=h?e:[e],j=h?b.snapshot(a):b.clone(a),k=b.last(i),l=j;return b.each(b.initial(i),function(a){g&&!b.has(l,a)&&(l[a]=b.clone(g)),l=l[a]}),l[k]=c(l[k]),j},setPath:function(a,c,e,f){if(!d(e))throw new TypeError("Attempted to set a property at a null path.");return b.updatePath(a,function(){return c},e,f)},frequencies:g(b.countBy)(b.identity)})}(this),function(a){{var b=a._||require("lodash"),c=Array.prototype.concat,d=Array.prototype;d.slice}b.mixin({accessor:function(a){return function(b){return b&&b[a]}},dictionary:function(a){return function(b){return a&&b&&a[b]}},selectKeys:function(a,d){return b.pick.apply(null,c.call([a],d))},kv:function(a,c){return b.has(a,c)?[c,a[c]]:void 0},getPath:function e(a,c){return"string"==typeof c&&(c=c.split(".")),void 0===a?void 0:0===c.length?a:null===a?void 0:e(a[b.first(c)],b.rest(c))},hasPath:function f(a,c){"string"==typeof c&&(c=c.split("."));var d=c.length;return null==a&&d>0?!1:c[0]in a?1===d?!0:f(a[b.first(c)],b.rest(c)):!1},pickWhen:function(a,c){var d={};return b.each(a,function(b,e){c(a[e])&&(d[e]=a[e])}),d},omitWhen:function(a,c){return b.pickWhen(a,function(a){return!c(a)})}})}(this),function(a){function b(a){return function(){return A.reduce(arguments,a)}}function c(a){return function(){for(var b,c=0;c<arguments.length-1;c++)if(b=a(arguments[c],arguments[c+1]),b===!1)return b;return b}}function d(a){return function(){return!a.apply(this,arguments)}}function e(a,b){return a+b}function f(a,b){return a-b}function g(a,b){return a*b}function h(a,b){return a/b}function i(a,b){return a%b}function j(a){return++a}function k(a){return--a}function l(a){return-a}function m(a,b){return a&b}function n(a,b){return a|b}function o(a,b){return a^b}function p(a,b){return a<<b}function q(a,b){return a>>b}function r(a,b){return a>>>b}function s(a){return~a}function t(a,b){return a==b}function u(a,b){return a===b}function v(a){return!a}function w(a,b){return a>b}function x(a,b){return b>a}function y(a,b){return a>=b}function z(a,b){return b>=a}var A=a._||require("lodash");A.mixin({add:b(e),sub:b(f),mul:b(g),div:b(h),mod:i,inc:j,dec:k,neg:l,eq:c(t),seq:c(u),neq:d(c(t)),sneq:d(c(u)),not:v,gt:c(w),lt:c(x),gte:c(y),lte:c(z),bitwiseAnd:b(m),bitwiseOr:b(n),bitwiseXor:b(o),bitwiseNot:s,bitwiseLeft:b(p),bitwiseRight:b(q),bitwiseZ:b(r)})}(this),function(a){var b=a._||require("lodash"),c=/\+/g,d=/(?:([^\[]+))|(?:\[(.*?)\])/g,e=function(a){return decodeURIComponent(a.replace(c,"%20"))},f=function(a,c,d){return b.isUndefined(d)&&(d=!0),b.isArray(c)?b.map(c,function(b,c){return f(d?c:a+"[]",b,!1)}).join("&"):b.isObject(c)?b.map(c,function(b,c){return f(d?c:a+"["+c+"]",b,!1)}).join("&"):encodeURIComponent(a)+"="+encodeURIComponent(c)};b.mixin({explode:function(a){return a.split("")},fromQuery:function(a){var c,f,g,h,i,j=a.split("&"),k={};return b.each(j,function(a){for(a=a.split("="),c=e(a[0]),g=c,i=k,d.lastIndex=0;null!==(f=d.exec(c));)b.isUndefined(f[1])?(h=f[2],i[g]=i[g]||(h?{}:[]),i=i[g]):h=f[1],g=h||b.size(i);i[g]=e(a[1])}),k},implode:function(a){return a.join("")},camelCase:function(a){return a.replace(/[-_\s](\w)/g,function(a){return a[1].toUpperCase()})},toDash:function(a){return a=a.replace(/([A-Z])/g,function(a){return"-"+a.toLowerCase()}),"-"==a.charAt(0)?a.substr(1):a},snakeCase:function(a){return a=a.replace(/([A-Z])/g,function(a){return"_"+a.toLowerCase()}),"_"==a.charAt(0)?a.substr(1):a},toQuery:function(a){return f("",a)},strContains:function(a,b){if("string"!=typeof a)throw new TypeError;return-1!=a.indexOf(b)},capitalize:function(a){return a.charAt(0).toUpperCase()+a.slice(1)},titleCase:function(a){return a.replace(/(\b.)/g,function(a){return a.toUpperCase()})},slugify:function(a){return a.replace(/ /g,"-").replace(/\./,"").toLowerCase()},regexEscape:function(a){return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},humanize:function(a){return b.capitalize(a.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b([A-Z]+)([A-Z])([a-z])/,"$1 $2$3"))},stripTags:function(a){var b=a.replace(/<\/?[^<>]*>/gi,"");return b}})}(this),function(a){var b=a._||require("lodash");b.mixin({done:function(a){var c=b(a);return c.stopTrampoline=!0,c},trampoline:function(a){for(var c=a.apply(a,b.rest(arguments));b.isFunction(c)&&(c=c(),!(c instanceof b&&c.stopTrampoline)););return c.value()}})}(this),function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b){b.exports=function(a){var b=Array.prototype.slice,c=Array.prototype.concat,d=Array.prototype.sort,e=function(a){return null!=a};a.mixin({cat:function(){return a.reduce(arguments,function(d,e){return a.isArguments(e)?c.call(d,b.call(e)):c.call(d,e)},[])},cons:function(b,c){return a.cat([b],c)},chunk:function(b,c,d){var e=function(b){if(null==b)return[];var f=a.take(b,c);return c===a.size(f)?a.cons(f,e(a.drop(b,c))):d?[a.take(a.cat(f,d),c)]:[]};return e(b)},chunkAll:function(b,c,d){d=null!=d?d:c;var e=function(b,c,d){return a.isEmpty(b)?[]:a.cons(a.take(b,c),e(a.drop(b,d),c,d))};return e(b,c,d)},mapcat:function(b,c){return a.cat.apply(null,a.map(b,c))},interpose:function(c,d){if(!a.isArray(c))throw new TypeError;var e=a.size(c);return 0===e?c:1===e?c:b.call(a.mapcat(c,function(b){return a.cons(b,[d])}),0,-1)},weave:function(){return a.some(arguments)?1==arguments.length?arguments[0]:a.filter(a.flatten(a.zip.apply(null,arguments),!0),function(a){return null!=a}):[]},interleave:a.weave,repeat:function(b,c){return a.times(b,function(){return c})},cycle:function(b,c){return a.flatten(a.times(b,function(){return c}),!0)},splitAt:function(b,c){return[a.take(b,c),a.drop(b,c)]},iterateUntil:function(a,b,c){for(var d=[],e=a(c);b(e);)d.push(e),e=a(e);return d},takeSkipping:function(b,c){var d=[],e=a.size(b);if(0>=c)return[];if(1===c)return b;for(var f=0;e>f;f+=c)d.push(b[f]);return d},reductions:function(b,c,d){var e=[],f=d;return a.each(b,function(a,d){f=c(f,b[d]),e.push(f)}),e},keepIndexed:function(b,c){return a.filter(a.map(a.range(a.size(b)),function(a){return c(a,b[a])}),e)},reverseOrder:function(a){if("string"==typeof a)throw new TypeError("Strings cannot be reversed by _.reverseOrder");return b.call(a).reverse()},collate:function(b,c,f){if(!a.isArray(b))throw new TypeError("expected an array as the first argument");if(!a.isArray(c))throw new TypeError("expected an array as the second argument");return d.call(b,function(b,d){a.isFunction(f)?(valA=f.call(b),valB=f.call(d)):e(f)?(valA=b[f],valB=d[f]):(valA=b,valB=d);var g=a.indexOf(c,valA),h=a.indexOf(c,valB);return-1===g?1:-1===h?-1:g-h})}})}},{}],2:[function(a,b){b.exports=function(a){var b=Array.prototype.slice,c=Array.prototype.concat,d=function(a){return null!=a},e=function(a){return a!==!1&&d(a)},f=function(b){return a.isArray(b)||a.isArguments(b)};a.mixin({second:function(a,c,d){return null==a?void 0:null==c||d?a[1]:b.call(a,1,c)},third:function(a,c,d){return null==a?void 0:null==c||d?a[2]:b.call(a,2,c)},nth:function(a,b,c){return null==b||c?void 0:a[b]},takeWhile:function(b,c){if(!f(b))throw new TypeError;for(var d=a.size(b),g=0;d>g&&e(c(b[g]));g++);return a.take(b,g)},dropWhile:function(b,c){if(!f(b))throw new TypeError;for(var d=a.size(b),g=0;d>g&&e(c(b[g]));g++);return a.drop(b,g)},splitWith:function(b,c){return[a.takeWhile(b,c),a.dropWhile(b,c)]},partitionBy:function(b,e){if(a.isEmpty(b)||!d(b))return[];var f=a.first(b),g=e(f),h=c.call([f],a.takeWhile(a.rest(b),function(b){return a.isEqual(g,e(b))}));return c.call([h],a.partitionBy(a.drop(b,a.size(h)),e))},best:function(b,c){return a.reduce(b,function(a,b){return c(a,b)?a:b})},keep:function(b,c){if(!f(b))throw new TypeError("expected an array as the first argument");return a.filter(a.map(b,function(a){return c(a)}),d)}})}},{}],3:[function(a,b){b.exports=function(a){a.mixin({exists:function(a){return null!=a},truthy:function(b){return b!==!1&&a.exists(b)},falsey:function(b){return!a.truthy(b)},not:function(a){return!a},existsAll:function(){return a.every(arguments,a.exists)},truthyAll:function(){return a.every(arguments,a.truthy)},falseyAll:function(){return a.every(arguments,a.falsey)},firstExisting:function(){for(var b=0;b<arguments.length;b++)if(a.exists(arguments[b]))return arguments[b]}})}},{}],4:[function(a,b){a("../common-js/_.array.builders.js")(_),a("../common-js/_.array.selectors.js")(_),a("../common-js/_.util.existential.js")(_),b.exports=_},{"../common-js/_.array.builders.js":1,"../common-js/_.array.selectors.js":2,"../common-js/_.util.existential.js":3}]},{},[4]); | ||
!function(a){function b(a){return e.isElement(a)?a.children:a}function c(a,b,c,d,i,j){var k=[];return function l(a,m,n){if(e.isObject(a)){if(k.indexOf(a)>=0)throw new TypeError(h);k.push(a)}if(c){var o=c.call(i,a,m,n);if(o===g)return g;if(o===f)return}var p,q=b(a);if(e.isObject(q)&&!e.isEmpty(q)){j&&(p=e.isArray(a)?[]:{});var r=e.any(q,function(b,c){var d=l(b,c,a);return d===g?!0:void(p&&(p[c]=d))});if(r)return g}return d?d.call(i,a,m,n,p):void 0}(a)}function d(a,b,c){var d=[];return this.preorder(a,function(a,g){return c||g!=b?void(e.has(a,b)&&(d[d.length]=a[b])):f}),d}var e=a._||require("lodash"),f={},g={},h="Not a tree: same object found in two different branches",i={find:function(a,b,c){var d;return this.preorder(a,function(a,e,f){return b.call(c,a,e,f)?(d=a,g):void 0},c),d},filter:function(a,b,c,d){var e=[];return null==a?e:(b(a,function(a,b,f){c.call(d,a,b,f)&&e.push(a)},null,this._traversalStrategy),e)},reject:function(a,b,c,d){return this.filter(a,b,function(a,b,e){return!c.call(d,a,b,e)})},map:function(a,b,c,d){var e=[];return b(a,function(a,b,f){e[e.length]=c.call(d,a,b,f)},null,this._traversalStrategy),e},pluck:function(a,b){return d.call(this,a,b,!1)},pluckRec:function(a,b){return d.call(this,a,b,!0)},postorder:function(a,b,d,e){e=e||this._traversalStrategy,c(a,e,null,b,d)},preorder:function(a,b,d,e){e=e||this._traversalStrategy,c(a,e,b,null,d)},reduce:function(a,b,d,e){var f=function(a,c,e,f){return b(f||d,a,c,e)};return c(a,this._traversalStrategy,null,f,e,!0)}};i.collect=i.map,i.detect=i.find,i.select=i.filter,e.walk=function(a){var c=e.clone(i);return e.bindAll.apply(null,[c].concat(e.keys(c))),c._traversalStrategy=a||b,c},e.extend(e.walk,e.walk())}(this),function(a){function b(a){return function(){if(1===arguments.length)return a.apply(this,arguments);throw new RangeError("Only a single argument may be accepted.")}}var c=a._||require("lodash"),d=function(){function a(c,d,e,f,g,h){return h===!0?f.unshift(g):f.push(g),f.length==e?c.apply(d,f):b(function(){return a(c,d,e,f.slice(0),arguments[0],h)})}return function(c,d){var e=this;return b(function(){return a(c,e,c.length,[],arguments[0],d)})}}(),e=function(){var a=[];return function(b){if("function"!=typeof b)throw new Error("Argument 1 must be a function.");var c=b.length;return void 0===a[c]&&(a[c]=function(a){return function(){if(arguments.length!==c)throw new RangeError(c+" arguments must be applied.");return a.apply(this,arguments)}}),a[c](b)}}(),f=function(a){return d.call(this,a,!0)},g=function(a){return b(function(c){return b(function(b){return a.call(this,b,c)})})},h=function(a){return b(function(c){return b(function(d){return b(function(b){return a.call(this,b,d,c)})})})};c.mixin({fix:function(a){var b=c.rest(arguments),d=function(){for(var d=b.slice(),e=0,f=0;f<(d.length||e<arguments.length);f++)d[f]===c&&(d[f]=arguments[e++]);return a.apply(null,d)};return d._original=a,d},unary:function(a){return function(b){return a.call(this,b)}},binary:function(a){return function(b,c){return a.call(this,b,c)}},ternary:function(a){return function(b,c,d){return a.call(this,b,c,d)}},quaternary:function(a){return function(b,c,d,e){return a.call(this,b,c,d,e)}},curry:d,curryRight:f,rCurry:f,curry2:function(a){return b(function(c){return b(function(b){return a.call(this,c,b)})})},curry3:function(a){return b(function(c){return b(function(d){return b(function(b){return a.call(this,c,d,b)})})})},curryRight2:g,rcurry2:g,curryRight3:h,rcurry3:h,enforce:e}),c.arity=function(){var a={};return function b(c,d){if(null==a[c]){for(var e=new Array(c),f=0;c>f;++f)e[f]="__"+f;var g=e.join(),h="return function ("+g+") { return fun.apply(this, arguments); };";a[c]=new Function(["fun"],h)}return null==d?function(a){return b(c,a)}:a[c](d)}}()}(this),function(a){function b(a,b){return c.arity(a.length,function(){return a.apply(this,h.call(arguments,b))})}var c=a._||require("lodash"),d=function(a){return null!=a},e=function(a){return a!==!1&&d(a)},f=[].reverse,g=[].slice,h=[].map,i=function(a){return function(b,c){return 1===arguments.length?function(c){return a(b,c)}:a(b,c)}};c.mixin({always:c.constant,pipeline:function(){var a=c.isArray(arguments[0])?arguments[0]:arguments;return function(b){return c.reduce(a,function(a,b){return b(a)},b)}},composeRight:c.pipeline,conjoin:function(){var a=arguments;return function(b){return c.every(b,function(b){return c.every(a,function(a){return a(b)})})}},disjoin:function(){var a=arguments;return function(b){return c.some(b,function(b){return c.some(a,function(a){return a(b)})})}},comparator:function(a){return function(b,c){return e(a(b,c))?-1:e(a(c,b))?1:0}},complement:function(a){return function(){return!a.apply(this,arguments)}},splat:function(a){return function(b){return a.apply(this,b)}},unsplat:function(a){var b=a.length;return 1>b?a:1===b?function(){return a.call(this,g.call(arguments,0))}:function(){var c=arguments.length,d=g.call(arguments,0,b-1),e=Math.max(b-c-1,0),f=new Array(e),h=g.call(arguments,a.length-1);return a.apply(this,d.concat(f).concat([h]))}},unsplatl:function(a){var b=a.length;return 1>b?a:1===b?function(){return a.call(this,g.call(arguments,0))}:function(){var c=arguments.length,d=g.call(arguments,Math.max(c-b+1,0)),e=g.call(arguments,0,Math.max(c-b+1,0));return a.apply(this,[e].concat(d))}},mapArgs:i(b),juxt:function(){var a=arguments;return function(){var b=arguments;return c.map(a,function(a){return a.apply(this,b)},this)}},fnull:function(a){var b=c.rest(arguments);return function(){for(var e=c.toArray(arguments),f=c.size(b),g=0;f>g;g++)d(e[g])||(e[g]=b[g]);return a.apply(this,e)}},flip2:function(a){return function(){var b=g.call(arguments);return b[0]=arguments[1],b[1]=arguments[0],a.apply(this,b)}},flip:function(a){return function(){var b=f.call(arguments);return a.apply(this,b)}},functionalize:function(a){return function(b){return a.apply(b,c.rest(arguments))}},methodize:function(a){return function(){return a.apply(null,c.cons(this,arguments))}},k:c.always,t:c.pipeline}),c.unsplatr=c.unsplat,c.mapArgsWith=i(c.flip(b)),c.bound=function(a,b){var d=a[b];if(!c.isFunction(d))throw new TypeError("Expected property to be a function");return c.bind(d,a)}}(this),function(a){var b=a._||require("lodash"),c=Array.prototype.slice;b.mixin({attempt:function(a,d){if(null==a)return void 0;var e=a[d],f=c.call(arguments,2);return b.isFunction(e)?e.apply(a,f):void 0}})}(this),function(a,b){function c(a){return function(b){return a.call(this,b)}}function d(a,b,c){var d,e;for(d=void 0!==c?c:a(),e=a();null!=e;)d=b.call(e,d,e),e=a();return d}function e(a,b){var c=y;return function(){return c===y?c=a:null!=c&&(c=b.call(c,c)),c}}function f(a,b){var c,d,e=a;return function(){return null!=e?(c=b.call(e,e),d=c[1],e=null!=d?c[0]:void 0,d):void 0}}function g(a,b,c){var d=c;return function(){var c=a();return null==c?c:d=void 0===d?c:b.call(c,d,c)}}function h(a,b,c){var d,e,f=c;return function(){return e=a(),null==e?e:void 0===f?f=e:(d=b.call(e,f,e),f=d[0],d[1])}}function i(a,b){return function(){var c;return c=a(),null!=c?b.call(c,c):void 0}}function j(a,b){var c=null;return function(){var d,e;if(null==c){if(e=a(),null==e)return void(c=null);c=b.call(e,e)}for(;null==d;)if(d=c(),null==d){if(e=a(),null==e)return void(c=null);c=b.call(e,e)}return d}}function l(a,b){return function(){var c;for(c=a();null!=c;){if(b.call(c,c))return c;c=a()}return void 0}}function m(a,b){return l(a,function(a){return!b(a)})}function n(a,b){return l(a,b)()}function o(a,b,c){for(var d=0;b-->0;)a();return null!=c?function(){return++d<=c?a():void 0}:a}function p(a,b){return o(a,null==b?1:b)}function q(a,b){return o(a,0,null==b?1:b)}function r(a){var b=0;return function(){return a[b++]}}function s(a){var b,c,d;return b=0,d=[],c=function(){var e,f;return e=a[b++],e instanceof Array?(d.push({array:a,index:b}),a=e,b=0,c()):void 0===e?d.length>0?(f=d.pop(),a=f.array,b=f.index,c()):void 0:e}}function t(a){return function(){return a}}function u(a,b,c){return function(){var d;return a>b?void 0:(d=a,a+=c,d)}}function v(a,b,c){return function(){var d;return b>a?void 0:(d=a,a-=c,d)}}function w(a,b,c){return null==a?u(1,1/0,1):null==b?u(a,1/0,1):null==c?b>=a?u(a,b,1):v(a,b,1):c>0?u(a,b,c):0>c?v(a,b,Math.abs(c)):k(a)}var x=a._||require("lodash"),y={},z=c(w);x.iterators={accumulate:g,accumulateWithReturn:h,foldl:d,reduce:d,unfold:e,unfoldWithReturn:f,map:i,mapcat:j,select:l,reject:m,filter:l,find:n,slice:o,drop:p,take:q,List:r,Tree:s,constant:t,K:t,numbers:z,range:w}}(this,void 0),function(a){var b=a._||require("lodash");b.mixin({isInstanceOf:function(a,b){return a instanceof b},isAssociative:function(a){return b.isArray(a)||b.isObject(a)||b.isArguments(a)},isIndexed:function(a){return b.isArray(a)||b.isString(a)||b.isArguments(a)},isSequential:function(a){return b.isArray(a)||b.isArguments(a)},isZero:function(a){return 0===a},isEven:function(a){return b.isFinite(a)&&0===(1&a)},isOdd:function(a){return b.isFinite(a)&&!b.isEven(a)},isPositive:function(a){return a>0},isNegative:function(a){return 0>a},isValidDate:function(a){return b.isDate(a)&&!b.isNaN(a.getTime())},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},isInteger:function(a){return b.isNumeric(a)&&a%1===0},isFloat:function(a){return b.isNumeric(a)&&!b.isInteger(a)},isJSON:function(a){try{JSON.parse(a)}catch(b){return!1}return!0},isIncreasing:function(){var a=b.size(arguments);if(1===a)return!0;if(2===a)return arguments[0]<arguments[1];for(var c=1;a>c;c++)if(arguments[c-1]>=arguments[c])return!1;return!0},isDecreasing:function(){var a=b.size(arguments);if(1===a)return!0;if(2===a)return arguments[0]>arguments[1];for(var c=1;a>c;c++)if(arguments[c-1]<=arguments[c])return!1;return!0}})}(this),function(a){var b=a._||require("lodash"),c=(Array.prototype.slice,Array.prototype.concat),d=function(a){return null!=a},e=function(a){return a!==!1&&d(a)},f=function(a){return b.isArray(a)||b.isObject(a)},g=function(a){return function(b){return function(c){return a(c,b)}}};b.mixin({merge:function(){var a=b.some(arguments)?{}:null;return e(a)&&b.extend.apply(null,c.call([a],b.toArray(arguments))),a},renameKeys:function(a,e){return b.reduce(e,function(b,c,e){return d(a[e])?(b[c]=a[e],b):b},b.omit.apply(null,c.call([a],b.keys(e))))},snapshot:function(a){if(null==a||"object"!=typeof a)return a;var c=new a.constructor;for(var d in a)a.hasOwnProperty(d)&&(c[d]=b.snapshot(a[d]));return c},updatePath:function(a,c,e,g){if(!f(a))throw new TypeError("Attempted to update a non-associative object.");if(!d(e))return c(a);var h=b.isArray(e),i=h?e:[e],j=h?b.snapshot(a):b.clone(a),k=b.last(i),l=j;return b.each(b.initial(i),function(a){g&&!b.has(l,a)&&(l[a]=b.clone(g)),l=l[a]}),l[k]=c(l[k]),j},setPath:function(a,c,e,f){if(!d(e))throw new TypeError("Attempted to set a property at a null path.");return b.updatePath(a,function(){return c},e,f)},frequencies:g(b.countBy)(b.identity)})}(this),function(a){var b=a._||require("lodash"),c=Array.prototype.concat,d=Array.prototype;d.slice;b.mixin({accessor:function(a){return function(b){return b&&b[a]}},dictionary:function(a){return function(b){return a&&b&&a[b]}},selectKeys:function(a,d){return b.pick.apply(null,c.call([a],d))},kv:function(a,c){return b.has(a,c)?[c,a[c]]:void 0},getPath:function e(a,c){return"string"==typeof c&&(c=c.split(".")),void 0===a?void 0:0===c.length?a:null===a?void 0:e(a[b.first(c)],b.rest(c))},hasPath:function f(a,c){"string"==typeof c&&(c=c.split("."));var d=c.length;return null==a&&d>0?!1:c[0]in a?1===d?!0:f(a[b.first(c)],b.rest(c)):!1},pickWhen:function(a,c){var d={};return b.each(a,function(b,e){c(a[e])&&(d[e]=a[e])}),d},omitWhen:function(a,c){return b.pickWhen(a,function(a){return!c(a)})}})}(this),function(a){function b(a){return function(){return A.reduce(arguments,a)}}function c(a){return function(){for(var b,c=0;c<arguments.length-1;c++)if(b=a(arguments[c],arguments[c+1]),b===!1)return b;return b}}function d(a){return function(){return!a.apply(this,arguments)}}function e(a,b){return a+b}function f(a,b){return a-b}function g(a,b){return a*b}function h(a,b){return a/b}function i(a,b){return a%b}function j(a){return++a}function k(a){return--a}function l(a){return-a}function m(a,b){return a&b}function n(a,b){return a|b}function o(a,b){return a^b}function p(a,b){return a<<b}function q(a,b){return a>>b}function r(a,b){return a>>>b}function s(a){return~a}function t(a,b){return a==b}function u(a,b){return a===b}function v(a){return!a}function w(a,b){return a>b}function x(a,b){return b>a}function y(a,b){return a>=b}function z(a,b){return b>=a}var A=a._||require("lodash");A.mixin({add:b(e),sub:b(f),mul:b(g),div:b(h),mod:i,inc:j,dec:k,neg:l,eq:c(t),seq:c(u),neq:d(c(t)),sneq:d(c(u)),not:v,gt:c(w),lt:c(x),gte:c(y),lte:c(z),bitwiseAnd:b(m),bitwiseOr:b(n),bitwiseXor:b(o),bitwiseNot:s,bitwiseLeft:b(p),bitwiseRight:b(q),bitwiseZ:b(r)})}(this),function(a){var b=a._||require("lodash"),c=/\+/g,d=/(?:([^\[]+))|(?:\[(.*?)\])/g,e=function(a){return decodeURIComponent(a.replace(c,"%20"))},f=function(a,c,d){return b.isUndefined(d)&&(d=!0),b.isArray(c)?b.map(c,function(b,c){return f(d?c:a+"[]",b,!1)}).join("&"):b.isObject(c)?b.map(c,function(b,c){return f(d?c:a+"["+c+"]",b,!1)}).join("&"):encodeURIComponent(a)+"="+encodeURIComponent(c)};b.mixin({explode:function(a){return a.split("")},fromQuery:function(a){var c,f,g,h,i,j=a.split("&"),k={};return b.each(j,function(a){for(a=a.split("="),c=e(a[0]),g=c,i=k,d.lastIndex=0;null!==(f=d.exec(c));)b.isUndefined(f[1])?(h=f[2],i[g]=i[g]||(h?{}:[]),i=i[g]):h=f[1],g=h||b.size(i);i[g]=e(a[1])}),k},implode:function(a){return a.join("")},camelCase:function(a){return a.replace(/[-_\s](\w)/g,function(a){return a[1].toUpperCase()})},toDash:function(a){return a=a.replace(/([A-Z])/g,function(a){return"-"+a.toLowerCase()}),"-"==a.charAt(0)?a.substr(1):a},snakeCase:function(a){return a=a.replace(/([A-Z])/g,function(a){return"_"+a.toLowerCase()}),"_"==a.charAt(0)?a.substr(1):a},toQuery:function(a){return f("",a)},strContains:function(a,b){if("string"!=typeof a)throw new TypeError;return-1!=a.indexOf(b)},capitalize:function(a){return a.charAt(0).toUpperCase()+a.slice(1)},titleCase:function(a){return a.replace(/(\b.)/g,function(a){return a.toUpperCase()})},slugify:function(a){return a.replace(/ /g,"-").replace(/\./,"").toLowerCase()},regexEscape:function(a){return a.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},humanize:function(a){return b.capitalize(a.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b([A-Z]+)([A-Z])([a-z])/,"$1 $2$3"))},stripTags:function(a){var b=a.replace(/<\/?[^<>]*>/gi,"");return b}})}(this),function(a){var b=a._||require("lodash");b.mixin({done:function(a){var c=b(a);return c.stopTrampoline=!0,c},trampoline:function(a){for(var c=a.apply(a,b.rest(arguments));b.isFunction(c)&&(c=c(),!(c instanceof b&&c.stopTrampoline)););return c.value()}})}(this),function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){b.exports=function(a){var b=Array.prototype.slice,c=Array.prototype.concat,d=Array.prototype.sort,e=function(a){return null!=a};a.mixin({cat:function(){return a.reduce(arguments,function(d,e){return a.isArguments(e)?c.call(d,b.call(e)):c.call(d,e)},[])},cons:function(b,c){return a.cat([b],c)},chunk:function(b,c,d){var e=function(b){if(null==b)return[];var f=a.take(b,c);return c===a.size(f)?a.cons(f,e(a.drop(b,c))):d?[a.take(a.cat(f,d),c)]:[]};return e(b)},chunkAll:function(b,c,d){d=null!=d?d:c;var e=function(b,c,d){return a.isEmpty(b)?[]:a.cons(a.take(b,c),e(a.drop(b,d),c,d))};return e(b,c,d)},mapcat:function(b,c){return a.cat.apply(null,a.map(b,c))},interpose:function(c,d){if(!a.isArray(c))throw new TypeError;var e=a.size(c);return 0===e?c:1===e?c:b.call(a.mapcat(c,function(b){return a.cons(b,[d])}),0,-1)},weave:function(){return a.some(arguments)?1==arguments.length?arguments[0]:a.filter(a.flatten(a.zip.apply(null,arguments),!1),function(a){return null!=a}):[]},interleave:a.weave,repeat:function(b,c){return a.times(b,function(){return c})},cycle:function(b,c){return a.flatten(a.times(b,function(){return c}),!0)},splitAt:function(b,c){return[a.take(b,c),a.drop(b,c)]},iterateUntil:function(a,b,c){for(var d=[],e=a(c);b(e);)d.push(e),e=a(e);return d},takeSkipping:function(b,c){var d=[],e=a.size(b);if(0>=c)return[];if(1===c)return b;for(var f=0;e>f;f+=c)d.push(b[f]);return d},reductions:function(b,c,d){var e=[],f=d;return a.each(b,function(a,d){f=c(f,b[d]),e.push(f)}),e},keepIndexed:function(b,c){return a.filter(a.map(a.range(a.size(b)),function(a){return c(a,b[a])}),e)},reverseOrder:function(a){if("string"==typeof a)throw new TypeError("Strings cannot be reversed by _.reverseOrder");return b.call(a).reverse()},collate:function(b,c,f){if(!a.isArray(b))throw new TypeError("expected an array as the first argument");if(!a.isArray(c))throw new TypeError("expected an array as the second argument");return d.call(b,function(b,d){a.isFunction(f)?(valA=f.call(b),valB=f.call(d)):e(f)?(valA=b[f],valB=d[f]):(valA=b,valB=d);var g=a.indexOf(c,valA),h=a.indexOf(c,valB);return-1===g?1:-1===h?-1:g-h})}})}},{}],2:[function(a,b,c){b.exports=function(a){function b(d,e){return null==d?void 0:g(e)?a(e).map(function(a){return d[a]}).valueOf():b(d,c.call(arguments,1))}var c=Array.prototype.slice,d=Array.prototype.concat,e=function(a){return null!=a},f=function(a){return a!==!1&&e(a)},g=function(b){return a.isArray(b)||a.isArguments(b)};a.mixin({second:function(a,b,d){return null==a?void 0:null==b||d?a[1]:c.call(a,1,b)},third:function(a,b,d){return null==a?void 0:null==b||d?a[2]:c.call(a,2,b)},nth:function(a,b,c){return null==b||c?void 0:a[b]},nths:b,valuesAt:b,binPick:function h(b,d){return null==b?void 0:g(d)?a.nths(b,a.range(d.length).filter(function(a){return d[a]})):h(b,c.call(arguments,1))},takeWhile:function(b,c){if(!g(b))throw new TypeError;for(var d=a.size(b),e=0;d>e&&f(c(b[e]));e++);return a.take(b,e)},dropWhile:function(b,c){if(!g(b))throw new TypeError;for(var d=a.size(b),e=0;d>e&&f(c(b[e]));e++);return a.drop(b,e)},splitWith:function(b,c){return[a.takeWhile(b,c),a.dropWhile(b,c)]},partitionBy:function(b,c){if(a.isEmpty(b)||!e(b))return[];var f=a.first(b),g=c(f),h=d.call([f],a.takeWhile(a.rest(b),function(b){return a.isEqual(g,c(b))}));return d.call([h],a.partitionBy(a.drop(b,a.size(h)),c))},best:function(b,c){return a.reduce(b,function(a,b){return c(a,b)?a:b})},keep:function(b,c){if(!g(b))throw new TypeError("expected an array as the first argument");return a.filter(a.map(b,function(a){return c(a)}),e)}})}},{}],3:[function(a,b,c){b.exports=function(a){a.mixin({exists:function(a){return null!=a},truthy:function(b){return b!==!1&&a.exists(b)},falsey:function(b){return!a.truthy(b)},not:function(a){return!a},existsAll:function(){return a.every(arguments,a.exists)},truthyAll:function(){return a.every(arguments,a.truthy)},falseyAll:function(){return a.every(arguments,a.falsey)},firstExisting:function(){for(var b=0;b<arguments.length;b++)if(a.exists(arguments[b]))return arguments[b]}})}},{}],4:[function(a,b,c){a("../common-js/_.array.builders.js")(_),a("../common-js/_.array.selectors.js")(_),a("../common-js/_.util.existential.js")(_),b.exports=_},{"../common-js/_.array.builders.js":1,"../common-js/_.array.selectors.js":2,"../common-js/_.util.existential.js":3}]},{},[4]); |
@@ -81,3 +81,3 @@ ### array.selectors | ||
If wrapping a function around `_.nth` is too tedious or you'd like to partially apply the index then Underscore-contrib offers any of `_.flip2`, `_.fix` or `rcurry2` to solve this. | ||
If wrapping a function around `_.nth` is too tedious or you'd like to partially apply the index then Underscore-contrib offers any of `_.flip2`, `_.fix` or `_.curryRight2` to solve this. | ||
@@ -84,0 +84,0 @@ -------------------------------------------------------------------------------- |
@@ -144,2 +144,101 @@ ### function.arity | ||
#### curryRight | ||
**Signature:** `_.curryRight(func:Function)` | ||
**Aliases:** `_.rCurry` | ||
Returns a curried version of `func` where arguments are processed from right | ||
to left. | ||
```javascript | ||
function divide (a, b) { | ||
return a / b; | ||
} | ||
var curried = _.curryRight(divide); | ||
// => function | ||
curried(1); | ||
// => function | ||
curried(1)(2); | ||
// => 2 | ||
curried(2)(1); | ||
// => 0.5 | ||
``` | ||
-------------------------------------------------------------------------------- | ||
#### curryRight2 | ||
**Signature:** `_.curryRight2(func:Function)` | ||
**Aliases:** `_.rcurry2` | ||
Returns a curried version of `func` where a maxium of two arguments are | ||
processed from right to left. | ||
```javascript | ||
function concat () { | ||
var str = ""; | ||
for (var i = 0; i < arguments.length; i++) { | ||
str = str + arguments[i]; | ||
} | ||
return str; | ||
} | ||
var curried = _.curryRight2(concat); | ||
// => function | ||
curried("a"); | ||
// => function | ||
curried("a")("b"); | ||
// => "ba" | ||
``` | ||
-------------------------------------------------------------------------------- | ||
#### curryRight3 | ||
**Signature:** `_.curryRight3(func:Function)` | ||
**Aliases:** `_.rcurry3` | ||
Returns a curried version of `func` where a maxium of three arguments are | ||
processed from right to left. | ||
```javascript | ||
function concat () { | ||
var str = ""; | ||
for (var i = 0; i < arguments.length; i++) { | ||
str = str + arguments[i]; | ||
} | ||
return str; | ||
} | ||
var curried = _.curryRight3(concat); | ||
// => function | ||
curried("a"); | ||
// => function | ||
curried("a")("b"); | ||
// => function | ||
curried("a")("b")("c"); | ||
// => "cba" | ||
``` | ||
-------------------------------------------------------------------------------- | ||
#### fix | ||
@@ -244,92 +343,2 @@ | ||
-------------------------------------------------------------------------------- | ||
#### rCurry | ||
**Signature:** `_.rCurry(func:Function)` | ||
Returns a curried version of `func` where arguments are processed from right | ||
to left. | ||
```javascript | ||
function divide (a, b) { | ||
return a / b; | ||
} | ||
var curried = _.rCurry(divide); | ||
// => function | ||
curried(1); | ||
// => function | ||
curried(1)(2); | ||
// => 2 | ||
curried(2)(1); | ||
// => 0.5 | ||
``` | ||
-------------------------------------------------------------------------------- | ||
#### rcurry2 | ||
**Signature:** `_.rcurry2(func:Function)` | ||
Returns a curried version of `func` where a maxium of two arguments are | ||
processed from right to left. | ||
```javascript | ||
function concat () { | ||
var str = ""; | ||
for (var i = 0; i < arguments.length; i++) { | ||
str = str + arguments[i]; | ||
} | ||
return str; | ||
} | ||
var curried = _.rcurry2(concat); | ||
// => function | ||
curried("a"); | ||
// => function | ||
curried("a")("b"); | ||
// => "ba" | ||
``` | ||
-------------------------------------------------------------------------------- | ||
#### rcurry3 | ||
**Signature:** `_.rcurry3(func:Function)` | ||
Returns a curried version of `func` where a maxium of three arguments are | ||
processed from right to left. | ||
```javascript | ||
function concat () { | ||
var str = ""; | ||
for (var i = 0; i < arguments.length; i++) { | ||
str = str + arguments[i]; | ||
} | ||
return str; | ||
} | ||
var curried = _.rcurry3(concat); | ||
// => function | ||
curried("a"); | ||
// => function | ||
curried("a")("b"); | ||
// => function | ||
curried("a")("b")("c"); | ||
// => "cba" | ||
``` | ||
-------------------------------------------------------------------------------- |
@@ -129,6 +129,6 @@ ### function.iterators | ||
Returns an iterater that when invoked will iterate over the contents of `array`. | ||
Returns an iterator that when invoked will iterate over the contents of `array`. | ||
```javascript | ||
var triumvirIter = _.iterators.List(["Ceasar", "Pompey", "Crassus"]; | ||
var triumvirIter = _.iterators.List(["Ceasar", "Pompey", "Crassus"]); | ||
@@ -224,3 +224,3 @@ triumvirIter(); | ||
**Signature:** `_.iterators.range([from:Number, to:Number, by:Number]); | ||
**Signature:** `_.iterators.range([from:Number, to:Number, by:Number])` | ||
@@ -227,0 +227,0 @@ Returns an iterator whose values consist of numbers beginning with `from`, ending with `to`, in steps of size `by`. |
@@ -59,2 +59,4 @@ ### object.builders | ||
See `_.updatePath` about `obj` not being mutated in the process by cloning it. | ||
```javascript | ||
@@ -93,5 +95,8 @@ _.setPath({}, "Plotinus", ["Platonism", "Neoplatonism"], {}); | ||
Note that the original object will *not* be mutated. Instead, `obj` will | ||
be cloned deeply. | ||
```javascript | ||
var imperialize = function (val) { | ||
if (val == "Republic) return "Empire"; | ||
if (val == "Republic") return "Empire"; | ||
else return val; | ||
@@ -102,2 +107,14 @@ }; | ||
// => { rome: "Empire" } | ||
var obj = { earth: { rome: "Republic" } }; | ||
var imperialObj = _.updatePath(obj, imperialize, ["earth", "rome"]); | ||
imperialObj; | ||
// => { earth: { rome: "Empire" }} | ||
obj; | ||
// => { earth: { rome: "Republic" }} | ||
obj === imperialObj; | ||
// => false | ||
``` |
@@ -5,7 +5,50 @@ ### util.trampolines | ||
Documentation should use [Journo](https://github.com/jashkenas/journo) formats and standards. | ||
-------------------------------------------------------------------------------- | ||
done: function(value) { | ||
trampoline: function(fun /*, args */) { | ||
#### done | ||
**Signature:** `_.done(value:Any)` | ||
A utility for wrapping a function's return values so they can be used by | ||
`_.trampoline`. [See below](#trampoline). | ||
-------------------------------------------------------------------------------- | ||
#### trampoline | ||
**Signature:** `_.trampoline(fun:Function[, args:Any...])` | ||
Provides a way of creating recursive functions that won't exceed a JavaScript | ||
engine's maximum recursion depth. Rather than writing a naive recursive | ||
function, the function's base cases must return `_.done(someValue)`, and | ||
recursive calls must be wrapped in a returned function. | ||
In order to create a trampolined function that can be used in the same way as | ||
a naive recursive function, use `_.partial` as illustrated below. | ||
```javascript | ||
function isEvenNaive (num) { | ||
if (num === 0) return true; | ||
if (num === 1) return false; | ||
return isEvenNaive(num - 2); | ||
} | ||
isEvenNaive(99999); | ||
// => InternalError: too much recursion | ||
function isEvenInner (num) { | ||
if (num === 0) return _.done(true); | ||
if (num === 1) return _.done(false); | ||
return function () { return isEvenInner(Math.abs(num) - 2); }; | ||
} | ||
_.trampoline(isEvenInner, 99999); | ||
// => false | ||
var isEven = _.partial(_.trampoline, isEvenInner); | ||
isEven(99999); | ||
// => false | ||
``` | ||
-------------------------------------------------------------------------------- |
@@ -39,15 +39,18 @@ function sandbox(inNewContext) { | ||
module.exports.after = inNewContext.after; | ||
module.exports.ary = inNewContext.ary; | ||
module.exports.assign = inNewContext.assign; | ||
module.exports.at = inNewContext.at; | ||
module.exports.before = inNewContext.before; | ||
module.exports.bind = inNewContext.bind; | ||
module.exports.bindAll = inNewContext.bindAll; | ||
module.exports.bindKey = inNewContext.bindKey; | ||
module.exports.callback = inNewContext.callback; | ||
module.exports.chain = inNewContext.chain; | ||
module.exports.chunk = inNewContext.chunk; | ||
module.exports.compact = inNewContext.compact; | ||
module.exports.compose = inNewContext.compose; | ||
module.exports.constant = inNewContext.constant; | ||
module.exports.countBy = inNewContext.countBy; | ||
module.exports.create = inNewContext.create; | ||
module.exports.createCallback = inNewContext.createCallback; | ||
module.exports.curry = inNewContext.curry; | ||
module.exports.curryRight = inNewContext.curryRight; | ||
module.exports.debounce = inNewContext.debounce; | ||
@@ -58,4 +61,12 @@ module.exports.defaults = inNewContext.defaults; | ||
module.exports.difference = inNewContext.difference; | ||
module.exports.drop = inNewContext.drop; | ||
module.exports.dropRight = inNewContext.dropRight; | ||
module.exports.dropRightWhile = inNewContext.dropRightWhile; | ||
module.exports.dropWhile = inNewContext.dropWhile; | ||
module.exports.fill = inNewContext.fill; | ||
module.exports.filter = inNewContext.filter; | ||
module.exports.flatten = inNewContext.flatten; | ||
module.exports.flattenDeep = inNewContext.flattenDeep; | ||
module.exports.flow = inNewContext.flow; | ||
module.exports.flowRight = inNewContext.flowRight; | ||
module.exports.forEach = inNewContext.forEach; | ||
@@ -75,8 +86,14 @@ module.exports.forEachRight = inNewContext.forEachRight; | ||
module.exports.keys = inNewContext.keys; | ||
module.exports.keysIn = inNewContext.keysIn; | ||
module.exports.map = inNewContext.map; | ||
module.exports.mapKeys = inNewContext.mapKeys; | ||
module.exports.mapValues = inNewContext.mapValues; | ||
module.exports.max = inNewContext.max; | ||
module.exports.matches = inNewContext.matches; | ||
module.exports.matchesProperty = inNewContext.matchesProperty; | ||
module.exports.memoize = inNewContext.memoize; | ||
module.exports.merge = inNewContext.merge; | ||
module.exports.min = inNewContext.min; | ||
module.exports.method = inNewContext.method; | ||
module.exports.methodOf = inNewContext.methodOf; | ||
module.exports.mixin = inNewContext.mixin; | ||
module.exports.negate = inNewContext.negate; | ||
module.exports.omit = inNewContext.omit; | ||
@@ -87,20 +104,39 @@ module.exports.once = inNewContext.once; | ||
module.exports.partialRight = inNewContext.partialRight; | ||
module.exports.partition = inNewContext.partition; | ||
module.exports.pick = inNewContext.pick; | ||
module.exports.pluck = inNewContext.pluck; | ||
module.exports.property = inNewContext.property; | ||
module.exports.propertyOf = inNewContext.propertyOf; | ||
module.exports.pull = inNewContext.pull; | ||
module.exports.pullAt = inNewContext.pullAt; | ||
module.exports.range = inNewContext.range; | ||
module.exports.rearg = inNewContext.rearg; | ||
module.exports.reject = inNewContext.reject; | ||
module.exports.remove = inNewContext.remove; | ||
module.exports.rest = inNewContext.rest; | ||
module.exports.restParam = inNewContext.restParam; | ||
module.exports.set = inNewContext.set; | ||
module.exports.shuffle = inNewContext.shuffle; | ||
module.exports.slice = inNewContext.slice; | ||
module.exports.sortBy = inNewContext.sortBy; | ||
module.exports.sortByAll = inNewContext.sortByAll; | ||
module.exports.sortByOrder = inNewContext.sortByOrder; | ||
module.exports.spread = inNewContext.spread; | ||
module.exports.take = inNewContext.take; | ||
module.exports.takeRight = inNewContext.takeRight; | ||
module.exports.takeRightWhile = inNewContext.takeRightWhile; | ||
module.exports.takeWhile = inNewContext.takeWhile; | ||
module.exports.tap = inNewContext.tap; | ||
module.exports.throttle = inNewContext.throttle; | ||
module.exports.thru = inNewContext.thru; | ||
module.exports.times = inNewContext.times; | ||
module.exports.toArray = inNewContext.toArray; | ||
module.exports.toPlainObject = inNewContext.toPlainObject; | ||
module.exports.transform = inNewContext.transform; | ||
module.exports.union = inNewContext.union; | ||
module.exports.uniq = inNewContext.uniq; | ||
module.exports.unzip = inNewContext.unzip; | ||
module.exports.unzipWith = inNewContext.unzipWith; | ||
module.exports.values = inNewContext.values; | ||
module.exports.valuesIn = inNewContext.valuesIn; | ||
module.exports.where = inNewContext.where; | ||
@@ -112,7 +148,10 @@ module.exports.without = inNewContext.without; | ||
module.exports.zipObject = inNewContext.zipObject; | ||
module.exports.zipWith = inNewContext.zipWith; | ||
module.exports.backflow = inNewContext.backflow; | ||
module.exports.collect = inNewContext.collect; | ||
module.exports.drop = inNewContext.drop; | ||
module.exports.compose = inNewContext.compose; | ||
module.exports.each = inNewContext.each; | ||
module.exports.eachRight = inNewContext.eachRight; | ||
module.exports.extend = inNewContext.extend; | ||
module.exports.iteratee = inNewContext.iteratee; | ||
module.exports.methods = inNewContext.methods; | ||
@@ -123,7 +162,12 @@ module.exports.object = inNewContext.object; | ||
module.exports.unique = inNewContext.unique; | ||
module.exports.unzip = inNewContext.unzip; | ||
module.exports.add = inNewContext.add; | ||
module.exports.attempt = inNewContext.attempt; | ||
module.exports.camelCase = inNewContext.camelCase; | ||
module.exports.capitalize = inNewContext.capitalize; | ||
module.exports.clone = inNewContext.clone; | ||
module.exports.cloneDeep = inNewContext.cloneDeep; | ||
module.exports.contains = inNewContext.contains; | ||
module.exports.deburr = inNewContext.deburr; | ||
module.exports.endsWith = inNewContext.endsWith; | ||
module.exports.escape = inNewContext.escape; | ||
module.exports.escapeRegExp = inNewContext.escapeRegExp; | ||
module.exports.every = inNewContext.every; | ||
@@ -136,5 +180,12 @@ module.exports.find = inNewContext.find; | ||
module.exports.findLastKey = inNewContext.findLastKey; | ||
module.exports.findWhere = inNewContext.findWhere; | ||
module.exports.first = inNewContext.first; | ||
module.exports.get = inNewContext.get; | ||
module.exports.gt = inNewContext.gt; | ||
module.exports.gte = inNewContext.gte; | ||
module.exports.has = inNewContext.has; | ||
module.exports.identity = inNewContext.identity; | ||
module.exports.includes = inNewContext.includes; | ||
module.exports.indexOf = inNewContext.indexOf; | ||
module.exports.inRange = inNewContext.inRange; | ||
module.exports.isArguments = inNewContext.isArguments; | ||
@@ -147,5 +198,8 @@ module.exports.isArray = inNewContext.isArray; | ||
module.exports.isEqual = inNewContext.isEqual; | ||
module.exports.isError = inNewContext.isError; | ||
module.exports.isFinite = inNewContext.isFinite; | ||
module.exports.isFunction = inNewContext.isFunction; | ||
module.exports.isMatch = inNewContext.isMatch; | ||
module.exports.isNaN = inNewContext.isNaN; | ||
module.exports.isNative = inNewContext.isNative; | ||
module.exports.isNull = inNewContext.isNull; | ||
@@ -157,8 +211,17 @@ module.exports.isNumber = inNewContext.isNumber; | ||
module.exports.isString = inNewContext.isString; | ||
module.exports.isTypedArray = inNewContext.isTypedArray; | ||
module.exports.isUndefined = inNewContext.isUndefined; | ||
module.exports.kebabCase = inNewContext.kebabCase; | ||
module.exports.last = inNewContext.last; | ||
module.exports.lastIndexOf = inNewContext.lastIndexOf; | ||
module.exports.mixin = inNewContext.mixin; | ||
module.exports.lt = inNewContext.lt; | ||
module.exports.lte = inNewContext.lte; | ||
module.exports.max = inNewContext.max; | ||
module.exports.min = inNewContext.min; | ||
module.exports.noConflict = inNewContext.noConflict; | ||
module.exports.noop = inNewContext.noop; | ||
module.exports.now = inNewContext.now; | ||
module.exports.pad = inNewContext.pad; | ||
module.exports.padLeft = inNewContext.padLeft; | ||
module.exports.padRight = inNewContext.padRight; | ||
module.exports.parseInt = inNewContext.parseInt; | ||
@@ -168,158 +231,158 @@ module.exports.random = inNewContext.random; | ||
module.exports.reduceRight = inNewContext.reduceRight; | ||
module.exports.repeat = inNewContext.repeat; | ||
module.exports.result = inNewContext.result; | ||
module.exports.runInContext = inNewContext.runInContext; | ||
module.exports.size = inNewContext.size; | ||
module.exports.snakeCase = inNewContext.snakeCase; | ||
module.exports.some = inNewContext.some; | ||
module.exports.sortedIndex = inNewContext.sortedIndex; | ||
module.exports.sortedLastIndex = inNewContext.sortedLastIndex; | ||
module.exports.startCase = inNewContext.startCase; | ||
module.exports.startsWith = inNewContext.startsWith; | ||
module.exports.sum = inNewContext.sum; | ||
module.exports.template = inNewContext.template; | ||
module.exports.trim = inNewContext.trim; | ||
module.exports.trimLeft = inNewContext.trimLeft; | ||
module.exports.trimRight = inNewContext.trimRight; | ||
module.exports.trunc = inNewContext.trunc; | ||
module.exports.unescape = inNewContext.unescape; | ||
module.exports.uniqueId = inNewContext.uniqueId; | ||
module.exports.words = inNewContext.words; | ||
module.exports.all = inNewContext.all; | ||
module.exports.any = inNewContext.any; | ||
module.exports.contains = inNewContext.contains; | ||
module.exports.eq = inNewContext.eq; | ||
module.exports.detect = inNewContext.detect; | ||
module.exports.findWhere = inNewContext.findWhere; | ||
module.exports.foldl = inNewContext.foldl; | ||
module.exports.foldr = inNewContext.foldr; | ||
module.exports.head = inNewContext.head; | ||
module.exports.include = inNewContext.include; | ||
module.exports.inject = inNewContext.inject; | ||
module.exports.first = inNewContext.first; | ||
module.exports.last = inNewContext.last; | ||
module.exports.sample = inNewContext.sample; | ||
module.exports.take = inNewContext.take; | ||
module.exports.head = inNewContext.head; | ||
module.exports.VERSION = inNewContext.VERSION; | ||
module.exports.walk = inNewContext.walk; | ||
module.exports.fix = inNewContext.fix; | ||
module.exports.unary = inNewContext.unary; | ||
module.exports.binary = inNewContext.binary; | ||
module.exports.ternary = inNewContext.ternary; | ||
module.exports.quaternary = inNewContext.quaternary; | ||
module.exports.rCurry = inNewContext.rCurry; | ||
module.exports.curry2 = inNewContext.curry2; | ||
module.exports.curry3 = inNewContext.curry3; | ||
module.exports.enforce = inNewContext.enforce; | ||
module.exports.fix = inNewContext.fix; | ||
module.exports.quaternary = inNewContext.quaternary; | ||
module.exports.rCurry = inNewContext.rCurry; | ||
module.exports.curryRight2 = inNewContext.curryRight2; | ||
module.exports.rcurry2 = inNewContext.rcurry2; | ||
module.exports.curryRight3 = inNewContext.curryRight3; | ||
module.exports.rcurry3 = inNewContext.rcurry3; | ||
module.exports.ternary = inNewContext.ternary; | ||
module.exports.unary = inNewContext.unary; | ||
module.exports.enforce = inNewContext.enforce; | ||
module.exports.arity = inNewContext.arity; | ||
module.exports.always = inNewContext.always; | ||
module.exports.pipeline = inNewContext.pipeline; | ||
module.exports.conjoin = inNewContext.conjoin; | ||
module.exports.disjoin = inNewContext.disjoin; | ||
module.exports.comparator = inNewContext.comparator; | ||
module.exports.complement = inNewContext.complement; | ||
module.exports.conjoin = inNewContext.conjoin; | ||
module.exports.disjoin = inNewContext.disjoin; | ||
module.exports.splat = inNewContext.splat; | ||
module.exports.unsplat = inNewContext.unsplat; | ||
module.exports.unsplatl = inNewContext.unsplatl; | ||
module.exports.mapArgs = inNewContext.mapArgs; | ||
module.exports.juxt = inNewContext.juxt; | ||
module.exports.fnull = inNewContext.fnull; | ||
module.exports.flip2 = inNewContext.flip2; | ||
module.exports.flip = inNewContext.flip; | ||
module.exports.flip2 = inNewContext.flip2; | ||
module.exports.fnull = inNewContext.fnull; | ||
module.exports.functionalize = inNewContext.functionalize; | ||
module.exports.juxt = inNewContext.juxt; | ||
module.exports.mapArgs = inNewContext.mapArgs; | ||
module.exports.methodize = inNewContext.methodize; | ||
module.exports.pipeline = inNewContext.pipeline; | ||
module.exports.splat = inNewContext.splat; | ||
module.exports.unsplat = inNewContext.unsplat; | ||
module.exports.unsplatl = inNewContext.unsplatl; | ||
module.exports.unsplatr = inNewContext.unsplatr; | ||
module.exports.mapArgsWith = inNewContext.mapArgsWith; | ||
module.exports.bound = inNewContext.bound; | ||
module.exports.attempt = inNewContext.attempt; | ||
module.exports.iterators = inNewContext.iterators; | ||
module.exports.isInstanceOf = inNewContext.isInstanceOf; | ||
module.exports.isAssociative = inNewContext.isAssociative; | ||
module.exports.isDecreasing = inNewContext.isDecreasing; | ||
module.exports.isIndexed = inNewContext.isIndexed; | ||
module.exports.isSequential = inNewContext.isSequential; | ||
module.exports.isZero = inNewContext.isZero; | ||
module.exports.isEven = inNewContext.isEven; | ||
module.exports.isFloat = inNewContext.isFloat; | ||
module.exports.isIncreasing = inNewContext.isIncreasing; | ||
module.exports.isIndexed = inNewContext.isIndexed; | ||
module.exports.isInstanceOf = inNewContext.isInstanceOf; | ||
module.exports.isInteger = inNewContext.isInteger; | ||
module.exports.isJSON = inNewContext.isJSON; | ||
module.exports.isNegative = inNewContext.isNegative; | ||
module.exports.isNumeric = inNewContext.isNumeric; | ||
module.exports.isOdd = inNewContext.isOdd; | ||
module.exports.isPositive = inNewContext.isPositive; | ||
module.exports.isSequential = inNewContext.isSequential; | ||
module.exports.isNegative = inNewContext.isNegative; | ||
module.exports.isValidDate = inNewContext.isValidDate; | ||
module.exports.isZero = inNewContext.isZero; | ||
module.exports.frequencies = inNewContext.frequencies; | ||
module.exports.isNumeric = inNewContext.isNumeric; | ||
module.exports.isInteger = inNewContext.isInteger; | ||
module.exports.isFloat = inNewContext.isFloat; | ||
module.exports.isJSON = inNewContext.isJSON; | ||
module.exports.isIncreasing = inNewContext.isIncreasing; | ||
module.exports.isDecreasing = inNewContext.isDecreasing; | ||
module.exports.renameKeys = inNewContext.renameKeys; | ||
module.exports.setPath = inNewContext.setPath; | ||
module.exports.snapshot = inNewContext.snapshot; | ||
module.exports.updatePath = inNewContext.updatePath; | ||
module.exports.setPath = inNewContext.setPath; | ||
module.exports.frequencies = inNewContext.frequencies; | ||
module.exports.accessor = inNewContext.accessor; | ||
module.exports.dictionary = inNewContext.dictionary; | ||
module.exports.selectKeys = inNewContext.selectKeys; | ||
module.exports.kv = inNewContext.kv; | ||
module.exports.getPath = inNewContext.getPath; | ||
module.exports.hasPath = inNewContext.hasPath; | ||
module.exports.kv = inNewContext.kv; | ||
module.exports.pickWhen = inNewContext.pickWhen; | ||
module.exports.omitWhen = inNewContext.omitWhen; | ||
module.exports.pickWhen = inNewContext.pickWhen; | ||
module.exports.selectKeys = inNewContext.selectKeys; | ||
module.exports.add = inNewContext.add; | ||
module.exports.bitwiseAnd = inNewContext.bitwiseAnd; | ||
module.exports.bitwiseLeft = inNewContext.bitwiseLeft; | ||
module.exports.bitwiseNot = inNewContext.bitwiseNot; | ||
module.exports.bitwiseOr = inNewContext.bitwiseOr; | ||
module.exports.bitwiseRight = inNewContext.bitwiseRight; | ||
module.exports.bitwiseXor = inNewContext.bitwiseXor; | ||
module.exports.bitwiseZ = inNewContext.bitwiseZ; | ||
module.exports.dec = inNewContext.dec; | ||
module.exports.sub = inNewContext.sub; | ||
module.exports.mul = inNewContext.mul; | ||
module.exports.div = inNewContext.div; | ||
module.exports.eq = inNewContext.eq; | ||
module.exports.gt = inNewContext.gt; | ||
module.exports.gte = inNewContext.gte; | ||
module.exports.mod = inNewContext.mod; | ||
module.exports.inc = inNewContext.inc; | ||
module.exports.lt = inNewContext.lt; | ||
module.exports.lte = inNewContext.lte; | ||
module.exports.mod = inNewContext.mod; | ||
module.exports.mul = inNewContext.mul; | ||
module.exports.dec = inNewContext.dec; | ||
module.exports.neg = inNewContext.neg; | ||
module.exports.seq = inNewContext.seq; | ||
module.exports.neq = inNewContext.neq; | ||
module.exports.sneq = inNewContext.sneq; | ||
module.exports.not = inNewContext.not; | ||
module.exports.seq = inNewContext.seq; | ||
module.exports.sneq = inNewContext.sneq; | ||
module.exports.sub = inNewContext.sub; | ||
module.exports.camelCase = inNewContext.camelCase; | ||
module.exports.capitalize = inNewContext.capitalize; | ||
module.exports.bitwiseAnd = inNewContext.bitwiseAnd; | ||
module.exports.bitwiseOr = inNewContext.bitwiseOr; | ||
module.exports.bitwiseXor = inNewContext.bitwiseXor; | ||
module.exports.bitwiseNot = inNewContext.bitwiseNot; | ||
module.exports.bitwiseLeft = inNewContext.bitwiseLeft; | ||
module.exports.bitwiseRight = inNewContext.bitwiseRight; | ||
module.exports.bitwiseZ = inNewContext.bitwiseZ; | ||
module.exports.explode = inNewContext.explode; | ||
module.exports.fromQuery = inNewContext.fromQuery; | ||
module.exports.humanize = inNewContext.humanize; | ||
module.exports.implode = inNewContext.implode; | ||
module.exports.toDash = inNewContext.toDash; | ||
module.exports.toQuery = inNewContext.toQuery; | ||
module.exports.strContains = inNewContext.strContains; | ||
module.exports.titleCase = inNewContext.titleCase; | ||
module.exports.slugify = inNewContext.slugify; | ||
module.exports.regexEscape = inNewContext.regexEscape; | ||
module.exports.slugify = inNewContext.slugify; | ||
module.exports.snakeCase = inNewContext.snakeCase; | ||
module.exports.strContains = inNewContext.strContains; | ||
module.exports.humanize = inNewContext.humanize; | ||
module.exports.stripTags = inNewContext.stripTags; | ||
module.exports.titleCase = inNewContext.titleCase; | ||
module.exports.toDash = inNewContext.toDash; | ||
module.exports.toQuery = inNewContext.toQuery; | ||
module.exports.done = inNewContext.done; | ||
module.exports.trampoline = inNewContext.trampoline; | ||
module.exports.cat = inNewContext.cat; | ||
module.exports.chunk = inNewContext.chunk; | ||
module.exports.cons = inNewContext.cons; | ||
module.exports.chunkAll = inNewContext.chunkAll; | ||
module.exports.collate = inNewContext.collate; | ||
module.exports.cons = inNewContext.cons; | ||
module.exports.mapcat = inNewContext.mapcat; | ||
module.exports.interpose = inNewContext.interpose; | ||
module.exports.weave = inNewContext.weave; | ||
module.exports.cycle = inNewContext.cycle; | ||
module.exports.interpose = inNewContext.interpose; | ||
module.exports.splitAt = inNewContext.splitAt; | ||
module.exports.iterateUntil = inNewContext.iterateUntil; | ||
module.exports.takeSkipping = inNewContext.takeSkipping; | ||
module.exports.reductions = inNewContext.reductions; | ||
module.exports.keepIndexed = inNewContext.keepIndexed; | ||
module.exports.mapcat = inNewContext.mapcat; | ||
module.exports.reductions = inNewContext.reductions; | ||
module.exports.repeat = inNewContext.repeat; | ||
module.exports.reverseOrder = inNewContext.reverseOrder; | ||
module.exports.splitAt = inNewContext.splitAt; | ||
module.exports.takeSkipping = inNewContext.takeSkipping; | ||
module.exports.weave = inNewContext.weave; | ||
module.exports.collate = inNewContext.collate; | ||
module.exports.second = inNewContext.second; | ||
module.exports.third = inNewContext.third; | ||
module.exports.nth = inNewContext.nth; | ||
module.exports.nths = inNewContext.nths; | ||
module.exports.valuesAt = inNewContext.valuesAt; | ||
module.exports.binPick = inNewContext.binPick; | ||
module.exports.splitWith = inNewContext.splitWith; | ||
module.exports.partitionBy = inNewContext.partitionBy; | ||
module.exports.best = inNewContext.best; | ||
module.exports.dropWhile = inNewContext.dropWhile; | ||
module.exports.keep = inNewContext.keep; | ||
module.exports.nth = inNewContext.nth; | ||
module.exports.partitionBy = inNewContext.partitionBy; | ||
module.exports.second = inNewContext.second; | ||
module.exports.splitWith = inNewContext.splitWith; | ||
module.exports.takeWhile = inNewContext.takeWhile; | ||
module.exports.third = inNewContext.third; | ||
module.exports.exists = inNewContext.exists; | ||
module.exports.truthy = inNewContext.truthy; | ||
module.exports.falsey = inNewContext.falsey; | ||
module.exports.existsAll = inNewContext.existsAll; | ||
module.exports.falsey = inNewContext.falsey; | ||
module.exports.truthyAll = inNewContext.truthyAll; | ||
module.exports.falseyAll = inNewContext.falseyAll; | ||
module.exports.firstExisting = inNewContext.firstExisting; | ||
module.exports.truthy = inNewContext.truthy; | ||
module.exports.truthyAll = inNewContext.truthyAll; |
{ | ||
"name": "lodash-contrib", | ||
"description": "The brass buckles on lodash's utility belt", | ||
"version": "241.4.14", | ||
"version": "393.0.1", | ||
"main": "lodash-contrib.js", | ||
"dependencies": { | ||
"lodash": "2.4.1" | ||
"lodash": "3.9.3" | ||
}, | ||
@@ -23,3 +23,3 @@ "devDependencies": { | ||
}, | ||
"repository": "Empeeric/lodash-contrib", | ||
"repository": "TheNodeILs/lodash-contrib", | ||
"license": "MIT", | ||
@@ -34,4 +34,4 @@ "author": "Refael Ackermann <refael@empeeric.com> (http://www.empeeric.com)", | ||
"dist": "grunt dist", | ||
"mypublish": "npm run dist && npm version patch && npm publish && git push --follow-tags" | ||
"mypublish": "npm run dist && npm version patch && git push --follow-tags" | ||
} | ||
} |
@@ -7,3 +7,3 @@ The brass buckles on lodash's utility belt | ||
============== | ||
[![Build Status](https://travis-ci.org/Empeeric/lodash-contrib.png?branch=master)](https://travis-ci.org/Empeeric/lodash-contrib) | ||
[![Build Status](https://travis-ci.org/TheNodeILs/lodash-contrib.png?branch=master)](https://travis-ci.org/TheNodeILs/lodash-contrib) | ||
@@ -13,3 +13,3 @@ Links | ||
* [Documentation](http://empeeric.github.io/lodash-contrib/) | ||
* [Documentation](https://github.com/TheNodeILs/lodash-contrib/blob/master/docs/index.md) | ||
* [Source repository](https://github.com/Empeeric/lodash-contrib) | ||
@@ -32,5 +32,5 @@ * [Tickets and bug reports](https://github.com/Empeeric/lodash-contrib/issues?state=open) | ||
First, you’ll need lodash. Then you can grab the relevant lodash-contrib libraries and simply add | ||
something | ||
like the following to your pages: | ||
####Web | ||
First, you’ll need lodash. Then you can grab the relevant lodash-contrib libraries and simply add something like the following to your pages: | ||
```html | ||
@@ -41,2 +41,18 @@ <script src="lodash.js"></script> | ||
You could also use [browserify](http://browserify.org/) to bundle your code into a JavaScript file that you can include in a web page. | ||
Require `lodash-contrib` in your main script file (e.g. `test.js`) like so: | ||
```javascript | ||
var _ = require('lodash-contrib'); | ||
// YOUR CODE COMES HERE | ||
console.log(_.truthyAll(0, 1, 2, 'lodash-contrib!')); | ||
``` | ||
then you could run `browserify test.js -o browserified.js` to get `lodash`, `lodash-contrib` and your code into `browserified.js`. | ||
####Node | ||
Just run `npm install lodash-contrib`, you don't need to have lodash as it will be grabbed as a dependency. | ||
At the moment there are no cross-contrib dependencies (i.e. each library can stand by itself), but that may | ||
@@ -43,0 +59,0 @@ change in the future. |
@@ -76,3 +76,31 @@ $(document).ready(function() { | ||
}); | ||
test("nths", function() { | ||
var a = ['a','b','c', 'd']; | ||
deepEqual(_.nths(a,1), ['b'], 'should return the element at a given index into an array'); | ||
deepEqual(_.nths(a,1,3), ['b', 'd'], 'should return the elements at given indices into an array'); | ||
deepEqual(_.nths(a,1,5,3), ['b', undefined, 'd'], 'should return undefined if out of bounds'); | ||
deepEqual(_.nths(a,[1]), ['b'], 'should return the element at a given index into an array'); | ||
deepEqual(_.nths(a,[1,3]), ['b', 'd'], 'should return the elements at given indices into an array'); | ||
deepEqual(_.nths(a,[1,5,3]), ['b', undefined, 'd'], 'should return undefined if out of bounds'); | ||
}); | ||
test("valuesAt", function() { | ||
equal(_.valuesAt, _.nths, 'valuesAt should be alias for nths'); | ||
}); | ||
test("binPick", function() { | ||
var a = ['a','b','c', 'd']; | ||
deepEqual(_.binPick(a, false, true), ['b'], 'should return the element at a given index into an array'); | ||
deepEqual(_.binPick(a, false, true, false, true), ['b', 'd'], 'should return the elements at given indices into an array'); | ||
deepEqual(_.binPick(a, false, true, false, true, true), ['b', 'd', undefined], 'should return undefined if out of bounds'); | ||
deepEqual(_.binPick(a, [false, true]), ['b'], 'should return the element at a given index into an array'); | ||
deepEqual(_.binPick(a, [false, true, false, true]), ['b', 'd'], 'should return the elements at given indices into an array'); | ||
deepEqual(_.binPick(a, [false, true, false, true, true]), ['b', 'd', undefined], 'should return undefined if out of bounds'); | ||
}); | ||
}); | ||
@@ -70,3 +70,3 @@ $(document).ready(function() { | ||
curried = _.curry(func), | ||
rCurried = _.rCurry(func); | ||
rCurried = _.curryRight(func); | ||
@@ -104,3 +104,3 @@ equal(func(1, 2, 3), 6, "Test pure function"); | ||
test("rcurry2", function () { | ||
test("curryRight2", function () { | ||
@@ -110,4 +110,4 @@ function echo () { return [].slice.call(arguments, 0); } | ||
deepEqual(echo(1, 2), [1, 2], "Control test"); | ||
deepEqual(_.rcurry2(echo)(1)(2), [2, 1], "Reverses curried arguments"); | ||
deepEqual(_.curryRight2(echo)(1)(2), [2, 1], "Reverses curried arguments"); | ||
equal(_.curryRight2, _.rcurry2, "should have alias 'rcurry2'"); | ||
}); | ||
@@ -124,3 +124,3 @@ | ||
test("rcurry3", function () { | ||
test("curryRight3", function () { | ||
@@ -130,4 +130,4 @@ function echo () { return [].slice.call(arguments, 0); } | ||
deepEqual(echo(1, 2, 3), [1, 2, 3], "Control test"); | ||
deepEqual(_.rcurry3(echo)(1)(2)(3), [3, 2, 1], "Reverses curried arguments"); | ||
deepEqual(_.curryRight3(echo)(1)(2)(3), [3, 2, 1], "Reverses curried arguments"); | ||
equal(_.curryRight3, _.rcurry3, "should have alias 'rcurry3'"); | ||
}); | ||
@@ -134,0 +134,0 @@ |
@@ -6,7 +6,33 @@ var _ = require('../..'); | ||
describe("weave", function () { | ||
var a = [1, 2, 3]; | ||
var b = [1, 2]; | ||
var c = ['a', 'b', 'c']; | ||
var d = [1, [2]]; | ||
it('should weave zero arrays', function (done) { | ||
assert.deepEqual(_.weave(), []); | ||
done(); | ||
}); | ||
it("should weave one array", function (done) { | ||
assert.deepEqual(_.weave([1,[2]]), [1,[2]], 'should weave one array'); | ||
assert.deepEqual(_.weave([]), []); | ||
assert.deepEqual(_.weave([1,[2]]), [1,[2]]); | ||
done(); | ||
}); | ||
it("should weave two arrays", function (done) { | ||
assert.deepEqual(_.weave(a, b), [1, 1, 2, 2, 3]); | ||
assert.deepEqual(_.weave(a, b), [1, 1, 2, 2, 3]); | ||
assert.deepEqual(_.weave(a, a), [1, 1, 2, 2, 3, 3]); | ||
assert.deepEqual(_.weave(c, a), ['a', 1, 'b', 2, 'c', 3]); | ||
assert.deepEqual(_.weave(a, d), [1, 1, 2, [2], 3]); | ||
done(); | ||
}); | ||
it("should weave more than two arrays", function (done) { | ||
assert.deepEqual(_.weave(a, b, c), [1, 1, 'a', 2, 2, 'b', 3, 'c']); | ||
assert.deepEqual(_.weave(a, b, c, d), [1, 1, 'a', 1, 2, 2, 'b', [2], 3, 'c']); | ||
done(); | ||
}); | ||
}); | ||
}); |
// JSLitmus.js | ||
// | ||
// History: | ||
// 2008-10-27: Initial release | ||
// 2008-11-09: Account for iteration loop overhead | ||
// 2008-11-13: Added OS detection | ||
// 2009-02-25: Create tinyURL automatically, shift-click runs tests in reverse | ||
// | ||
// Copyright (c) 2008-2009, Robert Kieffer | ||
// All Rights Reserved | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the | ||
// Software), to deal in the Software without restriction, including | ||
// without limitation the rights to use, copy, modify, merge, publish, | ||
// distribute, sublicense, and/or sell copies of the Software, and to permit | ||
// persons to whom the Software is furnished to do so, subject to the | ||
// following conditions: | ||
// | ||
// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, | ||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN | ||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | ||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
// USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
// Copyright (c) 2010, Robert Kieffer, http://broofa.com | ||
// Available under MIT license (http://en.wikipedia.org/wiki/MIT_License) | ||
@@ -132,3 +110,3 @@ (function() { | ||
* JSLitmus.test()) | ||
* | ||
* | ||
* @private | ||
@@ -138,3 +116,3 @@ */ | ||
if (!f) throw new Error('Undefined test function'); | ||
if (!(/function[^\(]*\(([^,\)]*)/).test(f.toString())) { | ||
if (!/function[^\(]*\(([^,\)]*)/.test(f.toString())) { | ||
throw new Error('"' + name + '" test: Test is not a valid Function object'); | ||
@@ -146,3 +124,3 @@ } | ||
}; | ||
jsl.extend(Test, /** @lends Test */ { | ||
@@ -161,3 +139,3 @@ /** Calibration tests for establishing iteration loop overhead */ | ||
calibrate: function(onCalibrated) { | ||
for (var i = 0; i < Test.CALIBRATIONS.length; i++) { | ||
for (var i = 0; i < Test.CALIBRATIONS.length; i++) { | ||
var cal = Test.CALIBRATIONS[i]; | ||
@@ -279,3 +257,3 @@ if (cal.running) return true; | ||
* Get the number of operations per second for this test. | ||
* | ||
* | ||
* @param normalize if true, iteration loop overhead taken into account | ||
@@ -524,3 +502,3 @@ */ | ||
cns.push('test_error'); | ||
cell.innerHTML = | ||
cell.innerHTML = | ||
'<div class="error_head">' + test.error + '</div>' + | ||
@@ -541,2 +519,3 @@ '<ul class="error_body"><li>' + | ||
cell.innerHTML = hz != Infinity ? hz : '∞'; | ||
cell.title = 'Looped ' + test.count + ' times in ' + test.time + ' seconds'; | ||
} else { | ||
@@ -673,6 +652,6 @@ cell.innerHTML = 'ready'; | ||
return 'http://chart.apis.google.com/chart?' + jsl.join(params, '=', '&'); | ||
} | ||
} | ||
}; | ||
JSLitmus._init(); | ||
})(); | ||
})(); |
@@ -0,1 +1,2 @@ | ||
//https://github.com/jonkemp/qunit-phantomjs-runner | ||
/* | ||
@@ -17,112 +18,150 @@ * QtWebKit-powered headless test runner using PhantomJS | ||
(function() { | ||
'use strict'; | ||
(function () { | ||
'use strict'; | ||
var args = require('system').args; | ||
var url, page, timeout, | ||
args = require('system').args; | ||
// arg[0]: scriptName, args[1...]: arguments | ||
if (args.length !== 2) { | ||
console.error('Usage:\n phantomjs runner.js [url-of-your-qunit-testsuite]'); | ||
phantom.exit(1); | ||
} | ||
// arg[0]: scriptName, args[1...]: arguments | ||
if (args.length < 2) { | ||
console.error('Usage:\n phantomjs [phantom arguments] runner.js [url-of-your-qunit-testsuite] [timeout-in-seconds]'); | ||
exit(1); | ||
} | ||
var url = args[1], | ||
page = require('webpage').create(); | ||
url = args[1]; | ||
// Route `console.log()` calls from within the Page context to the main Phantom context (i.e. current `this`) | ||
page.onConsoleMessage = function(msg) { | ||
console.log(msg); | ||
}; | ||
if (args[2] !== undefined) { | ||
timeout = parseInt(args[2], 10); | ||
} | ||
page.onInitialized = function() { | ||
page.evaluate(addLogging); | ||
}; | ||
page = require('webpage').create(); | ||
page.onCallback = function(message) { | ||
var result, | ||
failed; | ||
// Route `console.log()` calls from within the Page context to the main Phantom context (i.e. current `this`) | ||
page.onConsoleMessage = function (msg) { | ||
console.log(msg); | ||
}; | ||
if (message) { | ||
if (message.name === 'QUnit.done') { | ||
result = message.data; | ||
failed = !result || result.failed; | ||
page.onInitialized = function () { | ||
page.evaluate(addLogging); | ||
}; | ||
phantom.exit(failed ? 1 : 0); | ||
} | ||
} | ||
}; | ||
page.onCallback = function (message) { | ||
var result, | ||
failed; | ||
page.open(url, function(status) { | ||
if (status !== 'success') { | ||
console.error('Unable to access network: ' + status); | ||
phantom.exit(1); | ||
} else { | ||
// Cannot do this verification with the 'DOMContentLoaded' handler because it | ||
// will be too late to attach it if a page does not have any script tags. | ||
var qunitMissing = page.evaluate(function() { return (typeof QUnit === 'undefined' || !QUnit); }); | ||
if (qunitMissing) { | ||
console.error('The `QUnit` object is not present on this page.'); | ||
phantom.exit(1); | ||
} | ||
if (message) { | ||
if (message.name === 'QUnit.done') { | ||
result = message.data; | ||
failed = !result || !result.total || result.failed; | ||
// Do nothing... the callback mechanism will handle everything! | ||
} | ||
}); | ||
if (!result.total) { | ||
console.error('No tests were executed. Are you loading tests asynchronously?'); | ||
} | ||
function addLogging() { | ||
window.document.addEventListener('DOMContentLoaded', function() { | ||
var current_test_assertions = []; | ||
exit(failed ? 1 : 0); | ||
} | ||
} | ||
}; | ||
QUnit.log(function(details) { | ||
var response; | ||
page.open(url, function (status) { | ||
if (status !== 'success') { | ||
console.error('Unable to access network: ' + status); | ||
exit(1); | ||
} else { | ||
// Cannot do this verification with the 'DOMContentLoaded' handler because it | ||
// will be too late to attach it if a page does not have any script tags. | ||
var qunitMissing = page.evaluate(function () { | ||
return (typeof QUnit === 'undefined' || !QUnit); | ||
}); | ||
if (qunitMissing) { | ||
console.error('The `QUnit` object is not present on this page.'); | ||
exit(1); | ||
} | ||
// Ignore passing assertions | ||
if (details.result) { | ||
return; | ||
} | ||
// Set a default timeout value if the user does not provide one | ||
if (typeof timeout === 'undefined') { | ||
timeout = 5; | ||
} | ||
response = details.message || ''; | ||
// Set a timeout on the test running, otherwise tests with async problems will hang forever | ||
setTimeout(function () { | ||
console.error('The specified timeout of ' + timeout + ' seconds has expired. Aborting...'); | ||
exit(1); | ||
}, timeout * 1000); | ||
if (typeof details.expected !== 'undefined') { | ||
if (response) { | ||
response += ', '; | ||
} | ||
// Do nothing... the callback mechanism will handle everything! | ||
} | ||
}); | ||
response += 'expected: ' + details.expected + ', but was: ' + details.actual; | ||
if (details.source) { | ||
response += "\n" + details.source; | ||
} | ||
} | ||
function addLogging() { | ||
window.document.addEventListener('DOMContentLoaded', function () { | ||
var currentTestAssertions = []; | ||
current_test_assertions.push('Failed assertion: ' + response); | ||
}); | ||
QUnit.log(function (details) { | ||
var response; | ||
QUnit.testDone(function(result) { | ||
var i, | ||
len, | ||
name = result.module + ': ' + result.name; | ||
// Ignore passing assertions | ||
if (details.result) { | ||
return; | ||
} | ||
if (result.failed) { | ||
console.log('Test failed: ' + name); | ||
response = details.message || ''; | ||
for (i = 0, len = current_test_assertions.length; i < len; i++) { | ||
console.log(' ' + current_test_assertions[i]); | ||
} | ||
} | ||
if (typeof details.expected !== 'undefined') { | ||
if (response) { | ||
response += ', '; | ||
} | ||
current_test_assertions.length = 0; | ||
}); | ||
response += 'expected: ' + details.expected + ', but was: ' + details.actual; | ||
} | ||
QUnit.done(function(result) { | ||
console.log('Took ' + result.runtime + 'ms to run ' + result.total + ' tests. ' + result.passed + ' passed, ' + result.failed + ' failed.'); | ||
if (details.source) { | ||
response += '\n' + details.source; | ||
} | ||
if (typeof window.callPhantom === 'function') { | ||
window.callPhantom({ | ||
'name': 'QUnit.done', | ||
'data': result | ||
}); | ||
} | ||
}); | ||
}, false); | ||
} | ||
currentTestAssertions.push('Failed assertion: ' + response); | ||
}); | ||
QUnit.testDone(function (result) { | ||
var i, | ||
len, | ||
name = ''; | ||
if (result.module) { | ||
name += result.module + ': '; | ||
} | ||
name += result.name; | ||
if (result.failed) { | ||
console.log('\n' + 'Test failed: ' + name); | ||
for (i = 0, len = currentTestAssertions.length; i < len; i++) { | ||
console.log(' ' + currentTestAssertions[i]); | ||
} | ||
} | ||
currentTestAssertions.length = 0; | ||
}); | ||
QUnit.done(function (result) { | ||
console.log('\n' + 'Took ' + result.runtime + 'ms to run ' + result.total + ' tests. ' + result.passed + ' passed, ' + result.failed + ' failed.'); | ||
if (typeof window.callPhantom === 'function') { | ||
window.callPhantom({ | ||
'name': 'QUnit.done', | ||
'data': result | ||
}); | ||
} | ||
}); | ||
}, false); | ||
} | ||
function exit(code) { | ||
if (page) { | ||
page.close(); | ||
} | ||
setTimeout(function () { | ||
phantom.exit(code); | ||
}, 0); | ||
} | ||
})(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
1793133
95
36080
80
+ Addedlodash@3.9.3(transitive)
- Removedlodash@2.4.1(transitive)
Updatedlodash@3.9.3