Comparing version 6.4.0 to 6.5.0
@@ -385,9 +385,6 @@ function F() { | ||
case 10: | ||
default: | ||
return function (_1, _2, _3, _4, _5, _6, _7, _8, _9, _10) { | ||
return fn.apply(this, arguments); | ||
}; | ||
default: | ||
throw new Error('First argument to _arity must be a non-negative integer no greater than ten'); | ||
} | ||
@@ -398,2 +395,7 @@ } | ||
if (arguments.length === 1) return _fn => curryN(n, _fn); | ||
if (n > 10) { | ||
throw new Error('First argument to _arity must be a non-negative integer no greater than ten'); | ||
} | ||
return _arity(n, _curryN(n, [], fn)); | ||
@@ -471,30 +473,12 @@ } | ||
function flagIs(inputArguments) { | ||
return inputArguments === undefined || inputArguments === null || Number.isNaN(inputArguments) === true; | ||
function isFalsy(input) { | ||
return input === undefined || input === null || Number.isNaN(input) === true; | ||
} | ||
function defaultTo(defaultArgument, ...inputArguments) { | ||
function defaultTo(defaultArgument, input) { | ||
if (arguments.length === 1) { | ||
return (..._inputArguments) => defaultTo(defaultArgument, ..._inputArguments); | ||
return _input => defaultTo(defaultArgument, _input); | ||
} | ||
const limit = inputArguments.length - 1; | ||
let len = limit + 1; | ||
let ready = false; | ||
let holder; | ||
while (!ready) { | ||
const instance = inputArguments[limit - len + 1]; | ||
if (len === 0) { | ||
ready = true; | ||
} else if (flagIs(instance)) { | ||
len -= 1; | ||
} else { | ||
holder = instance; | ||
ready = true; | ||
} | ||
} | ||
return holder === undefined ? defaultArgument : holder; | ||
return isFalsy(input) ? defaultArgument : input; | ||
} | ||
@@ -554,2 +538,7 @@ | ||
if (aType !== type(b)) return false; | ||
if (aType === 'Function') { | ||
return a.name === undefined ? false : a.name === b.name; | ||
} | ||
if (['NaN', 'Undefined', 'Null'].includes(aType)) return true; | ||
@@ -1679,3 +1668,16 @@ | ||
if (fns.length === 0) throw new Error('pipe requires at least one argument'); | ||
return compose(...fns.reverse()); | ||
return (...args) => { | ||
const list = fns.slice(); | ||
if (list.length > 0) { | ||
const fn = list.shift(); | ||
let result = fn(...args); | ||
while (list.length > 0) { | ||
result = list.shift()(result); | ||
} | ||
return result; | ||
} | ||
}; | ||
} | ||
@@ -2043,4 +2045,4 @@ | ||
function uniqWith(fn, list) { | ||
if (arguments.length === 1) return _list => uniqWith(fn, _list); | ||
function uniqWith(predicate, list) { | ||
if (arguments.length === 1) return _list => uniqWith(predicate, _list); | ||
let index = -1; | ||
@@ -2052,3 +2054,3 @@ const len = list.length; | ||
const value = list[index]; | ||
const flag = any(willReturnInstance => fn(value, willReturnInstance), willReturn); | ||
const flag = any(willReturnInstance => predicate(value, willReturnInstance), willReturn); | ||
@@ -2055,0 +2057,0 @@ if (!flag) { |
@@ -389,9 +389,6 @@ 'use strict'; | ||
case 10: | ||
default: | ||
return function (_1, _2, _3, _4, _5, _6, _7, _8, _9, _10) { | ||
return fn.apply(this, arguments); | ||
}; | ||
default: | ||
throw new Error('First argument to _arity must be a non-negative integer no greater than ten'); | ||
} | ||
@@ -402,2 +399,7 @@ } | ||
if (arguments.length === 1) return _fn => curryN(n, _fn); | ||
if (n > 10) { | ||
throw new Error('First argument to _arity must be a non-negative integer no greater than ten'); | ||
} | ||
return _arity(n, _curryN(n, [], fn)); | ||
@@ -475,30 +477,12 @@ } | ||
function flagIs(inputArguments) { | ||
return inputArguments === undefined || inputArguments === null || Number.isNaN(inputArguments) === true; | ||
function isFalsy(input) { | ||
return input === undefined || input === null || Number.isNaN(input) === true; | ||
} | ||
function defaultTo(defaultArgument, ...inputArguments) { | ||
function defaultTo(defaultArgument, input) { | ||
if (arguments.length === 1) { | ||
return (..._inputArguments) => defaultTo(defaultArgument, ..._inputArguments); | ||
return _input => defaultTo(defaultArgument, _input); | ||
} | ||
const limit = inputArguments.length - 1; | ||
let len = limit + 1; | ||
let ready = false; | ||
let holder; | ||
while (!ready) { | ||
const instance = inputArguments[limit - len + 1]; | ||
if (len === 0) { | ||
ready = true; | ||
} else if (flagIs(instance)) { | ||
len -= 1; | ||
} else { | ||
holder = instance; | ||
ready = true; | ||
} | ||
} | ||
return holder === undefined ? defaultArgument : holder; | ||
return isFalsy(input) ? defaultArgument : input; | ||
} | ||
@@ -558,2 +542,7 @@ | ||
if (aType !== type(b)) return false; | ||
if (aType === 'Function') { | ||
return a.name === undefined ? false : a.name === b.name; | ||
} | ||
if (['NaN', 'Undefined', 'Null'].includes(aType)) return true; | ||
@@ -1683,3 +1672,16 @@ | ||
if (fns.length === 0) throw new Error('pipe requires at least one argument'); | ||
return compose(...fns.reverse()); | ||
return (...args) => { | ||
const list = fns.slice(); | ||
if (list.length > 0) { | ||
const fn = list.shift(); | ||
let result = fn(...args); | ||
while (list.length > 0) { | ||
result = list.shift()(result); | ||
} | ||
return result; | ||
} | ||
}; | ||
} | ||
@@ -2047,4 +2049,4 @@ | ||
function uniqWith(fn, list) { | ||
if (arguments.length === 1) return _list => uniqWith(fn, _list); | ||
function uniqWith(predicate, list) { | ||
if (arguments.length === 1) return _list => uniqWith(predicate, _list); | ||
let index = -1; | ||
@@ -2056,3 +2058,3 @@ const len = list.length; | ||
const value = list[index]; | ||
const flag = any(willReturnInstance => fn(value, willReturnInstance), willReturn); | ||
const flag = any(willReturnInstance => predicate(value, willReturnInstance), willReturn); | ||
@@ -2059,0 +2061,0 @@ if (!flag) { |
@@ -391,9 +391,6 @@ (function (global, factory) { | ||
case 10: | ||
default: | ||
return function (_1, _2, _3, _4, _5, _6, _7, _8, _9, _10) { | ||
return fn.apply(this, arguments); | ||
}; | ||
default: | ||
throw new Error('First argument to _arity must be a non-negative integer no greater than ten'); | ||
} | ||
@@ -404,2 +401,7 @@ } | ||
if (arguments.length === 1) return _fn => curryN(n, _fn); | ||
if (n > 10) { | ||
throw new Error('First argument to _arity must be a non-negative integer no greater than ten'); | ||
} | ||
return _arity(n, _curryN(n, [], fn)); | ||
@@ -477,30 +479,12 @@ } | ||
function flagIs(inputArguments) { | ||
return inputArguments === undefined || inputArguments === null || Number.isNaN(inputArguments) === true; | ||
function isFalsy(input) { | ||
return input === undefined || input === null || Number.isNaN(input) === true; | ||
} | ||
function defaultTo(defaultArgument, ...inputArguments) { | ||
function defaultTo(defaultArgument, input) { | ||
if (arguments.length === 1) { | ||
return (..._inputArguments) => defaultTo(defaultArgument, ..._inputArguments); | ||
return _input => defaultTo(defaultArgument, _input); | ||
} | ||
const limit = inputArguments.length - 1; | ||
let len = limit + 1; | ||
let ready = false; | ||
let holder; | ||
while (!ready) { | ||
const instance = inputArguments[limit - len + 1]; | ||
if (len === 0) { | ||
ready = true; | ||
} else if (flagIs(instance)) { | ||
len -= 1; | ||
} else { | ||
holder = instance; | ||
ready = true; | ||
} | ||
} | ||
return holder === undefined ? defaultArgument : holder; | ||
return isFalsy(input) ? defaultArgument : input; | ||
} | ||
@@ -560,2 +544,7 @@ | ||
if (aType !== type(b)) return false; | ||
if (aType === 'Function') { | ||
return a.name === undefined ? false : a.name === b.name; | ||
} | ||
if (['NaN', 'Undefined', 'Null'].includes(aType)) return true; | ||
@@ -1685,3 +1674,16 @@ | ||
if (fns.length === 0) throw new Error('pipe requires at least one argument'); | ||
return compose(...fns.reverse()); | ||
return (...args) => { | ||
const list = fns.slice(); | ||
if (list.length > 0) { | ||
const fn = list.shift(); | ||
let result = fn(...args); | ||
while (list.length > 0) { | ||
result = list.shift()(result); | ||
} | ||
return result; | ||
} | ||
}; | ||
} | ||
@@ -2049,4 +2051,4 @@ | ||
function uniqWith(fn, list) { | ||
if (arguments.length === 1) return _list => uniqWith(fn, _list); | ||
function uniqWith(predicate, list) { | ||
if (arguments.length === 1) return _list => uniqWith(predicate, _list); | ||
let index = -1; | ||
@@ -2058,3 +2060,3 @@ const len = list.length; | ||
const value = list[index]; | ||
const flag = any(willReturnInstance => fn(value, willReturnInstance), willReturn); | ||
const flag = any(willReturnInstance => predicate(value, willReturnInstance), willReturn); | ||
@@ -2061,0 +2063,0 @@ if (!flag) { |
{ | ||
"name": "rambda", | ||
"version": "6.4.0", | ||
"version": "6.5.0", | ||
"scripts": { | ||
"out": "jest scripts/all-scripts/all-scripts.spec.js", | ||
"x": "WITH_RAMBDAX=ON jest scripts/all-scripts/all-scripts.spec.js", | ||
"out": "cd ../rambda-scripts&&yarn populate:docs&&cd ../rambda-scripts&&yarn populate:readme", | ||
"x": "cd ../rambda-scripts&&yarn populate:docs:rambdax&&cd ../rambda-scripts&&yarn populate:readme:rambdax", | ||
"github": "cd ../rambda-scripts&&yarn github", | ||
"docs": "cd ../rambda-scripts&&yarn highlighter", | ||
"readme": "jest scripts/populate-readme-data/populate-readme-data.spec.js", | ||
"toolbelt": "cd ../rambda-scripts&&yarn toolbelt", | ||
"immutable": "cd ../rambda-scripts&&yarn immutable", | ||
"usedby": "cd ../rambda-scripts&&yarn usedby", | ||
"lint": "yarn lint:js&&yarn lint:ts", | ||
"lint:ts": "cd scripts/lint-ts-files&&node lint-typings-tests.js", | ||
"lint:js": "jest scripts/lint/lint.spec.js", | ||
"docsify": "docsi init ./docs", | ||
"build": "yarn build:main&&yarn build:web", | ||
"lint": "cd ../rambda-scripts&&yarn lint", | ||
"build": "yarn build:main&&yarn build:web&&yarn deps", | ||
"build:web": "cross-env NODE_ENV=build rollup -c files/rollup.web.config.js", | ||
"build:main": "cross-env NODE_ENV=build rollup -c files/rollup.config.js", | ||
"parse": "node scripts/parse-package-json/parse-package-json", | ||
"new": "node scripts/add-new-method/add-new-method.js", | ||
"parse": "cd ../rambda-scripts&&yarn hjson:parse", | ||
"deps": "cd ../rambda-scripts&&yarn hjson:fix", | ||
"docsify": "docsi init ./docs", | ||
"new": "cd ../rambda-scripts&&yarn new", | ||
"test": "jest source -u --bail=false", | ||
"cover:spec": "jest source --coverage --no-cache -w 1", | ||
"cover": "yarn typings&&yarn cover:spec", | ||
"benchmark": "jest scripts/run-benchmarks/run-benchmarks.spec.js", | ||
"benchmarkx": "jest scripts/run-benchmarks/run-complex-benchmarks.spec.js", | ||
"benchmark": "cd ../rambda-scripts&&yarn benchmarks", | ||
"benchmarkx": "cd ../rambda-scripts&&yarn benchmarksx", | ||
"typings": "dtslint --localTs ./node_modules/typescript/lib --expectOnly ./source", | ||
"fix": "mkdir $HOME/.dts/perf -p" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"@babel/core": "7.12.3", | ||
"@babel/core": "7.12.10", | ||
"@babel/plugin-proposal-object-rest-spread": "7.12.1", | ||
"@babel/preset-env": "7.12.1", | ||
"@rollup/plugin-babel": "5.2.1", | ||
"@rollup/plugin-commonjs": "16.0.0", | ||
"@babel/preset-env": "7.12.11", | ||
"@rollup/plugin-babel": "5.2.2", | ||
"@rollup/plugin-commonjs": "17.0.0", | ||
"@rollup/plugin-json": "4.1.0", | ||
"@rollup/plugin-node-resolve": "10.0.0", | ||
"@rollup/plugin-node-resolve": "11.0.1", | ||
"@rollup/plugin-replace": "2.3.4", | ||
"@types/fs-extra": "9.0.4", | ||
"@types/jest": "26.0.15", | ||
"@types/ramda": "0.27.32", | ||
"@types/jest": "26.0.19", | ||
"@types/ramda": "0.27.34", | ||
"combinate": "1.1.1", | ||
"cross-env": "7.0.2", | ||
"dtslint": "4.0.5", | ||
"fs-extra": "9.0.1", | ||
"helpers-fn": "1.0.0", | ||
"cross-env": "7.0.3", | ||
"dtslint": "4.0.6", | ||
"helpers-fn": "1.3.2", | ||
"is-ci": "2.0.0", | ||
"jest": "26.6.3", | ||
"jest": "27.0.0-next.2", | ||
"jest-extended": "0.11.5", | ||
"lint-fn": "2.12.1", | ||
"lodash": "4.17.20", | ||
"rambdax": "7.0.1", | ||
"rambdax": "7.1.0", | ||
"ramda": "0.27.1", | ||
"rollup": "2.33.1", | ||
"rollup": "2.35.1", | ||
"rollup-plugin-cleanup": "3.2.1", | ||
"rollup-plugin-sourcemaps": "0.6.3", | ||
"string-fn": "3.1.0", | ||
"typescript": "4.2.0-dev.20201113" | ||
"typescript": "4.2.0-dev.20201211" | ||
}, | ||
@@ -75,2 +71,3 @@ "jest": { | ||
"_ts-toolbelt", | ||
"CHANGELOG.md", | ||
"index.d.ts" | ||
@@ -77,0 +74,0 @@ ], |
@@ -84,3 +84,3 @@ function _curryN( | ||
} | ||
case 10: | ||
default: | ||
return function ( | ||
@@ -91,4 +91,2 @@ _1, _2, _3, _4, _5, _6, _7, _8, _9, _10 | ||
} | ||
default: | ||
throw new Error('First argument to _arity must be a non-negative integer no greater than ten') | ||
} | ||
@@ -100,2 +98,6 @@ } | ||
if(n> 10){ | ||
throw new Error('First argument to _arity must be a non-negative integer no greater than ten') | ||
} | ||
return _arity(n, _curryN( | ||
@@ -102,0 +104,0 @@ n, [], fn |
@@ -1,34 +0,16 @@ | ||
function flagIs(inputArguments){ | ||
function isFalsy(input){ | ||
return ( | ||
inputArguments === undefined || | ||
inputArguments === null || | ||
Number.isNaN(inputArguments) === true | ||
input === undefined || | ||
input === null || | ||
Number.isNaN(input) === true | ||
) | ||
} | ||
export function defaultTo(defaultArgument, ...inputArguments){ | ||
export function defaultTo(defaultArgument, input){ | ||
if (arguments.length === 1){ | ||
return (..._inputArguments) => | ||
defaultTo(defaultArgument, ..._inputArguments) | ||
return (_input) => | ||
defaultTo(defaultArgument, _input) | ||
} | ||
const limit = inputArguments.length - 1 | ||
let len = limit + 1 | ||
let ready = false | ||
let holder | ||
while (!ready){ | ||
const instance = inputArguments[ limit - len + 1 ] | ||
if (len === 0){ | ||
ready = true | ||
} else if (flagIs(instance)){ | ||
len -= 1 | ||
} else { | ||
holder = instance | ||
ready = true | ||
} | ||
} | ||
return holder === undefined ? defaultArgument : holder | ||
return isFalsy(input) ? defaultArgument : input | ||
} |
@@ -27,2 +27,6 @@ import { type } from './type' | ||
if (aType !== type(b)) return false | ||
if (aType === 'Function'){ | ||
return a.name === undefined ? false : a.name === b.name | ||
} | ||
if ([ 'NaN', 'Undefined', 'Null' ].includes(aType)) return true | ||
@@ -29,0 +33,0 @@ |
@@ -1,3 +0,1 @@ | ||
import { compose } from './compose' | ||
export function pipe(...fns){ | ||
@@ -7,3 +5,14 @@ if (fns.length === 0) | ||
return compose(...fns.reverse()) | ||
return (...args) => { | ||
const list = fns.slice() | ||
if (list.length > 0){ | ||
const fn = list.shift() | ||
let result = fn(...args) | ||
while (list.length > 0){ | ||
result = list.shift()(result) | ||
} | ||
return result | ||
} | ||
} | ||
} |
import { any } from './any' | ||
export function uniqWith(fn, list){ | ||
if (arguments.length === 1) return _list => uniqWith(fn, _list) | ||
export function uniqWith(predicate, list){ | ||
if (arguments.length === 1) return _list => uniqWith(predicate, _list) | ||
@@ -12,3 +12,3 @@ let index = -1 | ||
const value = list[ index ] | ||
const flag = any(willReturnInstance => fn(value, willReturnInstance), | ||
const flag = any(willReturnInstance => predicate(value, willReturnInstance), | ||
willReturn) | ||
@@ -15,0 +15,0 @@ |
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
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
24
1100745
18748
19988