Comparing version 1.5.1 to 1.5.2
{ | ||
"name": "valentine" | ||
, "description": "JavaScripts Functional Sister. Utilitiy, Iterators, type checking" | ||
, "version": "1.5.1" | ||
, "version": "1.5.2" | ||
, "homepage": "https://github.com/ded/valentine" | ||
@@ -6,0 +6,0 @@ , "author": "Dustin Diaz <dustin@dustindiaz.com> (http://dustindiaz.com)" |
@@ -5,3 +5,3 @@ \ / _. | _ ._ _|_ o ._ _ | ||
[![Build Status](https://secure.travis-ci.org/ded/valentine.png)](http://travis-ci.org/ded/valentine) | ||
JavaScript's Sister, and protector — providing you with type checking, functional iterators, and common utility helpers; utilizing native JavaScript methods (when available) for optimal speed. | ||
JavaScript's Sister, and protector — inspired by Underscore; Valentine provides you with type checking, functional iterators, and common utility helpers such as waterfalls, queues, and parallels; all utilizing native JavaScript methods (when available) for optimal speed. | ||
@@ -26,7 +26,7 @@ Browser usage: | ||
``` js | ||
var v = require('valentine'); | ||
var v = require('valentine') | ||
// showcase object style | ||
v(['a', 'b', 'c']).map(function (letter) { | ||
return letter.toUpperCase(); | ||
return letter.toUpperCase() | ||
}).join(' '); // => 'A B C' | ||
@@ -224,3 +224,3 @@ ``` | ||
$ npm install --dev | ||
$ npm install -d | ||
$ make | ||
@@ -227,0 +227,0 @@ $ make test |
@@ -10,3 +10,3 @@ !function (name, definition) { | ||
, ap = [] | ||
, op = {} | ||
, hasOwn = Object.prototype.hasOwnProperty | ||
, n = null | ||
@@ -265,3 +265,3 @@ , slice = ap.slice | ||
, args: function (a) { | ||
return !!(a && op.hasOwnProperty.call(a, 'callee')) | ||
return !!(a && hasOwn.call(a, 'callee')) | ||
} | ||
@@ -316,3 +316,3 @@ | ||
for (var k in a) { | ||
op.hasOwnProperty.call(a, k) && fn.call(scope, k, a[k], a) | ||
hasOwn.call(a, k) && fn.call(scope, k, a[k], a) | ||
} | ||
@@ -327,3 +327,3 @@ }()) | ||
for (var k in a) { | ||
op.hasOwnProperty.call(a, k) && (r[i++] = fn.call(scope, k, a[k], a)) | ||
hasOwn.call(a, k) && (r[i++] = fn.call(scope, k, a[k], a)) | ||
} | ||
@@ -371,3 +371,3 @@ }() && r | ||
var keys = [], key | ||
for (key in obj) if (op.hasOwnProperty.call(obj, key)) keys[keys.length] = key | ||
for (key in obj) if (hasOwn.call(obj, key)) keys[keys.length] = key | ||
return keys | ||
@@ -374,0 +374,0 @@ } |
@@ -17,3 +17,3 @@ /*! | ||
, ap = [] | ||
, op = {} | ||
, hasOwn = Object.prototype.hasOwnProperty | ||
, n = null | ||
@@ -272,3 +272,3 @@ , slice = ap.slice | ||
, args: function (a) { | ||
return !!(a && op.hasOwnProperty.call(a, 'callee')) | ||
return !!(a && hasOwn.call(a, 'callee')) | ||
} | ||
@@ -323,3 +323,3 @@ | ||
for (var k in a) { | ||
op.hasOwnProperty.call(a, k) && fn.call(scope, k, a[k], a) | ||
hasOwn.call(a, k) && fn.call(scope, k, a[k], a) | ||
} | ||
@@ -334,3 +334,3 @@ }()) | ||
for (var k in a) { | ||
op.hasOwnProperty.call(a, k) && (r[i++] = fn.call(scope, k, a[k], a)) | ||
hasOwn.call(a, k) && (r[i++] = fn.call(scope, k, a[k], a)) | ||
} | ||
@@ -378,3 +378,3 @@ }() && r | ||
var keys = [], key | ||
for (key in obj) if (op.hasOwnProperty.call(obj, key)) keys[keys.length] = key | ||
for (key in obj) if (hasOwn.call(obj, key)) keys[keys.length] = key | ||
return keys | ||
@@ -381,0 +381,0 @@ } |
@@ -7,2 +7,2 @@ /*! | ||
*/ | ||
!function(a,b){typeof module!="undefined"?module.exports=b():typeof define=="function"?define(b):this[a]=this.v=b()}("valentine",function(){function n(a){this.values=a,this.index=0}function o(a,b){return new q(a,b)}function p(a,b){for(var c in b)a[c]=b[c]}function q(a,b){this.val=a,this._scope=b||e,this._chained=0}var a=this,b=a.v,c=[],d={},e=null,f=c.slice,g="map"in c,h="reduce"in c,i=/(^\s*|\s*$)/g,j={each:g?function(a,b,d){c.forEach.call(a,b,d)}:function(a,b,c){for(var d=0,e=a.length;d<e;d++)d in a&&b.call(c,a[d],d,a)},map:g?function(a,b,d){return c.map.call(a,b,d)}:function(a,b,c){var d=[],e;for(e=0,l=a.length;e<l;e++)e in a&&(d[e]=b.call(c,a[e],e,a));return d},some:g?function(a,b,c){return a.some(b,c)}:function(a,b,c){for(var d=0,e=a.length;d<e;d++)if(d in a&&b.call(c,a[d],d,a))return!0;return!1},every:g?function(a,b,c){return a.every(b,c)}:function(a,b,c){for(var d=0,e=a.length;d<e;d++)if(d in a&&!b.call(c,a[d],d,a))return!1;return!0},filter:g?function(a,b,c){return a.filter(b,c)}:function(a,b,c){for(var d=[],e=0,f=0,g=a.length;e<g;e++)if(e in a){if(!b.call(c,a[e],e,a))continue;d[f++]=a[e]}return d},indexOf:g?function(a,b,c){return a.indexOf(b,isFinite(c)?c:0)}:function(a,b,c){c=c||0;for(var d=0;d<a.length;d++)if(d in a&&a[d]===b)return d;return-1},lastIndexOf:g?function(a,b,c){return a.lastIndexOf(b,isFinite(c)?c:a.length)}:function(a,b,c){c=c||a.length,c=c>=a.length?a.length:c<0?a.length+c:c;for(var d=c;d>=0;--d)if(d in a&&a[d]===b)return d;return-1},reduce:h?function(a,b,d,e){return c.reduce.call(a,b,d,e)}:function(a,b,c,d){a||(a=[]);var e=0,f=a.length;if(arguments.length<3)do{if(e in a){c=a[e++];break}if(++e>=f)throw new TypeError("Empty array")}while(1);for(;e<f;e++)e in a&&(c=b.call(d,c,a[e],e,a));return c},reduceRight:h?function(a,b,d,e){return c.reduceRight.call(a,b,d,e)}:function(a,b,c,d){!a&&(a=[]);var e=a.length,f=e-1;if(arguments.length<3)do{if(f in a){c=a[f--];break}if(--f<0)throw new TypeError("Empty array")}while(1);for(;f>=0;f--)f in a&&(c=b.call(d,c,a[f],f,a));return c},find:function(a,b,c){var d;return j.some(a,function(a,e,f){if(b.call(c,a,e,f))return d=a,!0}),d},reject:function(a,b,c){var d=[];for(var e=0,f=0,g=a.length;e<g;e++)if(e in a){if(b.call(c,a[e],e,a))continue;d[f++]=a[e]}return d},size:function(a){return m.toArray(a).length},compact:function(a){return j.filter(a,function(a){return!!a})},flatten:function(a){return j.reduce(a,function(a,b){return k.arr(b)?a.concat(j.flatten(b)):(a[a.length]=b,a)},[])},uniq:function(a){var b=[],c,d;a:for(c=0;c<a.length;c++){for(d=0;d<b.length;d++)if(b[d]==a[c])continue a;b[b.length]=a[c]}return b},merge:function(a,b){var c=a.length,d=0,e;if(isFinite(b.length))for(e=b.length;d<e;d++)a[c++]=b[d];else while(b[d]!==undefined)first[c++]=second[d++];return a.length=c,a},inArray:function(a,b){return!!~j.indexOf(a,b)}},k={fun:function(a){return typeof a=="function"},str:function(a){return typeof a=="string"},ele:function(a){return!!a&&!!a.nodeType&&a.nodeType==1},arr:function(a){return a instanceof Array},arrLike:function(a){return a&&a.length&&isFinite(a.length)},num:function(a){return typeof a=="number"},bool:function(a){return a===!0||a===!1},args:function(a){return!!a&&!!d.hasOwnProperty.call(a,"callee")},emp:function(a){var b=0;return k.arr(a)?a.length===0:k.obj(a)?function(){for(var c in a){b++;break}return b===0}():a===""},dat:function(a){return!!(a&&a.getTimezoneOffset&&a.setUTCFullYear)},reg:function(a){return!(!(a&&a.test&&a.exec)||!a.ignoreCase&&a.ignoreCase!==!1)},nan:function(a){return a!==a},nil:function(a){return a===e},und:function(a){return typeof a=="undefined"},def:function(a){return typeof a!="undefined"},obj:function(a){return a instanceof Object&&!k.fun(a)&&!k.arr(a)}},m={each:function(a,b,c){k.arrLike(a)?j.each(a,b,c):function(){for(var e in a)d.hasOwnProperty.call(a,e)&&b.call(c,e,a[e],a)}()},map:function(a,b,c){var e=[],f=0;return k.arrLike(a)?j.map(a,b,c):!function(){for(var g in a)d.hasOwnProperty.call(a,g)&&(e[f++]=b.call(c,g,a[g],a))}()&&e},pluck:function(a,b){return k.arrLike(a)?j.map(a,function(a){return a[b]}):m.map(a,function(a,c){return c[b]})},toArray:function(a){return a?k.arr(a)?a:a.toArray?a.toArray():k.args(a)?f.call(a):j.map(a,function(a){return a}):[]},first:function(a){return a[0]},last:function(a){return a[a.length-1]},keys:Object.keys?function(a){return Object.keys(a)}:function(a){var b=[],c;for(c in a)d.hasOwnProperty.call(a,c)&&(b[b.length]=c);return b},values:function(a){return m.map(a,function(a,b){return b})},extend:function(){var a,b,c,d,f,g=arguments[0],h=1,i=arguments.length;for(;h<i;h++)if((a=arguments[h])!==e)for(b in a){c=g[b],d=a[b];if(g===d)continue;d&&k.obj(d)?(f=c&&k.obj(c)?c:{},g[b]=m.extend(f,d)):d!==undefined&&(g[b]=d)}return g},trim:String.prototype.trim?function(a){return a.trim()}:function(a){return a.replace(i,"")},bind:function(a,b){var c=arguments.length>2?f.call(arguments,2):null;return function(){return b.apply(a,c?c.concat(f.call(arguments)):arguments)}},curry:function(a){if(arguments.length==1)return a;var b=f.call(arguments,1);return function(){return a.apply(null,b.concat(f.call(arguments)))}},parallel:function(a,b){var c=m.toArray(arguments),d=0,f=[],g=[];k.arr(a)||(b=c.pop(),a=c),j.each(a,function(c,h){c(function(){var c=m.toArray(arguments),i=c.shift();if(i)return b(i);f[h]=c,a.length==++d&&(f.unshift(e),j.each(f,function(a){g=g.concat(a)}),b.apply(e,g))})})},waterfall:function(a,b){var c=m.toArray(arguments),d=0;k.arr(a)||(b=c.pop(),a=c),function f(){var c=m.toArray(arguments);c.push(f);var d=c.shift();!d&&a.length?a.shift().apply(e,c):(c.pop(),c.unshift(d),b.apply(e,c))}(e)},queue:function(a){return new n(k.arrLike(a)?a:m.toArray(arguments))}};return n.prototype.next=function(){return this.index<this.values.length&&this.values[this.index++](),this},p(o,j),p(o,m),o.is=k,o.v=o,o.each(o.extend({},j,m),function(a,b){q.prototype[a]=function(){var a=o.toArray(arguments);a.unshift(this.val);var c=b.apply(this._scope,a);return this.val=c,this._chained?this:c}}),p(q.prototype,{chain:function(){return this._chained=1,this},value:function(){return this.val}}),o.noConflict=function(){return a.v=b,this},o}) | ||
!function(a,b){typeof module!="undefined"?module.exports=b():typeof define=="function"?define(b):this[a]=this.v=b()}("valentine",function(){function n(a){this.values=a,this.index=0}function o(a,b){return new q(a,b)}function p(a,b){for(var c in b)a[c]=b[c]}function q(a,b){this.val=a,this._scope=b||e,this._chained=0}var a=this,b=a.v,c=[],d=Object.prototype.hasOwnProperty,e=null,f=c.slice,g="map"in c,h="reduce"in c,i=/(^\s*|\s*$)/g,j={each:g?function(a,b,d){c.forEach.call(a,b,d)}:function(a,b,c){for(var d=0,e=a.length;d<e;d++)d in a&&b.call(c,a[d],d,a)},map:g?function(a,b,d){return c.map.call(a,b,d)}:function(a,b,c){var d=[],e;for(e=0,l=a.length;e<l;e++)e in a&&(d[e]=b.call(c,a[e],e,a));return d},some:g?function(a,b,c){return a.some(b,c)}:function(a,b,c){for(var d=0,e=a.length;d<e;d++)if(d in a&&b.call(c,a[d],d,a))return!0;return!1},every:g?function(a,b,c){return a.every(b,c)}:function(a,b,c){for(var d=0,e=a.length;d<e;d++)if(d in a&&!b.call(c,a[d],d,a))return!1;return!0},filter:g?function(a,b,c){return a.filter(b,c)}:function(a,b,c){for(var d=[],e=0,f=0,g=a.length;e<g;e++)if(e in a){if(!b.call(c,a[e],e,a))continue;d[f++]=a[e]}return d},indexOf:g?function(a,b,c){return a.indexOf(b,isFinite(c)?c:0)}:function(a,b,c){c=c||0;for(var d=0;d<a.length;d++)if(d in a&&a[d]===b)return d;return-1},lastIndexOf:g?function(a,b,c){return a.lastIndexOf(b,isFinite(c)?c:a.length)}:function(a,b,c){c=c||a.length,c=c>=a.length?a.length:c<0?a.length+c:c;for(var d=c;d>=0;--d)if(d in a&&a[d]===b)return d;return-1},reduce:h?function(a,b,d,e){return c.reduce.call(a,b,d,e)}:function(a,b,c,d){a||(a=[]);var e=0,f=a.length;if(arguments.length<3)do{if(e in a){c=a[e++];break}if(++e>=f)throw new TypeError("Empty array")}while(1);for(;e<f;e++)e in a&&(c=b.call(d,c,a[e],e,a));return c},reduceRight:h?function(a,b,d,e){return c.reduceRight.call(a,b,d,e)}:function(a,b,c,d){!a&&(a=[]);var e=a.length,f=e-1;if(arguments.length<3)do{if(f in a){c=a[f--];break}if(--f<0)throw new TypeError("Empty array")}while(1);for(;f>=0;f--)f in a&&(c=b.call(d,c,a[f],f,a));return c},find:function(a,b,c){var d;return j.some(a,function(a,e,f){if(b.call(c,a,e,f))return d=a,!0}),d},reject:function(a,b,c){var d=[];for(var e=0,f=0,g=a.length;e<g;e++)if(e in a){if(b.call(c,a[e],e,a))continue;d[f++]=a[e]}return d},size:function(a){return m.toArray(a).length},compact:function(a){return j.filter(a,function(a){return!!a})},flatten:function(a){return j.reduce(a,function(a,b){return k.arr(b)?a.concat(j.flatten(b)):(a[a.length]=b,a)},[])},uniq:function(a){var b=[],c,d;a:for(c=0;c<a.length;c++){for(d=0;d<b.length;d++)if(b[d]==a[c])continue a;b[b.length]=a[c]}return b},merge:function(a,b){var c=a.length,d=0,e;if(isFinite(b.length))for(e=b.length;d<e;d++)a[c++]=b[d];else while(b[d]!==undefined)first[c++]=second[d++];return a.length=c,a},inArray:function(a,b){return!!~j.indexOf(a,b)}},k={fun:function(a){return typeof a=="function"},str:function(a){return typeof a=="string"},ele:function(a){return!!a&&!!a.nodeType&&a.nodeType==1},arr:function(a){return a instanceof Array},arrLike:function(a){return a&&a.length&&isFinite(a.length)},num:function(a){return typeof a=="number"},bool:function(a){return a===!0||a===!1},args:function(a){return!!a&&!!d.call(a,"callee")},emp:function(a){var b=0;return k.arr(a)?a.length===0:k.obj(a)?function(){for(var c in a){b++;break}return b===0}():a===""},dat:function(a){return!!(a&&a.getTimezoneOffset&&a.setUTCFullYear)},reg:function(a){return!(!(a&&a.test&&a.exec)||!a.ignoreCase&&a.ignoreCase!==!1)},nan:function(a){return a!==a},nil:function(a){return a===e},und:function(a){return typeof a=="undefined"},def:function(a){return typeof a!="undefined"},obj:function(a){return a instanceof Object&&!k.fun(a)&&!k.arr(a)}},m={each:function(a,b,c){k.arrLike(a)?j.each(a,b,c):function(){for(var e in a)d.call(a,e)&&b.call(c,e,a[e],a)}()},map:function(a,b,c){var e=[],f=0;return k.arrLike(a)?j.map(a,b,c):!function(){for(var g in a)d.call(a,g)&&(e[f++]=b.call(c,g,a[g],a))}()&&e},pluck:function(a,b){return k.arrLike(a)?j.map(a,function(a){return a[b]}):m.map(a,function(a,c){return c[b]})},toArray:function(a){return a?k.arr(a)?a:a.toArray?a.toArray():k.args(a)?f.call(a):j.map(a,function(a){return a}):[]},first:function(a){return a[0]},last:function(a){return a[a.length-1]},keys:Object.keys?function(a){return Object.keys(a)}:function(a){var b=[],c;for(c in a)d.call(a,c)&&(b[b.length]=c);return b},values:function(a){return m.map(a,function(a,b){return b})},extend:function(){var a,b,c,d,f,g=arguments[0],h=1,i=arguments.length;for(;h<i;h++)if((a=arguments[h])!==e)for(b in a){c=g[b],d=a[b];if(g===d)continue;d&&k.obj(d)?(f=c&&k.obj(c)?c:{},g[b]=m.extend(f,d)):d!==undefined&&(g[b]=d)}return g},trim:String.prototype.trim?function(a){return a.trim()}:function(a){return a.replace(i,"")},bind:function(a,b){var c=arguments.length>2?f.call(arguments,2):null;return function(){return b.apply(a,c?c.concat(f.call(arguments)):arguments)}},curry:function(a){if(arguments.length==1)return a;var b=f.call(arguments,1);return function(){return a.apply(null,b.concat(f.call(arguments)))}},parallel:function(a,b){var c=m.toArray(arguments),d=0,f=[],g=[];k.arr(a)||(b=c.pop(),a=c),j.each(a,function(c,h){c(function(){var c=m.toArray(arguments),i=c.shift();if(i)return b(i);f[h]=c,a.length==++d&&(f.unshift(e),j.each(f,function(a){g=g.concat(a)}),b.apply(e,g))})})},waterfall:function(a,b){var c=m.toArray(arguments),d=0;k.arr(a)||(b=c.pop(),a=c),function f(){var c=m.toArray(arguments);c.push(f);var d=c.shift();!d&&a.length?a.shift().apply(e,c):(c.pop(),c.unshift(d),b.apply(e,c))}(e)},queue:function(a){return new n(k.arrLike(a)?a:m.toArray(arguments))}};return n.prototype.next=function(){return this.index<this.values.length&&this.values[this.index++](),this},p(o,j),p(o,m),o.is=k,o.v=o,o.each(o.extend({},j,m),function(a,b){q.prototype[a]=function(){var a=o.toArray(arguments);a.unshift(this.val);var c=b.apply(this._scope,a);return this.val=c,this._chained?this:c}}),p(q.prototype,{chain:function(){return this._chained=1,this},value:function(){return this.val}}),o.noConflict=function(){return a.v=b,this},o}) |
53900