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

valentine

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

valentine - npm Package Compare versions

Comparing version 1.5.6 to 1.6.0

2

package.json
{
"name": "valentine"
, "description": "JavaScripts Functional Sister. Utilitiy, Iterators, type checking"
, "version": "1.5.6"
, "version": "1.6.0"
, "homepage": "https://github.com/ded/valentine"

@@ -6,0 +6,0 @@ , "author": "Dustin Diaz <dustin@dustindiaz.com> (http://dustindiaz.com)"

@@ -235,2 +235,12 @@ (function (name, context, definition) {

, memo: function (fn, hasher) {
var store = {}
hasher || (hasher = function (v) {
return v
})
return function () {
var key = hasher.apply(this, arguments)
return hasOwn.call(store, key) ? store[key] : (store[key] = fn.apply(this, arguments))
}
}
}

@@ -237,0 +247,0 @@

@@ -217,2 +217,20 @@ if (typeof module !== 'undefined' && module.exports) {

test('memoize', function (done) {
var called = 0
var add = v.memo(function (a, b) {
ok(++called == 1, 'only calls memoized method once')
return a + b
})
assert.isFunction(add)
var computed = add(1, 2)
var expected = 3
assert.equal(computed, expected, 'should be called once')
var secondCall = add(1, 2)
assert.notEqual(secondCall, 15, 'second call is not equal to 15')
assert.equal(secondCall, expected, 'second call should still be cached value')
done()
})
test('first', 1, function () {

@@ -219,0 +237,0 @@ ok(v.first(['a', 'b', 'c']) == 'a', 'a is first');

@@ -242,2 +242,12 @@ /*!

, memo: function (fn, hasher) {
var store = {}
hasher || (hasher = function (v) {
return v
})
return function () {
var key = hasher.apply(this, arguments)
return hasOwn.call(store, key) ? store[key] : (store[key] = fn.apply(this, arguments))
}
}
}

@@ -244,0 +254,0 @@

@@ -7,2 +7,2 @@ /*!

*/
(function(e,t,n){typeof module!="undefined"?module.exports=n():typeof define=="function"?define(n):t[e]=t.v=n()})("valentine",this,function(){function p(e){this.values=e,this.index=0}function d(e,t){return new m(e,t)}function v(e,t){for(var n in t)e[n]=t[n]}function m(e,t){this.val=e,this._scope=t||i,this._chained=0}var e=this,t=e.v,n=[],r=Object.prototype.hasOwnProperty,i=null,s=n.slice,o="map"in n,u="reduce"in n,a=/(^\s*|\s*$)/g,f={each:o?function(e,t,r){n.forEach.call(e,t,r)}:function(e,t,n){for(var r=0,i=e.length;r<i;r++)r in e&&t.call(n,e[r],r,e)},map:o?function(e,t,r){return n.map.call(e,t,r)}:function(e,t,n){var r=[],i;for(i=0,l=e.length;i<l;i++)i in e&&(r[i]=t.call(n,e[i],i,e));return r},some:o?function(e,t,n){return e.some(t,n)}:function(e,t,n){for(var r=0,i=e.length;r<i;r++)if(r in e&&t.call(n,e[r],r,e))return!0;return!1},every:o?function(e,t,n){return e.every(t,n)}:function(e,t,n){for(var r=0,i=e.length;r<i;r++)if(r in e&&!t.call(n,e[r],r,e))return!1;return!0},filter:o?function(e,t,n){return e.filter(t,n)}:function(e,t,n){for(var r=[],i=0,s=0,o=e.length;i<o;i++)if(i in e){if(!t.call(n,e[i],i,e))continue;r[s++]=e[i]}return r},indexOf:o?function(e,t,n){return e.indexOf(t,isFinite(n)?n:0)}:function(e,t,n){n=n||0,n=n<0?0:n,n=n>e.length?e.length:n;for(var r=n;r<e.length;r++)if(r in e&&e[r]===t)return r;return-1},lastIndexOf:o?function(e,t,n){return e.lastIndexOf(t,isFinite(n)?n:e.length)}:function(e,t,n){n=n||e.length,n=n>=e.length?e.length:n<0?e.length+n:n;for(var r=n;r>=0;--r)if(r in e&&e[r]===t)return r;return-1},reduce:u?function(e,t,r,i){return n.reduce.call(e,t,r,i)}:function(e,t,n,r){e||(e=[]);var i=0,s=e.length;if(arguments.length<3)do{if(i in e){n=e[i++];break}if(++i>=s)throw new TypeError("Empty array")}while(1);for(;i<s;i++)i in e&&(n=t.call(r,n,e[i],i,e));return n},reduceRight:u?function(e,t,r,i){return n.reduceRight.call(e,t,r,i)}:function(e,t,n,r){!e&&(e=[]);var i=e.length,s=i-1;if(arguments.length<3)do{if(s in e){n=e[s--];break}if(--s<0)throw new TypeError("Empty array")}while(1);for(;s>=0;s--)s in e&&(n=t.call(r,n,e[s],s,e));return n},find:function(e,t,n){var r;return f.some(e,function(e,i,s){if(t.call(n,e,i,s))return r=e,!0}),r},reject:function(e,t,n){var r=[];for(var i=0,s=0,o=e.length;i<o;i++)if(i in e){if(t.call(n,e[i],i,e))continue;r[s++]=e[i]}return r},size:function(e){return h.toArray(e).length},compact:function(e){return f.filter(e,function(e){return!!e})},flatten:function(e){return f.reduce(e,function(e,t){return c.arr(t)?e.concat(f.flatten(t)):(e[e.length]=t,e)},[])},uniq:function(e,t){var n=[],r,i;e=t?f.map(e,t):e;e:for(r=0;r<e.length;r++){for(i=0;i<n.length;i++)if(n[i]===e[r])continue e;n[n.length]=e[r]}return n},merge:function(e,t){var n=e.length,r=0,i;if(isFinite(t.length))for(i=t.length;r<i;r++)e[n++]=t[r];else while(t[r]!==undefined)first[n++]=second[r++];return e.length=n,e},inArray:function(e,t){return!!~f.indexOf(e,t)}},c={fun:function(e){return typeof e=="function"},str:function(e){return typeof e=="string"},ele:function(e){return!!e&&!!e.nodeType&&e.nodeType==1},arr:function(e){return e instanceof Array},arrLike:function(e){return e&&e.length&&isFinite(e.length)},num:function(e){return typeof e=="number"},bool:function(e){return e===!0||e===!1},args:function(e){return!!e&&!!r.call(e,"callee")},emp:function(e){var t=0;return c.arr(e)?e.length===0:c.obj(e)?function(){for(var n in e){t++;break}return t===0}():e===""},dat:function(e){return!!(e&&e.getTimezoneOffset&&e.setUTCFullYear)},reg:function(e){return!(!(e&&e.test&&e.exec)||!e.ignoreCase&&e.ignoreCase!==!1)},nan:function(e){return e!==e},nil:function(e){return e===i},und:function(e){return typeof e=="undefined"},def:function(e){return typeof e!="undefined"},obj:function(e){return e instanceof Object&&!c.fun(e)&&!c.arr(e)}},h={each:function(e,t,n){c.arrLike(e)?f.each(e,t,n):function(){for(var i in e)r.call(e,i)&&t.call(n,i,e[i],e)}()},map:function(e,t,n){var i=[],s=0;return c.arrLike(e)?f.map(e,t,n):!function(){for(var o in e)r.call(e,o)&&(i[s++]=t.call(n,o,e[o],e))}()&&i},pluck:function(e,t){return c.arrLike(e)?f.map(e,function(e){return e[t]}):h.map(e,function(e,n){return n[t]})},toArray:function(e){return e?c.arr(e)?e:e.toArray?e.toArray():c.args(e)?s.call(e):f.map(e,function(e){return e}):[]},first:function(e){return e[0]},last:function(e){return e[e.length-1]},keys:Object.keys?function(e){return Object.keys(e)}:function(e){var t=[],n;for(n in e)r.call(e,n)&&(t[t.length]=n);return t},values:function(e){return h.map(e,function(e,t){return t})},extend:function(){var e,t,n,r,s,o=arguments[0],u=1,a=arguments.length;for(;u<a;u++)if((e=arguments[u])!==i)for(t in e){n=o[t],r=e[t];if(o===r)continue;r&&c.obj(r)?(s=n&&c.obj(n)?n:{},o[t]=h.extend(s,r)):r!==undefined&&(o[t]=r)}return o},trim:String.prototype.trim?function(e){return e.trim()}:function(e){return e.replace(a,"")},bind:function(e,t){var n=arguments.length>2?s.call(arguments,2):null;return function(){return t.apply(e,n?n.concat(s.call(arguments)):arguments)}},curry:function(e){if(arguments.length==1)return e;var t=s.call(arguments,1);return function(){return e.apply(null,t.concat(s.call(arguments)))}},parallel:function(e,t){var n=h.toArray(arguments),r=0,s=[],o=[];if(c.arr(e)&&e.length===0||c.fun(e)&&n.length===1)throw new TypeError("Empty parallel array");c.arr(e)||(t=n.pop(),e=n),f.each(e,function(n,u){n(function(){var n=h.toArray(arguments),a=n.shift();if(a)return t(a);s[u]=n,e.length==++r&&(s.unshift(i),f.each(s,function(e){o=o.concat(e)}),t.apply(i,o))})})},waterfall:function(e,t){var n=h.toArray(arguments),r=0;if(c.arr(e)&&e.length===0||c.fun(e)&&n.length===1)throw new TypeError("Empty waterfall array");c.arr(e)||(t=n.pop(),e=n),function s(){var n=h.toArray(arguments);n.push(s);var r=n.shift();!r&&e.length?e.shift().apply(i,n):(n.pop(),n.unshift(r),t.apply(i,n))}(i)},queue:function(e){return new p(c.arrLike(e)?e:h.toArray(arguments))}};return p.prototype.next=function(){return this.index<this.values.length&&this.values[this.index++](),this},v(d,f),v(d,h),d.is=c,d.v=d,d.each(d.extend({},f,h),function(e,t){m.prototype[e]=function(){var e=d.toArray(arguments);e.unshift(this.val);var n=t.apply(this._scope,e);return this.val=n,this._chained?this:n}}),v(m.prototype,{chain:function(){return this._chained=1,this},value:function(){return this.val}}),d.noConflict=function(){return e.v=t,this},d})
(function(e,t,n){typeof module!="undefined"?module.exports=n():typeof define=="function"?define(n):t[e]=t.v=n()})("valentine",this,function(){function p(e){this.values=e,this.index=0}function d(e,t){return new m(e,t)}function v(e,t){for(var n in t)e[n]=t[n]}function m(e,t){this.val=e,this._scope=t||i,this._chained=0}var e=this,t=e.v,n=[],r=Object.prototype.hasOwnProperty,i=null,s=n.slice,o="map"in n,u="reduce"in n,a=/(^\s*|\s*$)/g,f={each:o?function(e,t,r){n.forEach.call(e,t,r)}:function(e,t,n){for(var r=0,i=e.length;r<i;r++)r in e&&t.call(n,e[r],r,e)},map:o?function(e,t,r){return n.map.call(e,t,r)}:function(e,t,n){var r=[],i;for(i=0,l=e.length;i<l;i++)i in e&&(r[i]=t.call(n,e[i],i,e));return r},some:o?function(e,t,n){return e.some(t,n)}:function(e,t,n){for(var r=0,i=e.length;r<i;r++)if(r in e&&t.call(n,e[r],r,e))return!0;return!1},every:o?function(e,t,n){return e.every(t,n)}:function(e,t,n){for(var r=0,i=e.length;r<i;r++)if(r in e&&!t.call(n,e[r],r,e))return!1;return!0},filter:o?function(e,t,n){return e.filter(t,n)}:function(e,t,n){for(var r=[],i=0,s=0,o=e.length;i<o;i++)if(i in e){if(!t.call(n,e[i],i,e))continue;r[s++]=e[i]}return r},indexOf:o?function(e,t,n){return e.indexOf(t,isFinite(n)?n:0)}:function(e,t,n){n=n||0,n=n<0?0:n,n=n>e.length?e.length:n;for(var r=n;r<e.length;r++)if(r in e&&e[r]===t)return r;return-1},lastIndexOf:o?function(e,t,n){return e.lastIndexOf(t,isFinite(n)?n:e.length)}:function(e,t,n){n=n||e.length,n=n>=e.length?e.length:n<0?e.length+n:n;for(var r=n;r>=0;--r)if(r in e&&e[r]===t)return r;return-1},reduce:u?function(e,t,r,i){return n.reduce.call(e,t,r,i)}:function(e,t,n,r){e||(e=[]);var i=0,s=e.length;if(arguments.length<3)do{if(i in e){n=e[i++];break}if(++i>=s)throw new TypeError("Empty array")}while(1);for(;i<s;i++)i in e&&(n=t.call(r,n,e[i],i,e));return n},reduceRight:u?function(e,t,r,i){return n.reduceRight.call(e,t,r,i)}:function(e,t,n,r){!e&&(e=[]);var i=e.length,s=i-1;if(arguments.length<3)do{if(s in e){n=e[s--];break}if(--s<0)throw new TypeError("Empty array")}while(1);for(;s>=0;s--)s in e&&(n=t.call(r,n,e[s],s,e));return n},find:function(e,t,n){var r;return f.some(e,function(e,i,s){if(t.call(n,e,i,s))return r=e,!0}),r},reject:function(e,t,n){var r=[];for(var i=0,s=0,o=e.length;i<o;i++)if(i in e){if(t.call(n,e[i],i,e))continue;r[s++]=e[i]}return r},size:function(e){return h.toArray(e).length},compact:function(e){return f.filter(e,function(e){return!!e})},flatten:function(e){return f.reduce(e,function(e,t){return c.arr(t)?e.concat(f.flatten(t)):(e[e.length]=t,e)},[])},uniq:function(e,t){var n=[],r,i;e=t?f.map(e,t):e;e:for(r=0;r<e.length;r++){for(i=0;i<n.length;i++)if(n[i]===e[r])continue e;n[n.length]=e[r]}return n},merge:function(e,t){var n=e.length,r=0,i;if(isFinite(t.length))for(i=t.length;r<i;r++)e[n++]=t[r];else while(t[r]!==undefined)first[n++]=second[r++];return e.length=n,e},inArray:function(e,t){return!!~f.indexOf(e,t)},memo:function(e,t){var n={};return t||(t=function(e){return e}),function(){var i=t.apply(this,arguments);return r.call(n,i)?n[i]:n[i]=e.apply(this,arguments)}}},c={fun:function(e){return typeof e=="function"},str:function(e){return typeof e=="string"},ele:function(e){return!!e&&!!e.nodeType&&e.nodeType==1},arr:function(e){return e instanceof Array},arrLike:function(e){return e&&e.length&&isFinite(e.length)},num:function(e){return typeof e=="number"},bool:function(e){return e===!0||e===!1},args:function(e){return!!e&&!!r.call(e,"callee")},emp:function(e){var t=0;return c.arr(e)?e.length===0:c.obj(e)?function(){for(var n in e){t++;break}return t===0}():e===""},dat:function(e){return!!(e&&e.getTimezoneOffset&&e.setUTCFullYear)},reg:function(e){return!(!(e&&e.test&&e.exec)||!e.ignoreCase&&e.ignoreCase!==!1)},nan:function(e){return e!==e},nil:function(e){return e===i},und:function(e){return typeof e=="undefined"},def:function(e){return typeof e!="undefined"},obj:function(e){return e instanceof Object&&!c.fun(e)&&!c.arr(e)}},h={each:function(e,t,n){c.arrLike(e)?f.each(e,t,n):function(){for(var i in e)r.call(e,i)&&t.call(n,i,e[i],e)}()},map:function(e,t,n){var i=[],s=0;return c.arrLike(e)?f.map(e,t,n):!function(){for(var o in e)r.call(e,o)&&(i[s++]=t.call(n,o,e[o],e))}()&&i},pluck:function(e,t){return c.arrLike(e)?f.map(e,function(e){return e[t]}):h.map(e,function(e,n){return n[t]})},toArray:function(e){return e?c.arr(e)?e:e.toArray?e.toArray():c.args(e)?s.call(e):f.map(e,function(e){return e}):[]},first:function(e){return e[0]},last:function(e){return e[e.length-1]},keys:Object.keys?function(e){return Object.keys(e)}:function(e){var t=[],n;for(n in e)r.call(e,n)&&(t[t.length]=n);return t},values:function(e){return h.map(e,function(e,t){return t})},extend:function(){var e,t,n,r,s,o=arguments[0],u=1,a=arguments.length;for(;u<a;u++)if((e=arguments[u])!==i)for(t in e){n=o[t],r=e[t];if(o===r)continue;r&&c.obj(r)?(s=n&&c.obj(n)?n:{},o[t]=h.extend(s,r)):r!==undefined&&(o[t]=r)}return o},trim:String.prototype.trim?function(e){return e.trim()}:function(e){return e.replace(a,"")},bind:function(e,t){var n=arguments.length>2?s.call(arguments,2):null;return function(){return t.apply(e,n?n.concat(s.call(arguments)):arguments)}},curry:function(e){if(arguments.length==1)return e;var t=s.call(arguments,1);return function(){return e.apply(null,t.concat(s.call(arguments)))}},parallel:function(e,t){var n=h.toArray(arguments),r=0,s=[],o=[];if(c.arr(e)&&e.length===0||c.fun(e)&&n.length===1)throw new TypeError("Empty parallel array");c.arr(e)||(t=n.pop(),e=n),f.each(e,function(n,u){n(function(){var n=h.toArray(arguments),a=n.shift();if(a)return t(a);s[u]=n,e.length==++r&&(s.unshift(i),f.each(s,function(e){o=o.concat(e)}),t.apply(i,o))})})},waterfall:function(e,t){var n=h.toArray(arguments),r=0;if(c.arr(e)&&e.length===0||c.fun(e)&&n.length===1)throw new TypeError("Empty waterfall array");c.arr(e)||(t=n.pop(),e=n),function s(){var n=h.toArray(arguments);n.push(s);var r=n.shift();!r&&e.length?e.shift().apply(i,n):(n.pop(),n.unshift(r),t.apply(i,n))}(i)},queue:function(e){return new p(c.arrLike(e)?e:h.toArray(arguments))}};return p.prototype.next=function(){return this.index<this.values.length&&this.values[this.index++](),this},v(d,f),v(d,h),d.is=c,d.v=d,d.each(d.extend({},f,h),function(e,t){m.prototype[e]=function(){var e=d.toArray(arguments);e.unshift(this.val);var n=t.apply(this._scope,e);return this.val=n,this._chained?this:n}}),v(m.prototype,{chain:function(){return this._chained=1,this},value:function(){return this.val}}),d.noConflict=function(){return e.v=t,this},d})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc