Comparing version 0.0.5 to 0.0.7
@@ -27,9 +27,11 @@ // pasta.js | ||
function curry (fn, times) { | ||
var args = [] | ||
, self = this | ||
var self = this | ||
if (!(times >= 2)) times = 2 | ||
return function currying (arg) { | ||
return function currying (arg, args) { | ||
args || (args = []) | ||
args.push(arg) | ||
if (args.length === times) return fn.apply(self, args) | ||
return currying | ||
return function (arg) { | ||
return currying(arg, args) | ||
} | ||
} | ||
@@ -39,7 +41,7 @@ } | ||
function memo (fn, cache) { | ||
cache = memoed._cache = cache || {} | ||
function memoed () { | ||
fn._cache || (memoed.cache = fn._cache = cache || {}) | ||
var args = JSON.stringify(p.slice(arguments)) | ||
if (!(args in cache)) cache[args] = fn.apply(this, arguments) | ||
return cache[args] | ||
if (args in fn._cache) return fn._cache[args] | ||
return fn._cache[args] = fn.apply(this, arguments) | ||
} | ||
@@ -111,4 +113,2 @@ return memoed | ||
var d = op('') | ||
function all (fn) { | ||
@@ -130,3 +130,3 @@ fn = args(2)(fn) | ||
, casify: casify | ||
, d: d | ||
, d: op('') | ||
, comp: comp | ||
@@ -133,0 +133,0 @@ , one: args(1) |
{ "name": "fn-pasta" | ||
, "version": "0.0.5" | ||
, "version": "0.0.7" | ||
, "author": "Nick Niemeir <nick.niemeir@gmail.com> (http://nrn.io)" | ||
@@ -7,4 +7,17 @@ , "main": "fn-pasta.js" | ||
, "dependencies": { "gen-pasta": "*" } | ||
, "devDependencies": { "tape": "*" } | ||
, "devDependencies": | ||
{ "tape": "*" | ||
, "benchmark": "*" | ||
} | ||
, "engines": { "node": ">0.6" } | ||
, "testling": | ||
{ "files": [ "t/*.js" ] | ||
, "browsers": | ||
{ "chrome": [ "23", "canary" ] | ||
, "firefox": [ "17", "nightly" ] | ||
, "safari": [ "5.1" ] | ||
, "ie": [ "10" ] | ||
, "opera": [ "12", "next" ] | ||
} | ||
} | ||
, "repository": | ||
@@ -11,0 +24,0 @@ { "type": "git" |
@@ -8,2 +8,4 @@ Functional Pasta | ||
[![browser support](http://ci.testling.com/nrn/fn-pasta.png)](http://ci.testling.com/nrn/fn-pasta) | ||
comp(arr) | ||
@@ -10,0 +12,0 @@ --------- |
@@ -65,5 +65,5 @@ var p = require('../fn-pasta')() | ||
t.same(memoSum(1, 1), 2, 'Avoid cache object') | ||
t.same(memoSum._cache, { '["broken",2]': 'Surprise!', '[1,1]': 2 }, 'Check cache') | ||
t.same(memoSum.cache, { '["broken",2]': 'Surprise!', '[1,1]': 2 }, 'Check cache') | ||
t.end() | ||
}) |
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
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
14631
13
390
68
2