rambda 7.0.1 → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/README.md +5520 -6179
- package/dist/rambda.esm.js +1 -1
- package/dist/rambda.js +285 -79
- package/dist/rambda.mjs +271 -79
- package/dist/rambda.umd.js +1 -1
- package/immutable.d.ts +106 -24
- package/index.d.ts +97 -15
- package/package.json +119 -111
- package/src/F.js +1 -1
- package/src/T.js +1 -1
- package/src/_internals/_isInteger.js +1 -1
- package/src/_internals/_keys.js +0 -1
- package/src/_internals/_objectIs.js +2 -7
- package/src/_internals/baseSlice.js +8 -6
- package/src/_internals/cloneList.js +1 -3
- package/src/_internals/createPath.js +3 -0
- package/src/_internals/isFalsy.js +5 -5
- package/src/_internals/isObject.js +2 -2
- package/src/_internals/isTruthy.js +5 -5
- package/src/_internals/set.js +19 -13
- package/src/add.js +1 -1
- package/src/adjust.js +6 -4
- package/src/all.js +3 -3
- package/src/allPass.js +3 -3
- package/src/always.js +2 -2
- package/src/and.js +1 -1
- package/src/any.js +3 -3
- package/src/anyPass.js +3 -3
- package/src/append.js +2 -2
- package/src/apply.js +2 -2
- package/src/applySpec.js +59 -33
- package/src/assoc.js +7 -3
- package/src/assocPath.js +25 -21
- package/src/bind.js +3 -3
- package/src/both.js +1 -1
- package/src/chain.js +2 -2
- package/src/clamp.js +6 -6
- package/src/clone.js +10 -10
- package/src/complement.js +1 -1
- package/src/compose.js +5 -14
- package/src/concat.js +2 -2
- package/src/cond.js +3 -3
- package/src/converge.js +11 -11
- package/src/count.js +10 -0
- package/src/countBy.js +17 -0
- package/src/curry.js +2 -2
- package/src/curryN.js +81 -61
- package/src/defaultTo.js +3 -3
- package/src/difference.js +3 -3
- package/src/dissoc.js +4 -4
- package/src/divide.js +1 -1
- package/src/drop.js +1 -1
- package/src/dropLast.js +5 -5
- package/src/dropLastWhile.js +12 -12
- package/src/dropRepeats.js +6 -6
- package/src/dropRepeatsWith.js +7 -7
- package/src/dropWhile.js +9 -9
- package/src/either.js +2 -2
- package/src/endsWith.js +6 -5
- package/src/eqProps.js +6 -4
- package/src/equals.js +64 -65
- package/src/evolve.js +21 -23
- package/src/filter.js +21 -15
- package/src/find.js +4 -4
- package/src/findIndex.js +3 -3
- package/src/findLast.js +4 -4
- package/src/findLastIndex.js +3 -3
- package/src/flatten.js +6 -6
- package/src/flip.js +15 -11
- package/src/forEach.js +12 -10
- package/src/fromPairs.js +2 -2
- package/src/groupBy.js +6 -6
- package/src/groupWith.js +12 -10
- package/src/has.js +1 -1
- package/src/hasPath.js +3 -3
- package/src/head.js +3 -3
- package/src/identical.js +2 -2
- package/src/identity.js +1 -1
- package/src/ifElse.js +5 -3
- package/src/includes.js +6 -6
- package/src/indexBy.js +11 -11
- package/src/indexOf.js +3 -3
- package/src/init.js +7 -3
- package/src/intersection.js +3 -3
- package/src/intersperse.js +5 -5
- package/src/is.js +2 -2
- package/src/isEmpty.js +5 -5
- package/src/isNil.js +1 -1
- package/src/isPromise.js +3 -3
- package/src/join.js +1 -1
- package/src/juxt.js +3 -0
- package/src/keys.js +1 -1
- package/src/last.js +4 -4
- package/src/lastIndexOf.js +3 -3
- package/src/length.js +2 -2
- package/src/lens.js +3 -3
- package/src/lensIndex.js +4 -4
- package/src/lensPath.js +4 -4
- package/src/lensProp.js +4 -4
- package/src/map.js +15 -11
- package/src/match.js +1 -1
- package/src/mathMod.js +3 -3
- package/src/max.js +1 -1
- package/src/maxBy.js +4 -2
- package/src/maybe.js +4 -2
- package/src/mean.js +2 -2
- package/src/median.js +10 -12
- package/src/merge.js +1 -5
- package/src/mergeAll.js +4 -4
- package/src/mergeDeepRight.js +8 -8
- package/src/mergeLeft.js +3 -3
- package/src/mergeRight.js +7 -0
- package/src/mergeWith.js +29 -0
- package/src/min.js +1 -1
- package/src/minBy.js +4 -2
- package/src/modulo.js +1 -1
- package/src/move.js +8 -6
- package/src/multiply.js +1 -1
- package/src/negate.js +1 -1
- package/src/none.js +4 -4
- package/src/not.js +1 -1
- package/src/nth.js +6 -6
- package/src/objOf.js +3 -5
- package/src/of.js +2 -2
- package/src/omit.js +8 -8
- package/src/on.js +16 -0
- package/src/once.js +6 -6
- package/src/or.js +1 -1
- package/src/over.js +5 -3
- package/src/partial.js +3 -3
- package/src/partialObject.js +15 -0
- package/src/partition.js +18 -16
- package/src/path.js +9 -8
- package/src/pathEq.js +6 -4
- package/src/pathOr.js +6 -4
- package/src/paths.js +3 -3
- package/src/pick.js +8 -8
- package/src/pickAll.js +9 -9
- package/src/pipe.js +85 -13
- package/src/pluck.js +4 -4
- package/src/prepend.js +3 -3
- package/src/product.js +2 -2
- package/src/prop.js +2 -2
- package/src/propEq.js +5 -3
- package/src/propIs.js +6 -4
- package/src/propOr.js +6 -4
- package/src/propSatisfies.js +10 -0
- package/src/props.js +6 -6
- package/src/range.js +4 -4
- package/src/reduce.js +11 -7
- package/src/reject.js +2 -2
- package/src/repeat.js +2 -2
- package/src/replace.js +4 -2
- package/src/reverse.js +4 -3
- package/src/set.js +9 -5
- package/src/slice.js +4 -2
- package/src/sort.js +2 -2
- package/src/sortBy.js +2 -2
- package/src/split.js +1 -1
- package/src/splitAt.js +9 -9
- package/src/splitEvery.js +6 -8
- package/src/splitWhen.js +10 -10
- package/src/startsWith.js +6 -5
- package/src/subtract.js +1 -1
- package/src/sum.js +1 -1
- package/src/symmetricDifference.js +7 -9
- package/src/tail.js +2 -2
- package/src/take.js +5 -3
- package/src/takeLast.js +5 -3
- package/src/takeLastWhile.js +7 -7
- package/src/takeWhile.js +8 -8
- package/src/tap.js +1 -1
- package/src/test.js +3 -5
- package/src/times.js +4 -4
- package/src/toLower.js +1 -1
- package/src/toPairs.js +1 -1
- package/src/toString.js +1 -1
- package/src/toUpper.js +1 -1
- package/src/transpose.js +3 -4
- package/src/trim.js +1 -1
- package/src/tryCatch.js +7 -5
- package/src/type.js +5 -5
- package/src/unapply.js +2 -2
- package/src/union.js +3 -3
- package/src/uniq.js +3 -3
- package/src/uniqWith.js +12 -8
- package/src/unless.js +3 -3
- package/src/unwind.js +15 -0
- package/src/update.js +8 -4
- package/src/values.js +2 -2
- package/src/view.js +2 -2
- package/src/when.js +4 -2
- package/src/where.js +5 -5
- package/src/whereAny.js +12 -0
- package/src/whereEq.js +7 -9
- package/src/without.js +4 -4
- package/src/xor.js +2 -2
- package/src/zip.js +3 -3
- package/src/zipObj.js +6 -4
- package/src/zipWith.js +6 -6
- package/src/isFunction.js +0 -5
package/package.json
CHANGED
|
@@ -1,113 +1,121 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
2
|
+
"name": "rambda",
|
|
3
|
+
"version": "7.1.0",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"populatedocs": "cd ../rambda-scripts && yarn populate:docs",
|
|
6
|
+
"populatedocs:x": "cd ../rambda-scripts && yarn populate:docs:rambdax",
|
|
7
|
+
"populatereadme": "cd ../rambda-scripts && yarn populate:readme",
|
|
8
|
+
"populatereadme:x": "cd ../rambda-scripts && yarn populate:readme:rambdax",
|
|
9
|
+
"out": "yarn populatedocs && yarn populatereadme && yarn immutable && yarn build",
|
|
10
|
+
"x": "yarn populatedocs:x && yarn populatereadme:x && yarn immutable:x",
|
|
11
|
+
"github": "cd ../rambda-scripts && yarn github",
|
|
12
|
+
"fix-docsify": "cd ../rambda-scripts && yarn fix-docsify:rambda",
|
|
13
|
+
"immutable": "cd ../rambda-scripts && yarn immutable:rambda",
|
|
14
|
+
"immutable:x": "cd ../rambda-scripts && yarn immutable:rambdax",
|
|
15
|
+
"usedby": "cd ../rambda-scripts && yarn usedby",
|
|
16
|
+
"lint:all": "cd ../rambda-scripts && yarn lint",
|
|
17
|
+
"lint:staged": "cd ../rambda-scripts && yarn lint:staged",
|
|
18
|
+
"lint": "yarn git:add && yarn lint:staged && yarn git:add",
|
|
19
|
+
"git:add": "git add -A",
|
|
20
|
+
"build": "yarn build:main && yarn build:web",
|
|
21
|
+
"build:web": "cross-env NODE_ENV=build rollup -c files/rollup.web.config.js",
|
|
22
|
+
"build:main": "cross-env NODE_ENV=build rollup -c files/rollup.config.js",
|
|
23
|
+
"docs": "npx docsify-cli init ./docs && yarn fix-docsify",
|
|
24
|
+
"new": "cd ../rambda-scripts && yarn new",
|
|
25
|
+
"test:all": "jest source -u --bail=false",
|
|
26
|
+
"test": "jest -o --watch",
|
|
27
|
+
"cover:spec": "jest source --coverage --no-cache -w 1",
|
|
28
|
+
"cover": "yarn typings && yarn cover:spec",
|
|
29
|
+
"build:step": "yarn populatedocs && yarn populatereadme && yarn build:main",
|
|
30
|
+
"benchmark:check:apply": "cd ../rambda-scripts && yarn check-benchmark",
|
|
31
|
+
"benchmark:check": "yarn build:step && METHOD=compose yarn benchmark:check:apply",
|
|
32
|
+
"benchmark:single": "cd ../rambda-scripts && METHOD=pipe RAMBDA_RUN_ALL=ON RAMBDA_RUN_INDEXES=ON yarn benchmark",
|
|
33
|
+
"benchmark:all": "yarn build:step && cd ../rambda-scripts && yarn benchmark:all",
|
|
34
|
+
"benchmark": "yarn build:step && yarn benchmark:single",
|
|
35
|
+
"typings": "dtslint --localTs ./node_modules/typescript/lib --expectOnly ./source",
|
|
36
|
+
"fix": "mkdir $HOME/.dts/perf -p"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@babel/core": "7.17.10",
|
|
41
|
+
"@babel/plugin-proposal-object-rest-spread": "7.17.3",
|
|
42
|
+
"@babel/preset-env": "7.17.10",
|
|
43
|
+
"@rollup/plugin-babel": "5.3.1",
|
|
44
|
+
"@rollup/plugin-commonjs": "22.0.0",
|
|
45
|
+
"@rollup/plugin-json": "4.1.0",
|
|
46
|
+
"@rollup/plugin-node-resolve": "13.2.1",
|
|
47
|
+
"@rollup/plugin-replace": "4.0.0",
|
|
48
|
+
"@types/jest": "27.4.1",
|
|
49
|
+
"@types/ramda": "0.28.11",
|
|
50
|
+
"combinate": "1.1.11",
|
|
51
|
+
"cross-env": "7.0.3",
|
|
52
|
+
"dtslint": "4.2.1",
|
|
53
|
+
"helpers-fn": "1.6.0",
|
|
54
|
+
"is-ci": "3.0.1",
|
|
55
|
+
"jest": "28.0.3",
|
|
56
|
+
"jest-extended": "2.0.0",
|
|
57
|
+
"lodash": "4.17.21",
|
|
58
|
+
"rambdax": "8.0.1",
|
|
59
|
+
"ramda": "0.28.0",
|
|
60
|
+
"rollup": "2.70.2",
|
|
61
|
+
"rollup-plugin-cleanup": "3.2.1",
|
|
62
|
+
"rollup-plugin-sourcemaps": "0.6.3",
|
|
63
|
+
"rollup-plugin-uglify": "6.0.4",
|
|
64
|
+
"typescript": "4.6.4"
|
|
65
|
+
},
|
|
66
|
+
"jest": {
|
|
67
|
+
"testEnvironment": "node",
|
|
68
|
+
"testRegex": ".*\\.spec\\.js$",
|
|
69
|
+
"setupFilesAfterEnv": [
|
|
70
|
+
"./files/testSetup.js"
|
|
71
|
+
],
|
|
72
|
+
"collectCoverageFrom": [
|
|
73
|
+
"source/*.js",
|
|
74
|
+
"!_internals",
|
|
75
|
+
"!benchmarks"
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
"files": [
|
|
79
|
+
"dist",
|
|
80
|
+
"src",
|
|
81
|
+
"README.md",
|
|
82
|
+
"CHANGELOG.md",
|
|
83
|
+
"index.d.ts",
|
|
84
|
+
"immutable.d.ts",
|
|
85
|
+
"immutable.js"
|
|
86
|
+
],
|
|
87
|
+
"repository": {
|
|
88
|
+
"type": "git",
|
|
89
|
+
"url": "git+https://github.com/selfrefactor/rambda.git"
|
|
90
|
+
},
|
|
91
|
+
"license": "MIT",
|
|
92
|
+
"author": "self_refactor",
|
|
93
|
+
"description": "Lightweight and faster alternative to Ramda with included TS definitions",
|
|
94
|
+
"sideEffects": false,
|
|
95
|
+
"main": "./dist/rambda.js",
|
|
96
|
+
"umd": "./dist/rambda.umd.js",
|
|
97
|
+
"module": "./dist/rambda.mjs",
|
|
98
|
+
"types": "./index.d.ts",
|
|
99
|
+
"exports": {
|
|
100
|
+
".": {
|
|
101
|
+
"import": "./dist/rambda.mjs",
|
|
102
|
+
"require": "./dist/rambda.js",
|
|
103
|
+
"default": "./dist/rambda.js",
|
|
104
|
+
"types": "./index.d.ts"
|
|
105
|
+
},
|
|
106
|
+
"./immutable": {
|
|
107
|
+
"import": "./immutable.js",
|
|
108
|
+
"require": "./immutable.js",
|
|
109
|
+
"default": "./immutable.js",
|
|
110
|
+
"types": "./immutable.d.ts"
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
"keywords": [
|
|
114
|
+
"ramda",
|
|
115
|
+
"fp",
|
|
116
|
+
"functional",
|
|
117
|
+
"utility",
|
|
118
|
+
"lodash"
|
|
119
|
+
],
|
|
120
|
+
"homepage": "https://github.com/selfrefactor/rambda#readme"
|
|
113
121
|
}
|
package/src/F.js
CHANGED
package/src/T.js
CHANGED
package/src/_internals/_keys.js
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// SameValue algorithm
|
|
4
|
-
if (a === b) {
|
|
5
|
-
// Steps 1-5, 7-10
|
|
6
|
-
// Steps 6.b-6.e: +0 != -0
|
|
1
|
+
export function _objectIs(a, b){
|
|
2
|
+
if (a === b){
|
|
7
3
|
return a !== 0 || 1 / a === 1 / b
|
|
8
4
|
}
|
|
9
5
|
|
|
10
|
-
// Step 6.a: NaN === NaN
|
|
11
6
|
return a !== a && b !== b
|
|
12
7
|
}
|
|
13
8
|
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
export default function baseSlice(
|
|
1
|
+
export default function baseSlice(
|
|
2
|
+
array, start, end
|
|
3
|
+
){
|
|
2
4
|
let index = -1
|
|
3
|
-
let {length} = array
|
|
5
|
+
let { length } = array
|
|
4
6
|
|
|
5
7
|
end = end > length ? length : end
|
|
6
|
-
if (end < 0)
|
|
8
|
+
if (end < 0){
|
|
7
9
|
end += length
|
|
8
10
|
}
|
|
9
|
-
length = start > end ? 0 :
|
|
11
|
+
length = start > end ? 0 : end - start >>> 0
|
|
10
12
|
start >>>= 0
|
|
11
13
|
|
|
12
14
|
const result = Array(length)
|
|
13
15
|
|
|
14
|
-
while (++index < length)
|
|
15
|
-
result[index] = array[index + start]
|
|
16
|
+
while (++index < length){
|
|
17
|
+
result[ index ] = array[ index + start ]
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
return result
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {type} from '../type'
|
|
2
|
-
import {_isArray} from './_isArray'
|
|
1
|
+
import { type } from '../type.js'
|
|
2
|
+
import { _isArray } from './_isArray.js'
|
|
3
3
|
|
|
4
|
-
export function isFalsy(x)
|
|
5
|
-
if (_isArray(x))
|
|
4
|
+
export function isFalsy(x){
|
|
5
|
+
if (_isArray(x)){
|
|
6
6
|
return x.length === 0
|
|
7
7
|
}
|
|
8
|
-
if (type(x) === 'Object')
|
|
8
|
+
if (type(x) === 'Object'){
|
|
9
9
|
return Object.keys(x).length === 0
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {type} from '../type'
|
|
2
|
-
import {_isArray} from './_isArray'
|
|
1
|
+
import { type } from '../type.js'
|
|
2
|
+
import { _isArray } from './_isArray.js'
|
|
3
3
|
|
|
4
|
-
export function isTruthy(x)
|
|
5
|
-
if (_isArray(x))
|
|
4
|
+
export function isTruthy(x){
|
|
5
|
+
if (_isArray(x)){
|
|
6
6
|
return x.length > 0
|
|
7
7
|
}
|
|
8
|
-
if (type(x) === 'Object')
|
|
8
|
+
if (type(x) === 'Object'){
|
|
9
9
|
return Object.keys(x).length > 0
|
|
10
10
|
}
|
|
11
11
|
|
package/src/_internals/set.js
CHANGED
|
@@ -1,35 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { _indexOf } from '../equals.js'
|
|
2
|
+
import { type as typeMethod } from '../type.js'
|
|
3
3
|
|
|
4
|
-
export class _Set
|
|
5
|
-
constructor()
|
|
4
|
+
export class _Set{
|
|
5
|
+
constructor(){
|
|
6
6
|
this.set = new Set()
|
|
7
7
|
this.items = {}
|
|
8
8
|
}
|
|
9
|
-
|
|
9
|
+
|
|
10
|
+
checkUniqueness(item){
|
|
10
11
|
const type = typeMethod(item)
|
|
11
|
-
if (['Null', 'Undefined', 'NaN'].includes(type))
|
|
12
|
-
if (type in this.items)
|
|
12
|
+
if ([ 'Null', 'Undefined', 'NaN' ].includes(type)){
|
|
13
|
+
if (type in this.items){
|
|
13
14
|
return false
|
|
14
15
|
}
|
|
15
|
-
this.items[type] = true
|
|
16
|
+
this.items[ type ] = true
|
|
17
|
+
|
|
16
18
|
return true
|
|
17
19
|
}
|
|
18
|
-
if (!['Object', 'Array'].includes(type))
|
|
20
|
+
if (![ 'Object', 'Array' ].includes(type)){
|
|
19
21
|
const prevSize = this.set.size
|
|
20
22
|
this.set.add(item)
|
|
23
|
+
|
|
21
24
|
return this.set.size !== prevSize
|
|
22
25
|
}
|
|
23
26
|
|
|
24
|
-
if (!(type in this.items))
|
|
25
|
-
this.items[type] = [item]
|
|
27
|
+
if (!(type in this.items)){
|
|
28
|
+
this.items[ type ] = [ item ]
|
|
29
|
+
|
|
26
30
|
return true
|
|
27
31
|
}
|
|
28
32
|
|
|
29
|
-
if (_indexOf(item, this.items[type]) === -1)
|
|
30
|
-
this.items[type].push(item)
|
|
33
|
+
if (_indexOf(item, this.items[ type ]) === -1){
|
|
34
|
+
this.items[ type ].push(item)
|
|
35
|
+
|
|
31
36
|
return true
|
|
32
37
|
}
|
|
38
|
+
|
|
33
39
|
return false
|
|
34
40
|
}
|
|
35
41
|
}
|
package/src/add.js
CHANGED
package/src/adjust.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { cloneList } from './_internals/cloneList.js'
|
|
2
|
+
import { curry } from './curry.js'
|
|
3
3
|
|
|
4
|
-
function adjustFn(
|
|
4
|
+
function adjustFn(
|
|
5
|
+
index, replaceFn, list
|
|
6
|
+
){
|
|
5
7
|
const actualIndex = index < 0 ? list.length + index : index
|
|
6
8
|
if (index >= list.length || actualIndex < 0) return list
|
|
7
9
|
|
|
8
10
|
const clone = cloneList(list)
|
|
9
|
-
clone[actualIndex] = replaceFn(clone[actualIndex])
|
|
11
|
+
clone[ actualIndex ] = replaceFn(clone[ actualIndex ])
|
|
10
12
|
|
|
11
13
|
return clone
|
|
12
14
|
}
|
package/src/all.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export function all(predicate, list)
|
|
1
|
+
export function all(predicate, list){
|
|
2
2
|
if (arguments.length === 1) return _list => all(predicate, _list)
|
|
3
3
|
|
|
4
|
-
for (let i = 0; i < list.length; i++)
|
|
5
|
-
if (!predicate(list[i])) return false
|
|
4
|
+
for (let i = 0; i < list.length; i++){
|
|
5
|
+
if (!predicate(list[ i ])) return false
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
return true
|
package/src/allPass.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export function allPass(predicates)
|
|
1
|
+
export function allPass(predicates){
|
|
2
2
|
return (...input) => {
|
|
3
3
|
let counter = 0
|
|
4
|
-
while (counter < predicates.length)
|
|
5
|
-
if (!predicates[counter](...input))
|
|
4
|
+
while (counter < predicates.length){
|
|
5
|
+
if (!predicates[ counter ](...input)){
|
|
6
6
|
return false
|
|
7
7
|
}
|
|
8
8
|
counter++
|
package/src/always.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export function always(x)
|
|
2
|
-
return
|
|
1
|
+
export function always(x){
|
|
2
|
+
return _ => x
|
|
3
3
|
}
|
package/src/and.js
CHANGED
package/src/any.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export function any(predicate, list)
|
|
1
|
+
export function any(predicate, list){
|
|
2
2
|
if (arguments.length === 1) return _list => any(predicate, _list)
|
|
3
3
|
|
|
4
4
|
let counter = 0
|
|
5
|
-
while (counter < list.length)
|
|
6
|
-
if (predicate(list[counter], counter))
|
|
5
|
+
while (counter < list.length){
|
|
6
|
+
if (predicate(list[ counter ], counter)){
|
|
7
7
|
return true
|
|
8
8
|
}
|
|
9
9
|
counter++
|
package/src/anyPass.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export function anyPass(predicates)
|
|
1
|
+
export function anyPass(predicates){
|
|
2
2
|
return (...input) => {
|
|
3
3
|
let counter = 0
|
|
4
|
-
while (counter < predicates.length)
|
|
5
|
-
if (predicates[counter](...input))
|
|
4
|
+
while (counter < predicates.length){
|
|
5
|
+
if (predicates[ counter ](...input)){
|
|
6
6
|
return true
|
|
7
7
|
}
|
|
8
8
|
counter++
|
package/src/append.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {cloneList} from './_internals/cloneList'
|
|
1
|
+
import { cloneList } from './_internals/cloneList.js'
|
|
2
2
|
|
|
3
|
-
export function append(x, input)
|
|
3
|
+
export function append(x, input){
|
|
4
4
|
if (arguments.length === 1) return _input => append(x, _input)
|
|
5
5
|
|
|
6
6
|
if (typeof input === 'string') return input.split('').concat(x)
|
package/src/apply.js
CHANGED