rambda 8.2.0 → 8.4.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 +523 -334
- package/dist/rambda.js +286 -279
- package/dist/rambda.umd.js +1 -1
- package/immutable.d.ts +83 -31
- package/index.d.ts +83 -31
- package/package.json +106 -105
- package/rambda.js +7 -0
- package/src/_internals/_arity.js +64 -0
- package/src/_internals/compare.js +3 -0
- package/src/_internals/createPath.js +5 -1
- package/src/_internals/createPathInput.js +7 -0
- package/src/_internals/includes.js +12 -0
- package/src/_internals/isInteger.js +5 -0
- package/src/assoc.js +1 -1
- package/src/assocPath.js +9 -13
- package/src/binary.js +5 -0
- package/src/call.js +1 -0
- package/src/collectBy.js +27 -0
- package/src/comparator.js +5 -0
- package/src/composeWith.js +33 -0
- package/src/curryN.js +2 -65
- package/src/dissocPath.js +47 -0
- package/src/equals.js +40 -52
- package/src/omit.js +4 -6
- package/src/partial.js +9 -3
- package/src/pipe.js +1 -67
- package/src/removeIndex.js +7 -0
package/src/assocPath.js
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
import { cloneList } from './_internals/cloneList.js'
|
|
2
|
+
import { createPath } from './_internals/createPath.js'
|
|
2
3
|
import { isArray } from './_internals/isArray.js'
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
4
|
+
import { isIndexInteger } from './_internals/isInteger.js'
|
|
5
|
+
import { assocFn } from './assoc.js'
|
|
5
6
|
import { curry } from './curry.js'
|
|
6
7
|
|
|
7
|
-
function assocPathFn(
|
|
8
|
+
export function assocPathFn(
|
|
8
9
|
path, newValue, input
|
|
9
10
|
){
|
|
10
|
-
const pathArrValue =
|
|
11
|
-
|
|
12
|
-
path.split('.').map(x => isInteger(Number(x)) ? Number(x) : x) :
|
|
13
|
-
path
|
|
14
|
-
if (pathArrValue.length === 0){
|
|
15
|
-
return newValue
|
|
16
|
-
}
|
|
11
|
+
const pathArrValue = createPath(path)
|
|
12
|
+
if (pathArrValue.length === 0) return newValue
|
|
17
13
|
|
|
18
14
|
const index = pathArrValue[ 0 ]
|
|
19
15
|
if (pathArrValue.length > 1){
|
|
@@ -23,7 +19,7 @@ function assocPathFn(
|
|
|
23
19
|
!input.hasOwnProperty(index)
|
|
24
20
|
|
|
25
21
|
const nextInput = condition ?
|
|
26
|
-
|
|
22
|
+
isIndexInteger(pathArrValue[ 1 ]) ?
|
|
27
23
|
[] :
|
|
28
24
|
{} :
|
|
29
25
|
input[ index ]
|
|
@@ -35,14 +31,14 @@ function assocPathFn(
|
|
|
35
31
|
)
|
|
36
32
|
}
|
|
37
33
|
|
|
38
|
-
if (
|
|
34
|
+
if (isIndexInteger(index) && isArray(input)){
|
|
39
35
|
const arr = cloneList(input)
|
|
40
36
|
arr[ index ] = newValue
|
|
41
37
|
|
|
42
38
|
return arr
|
|
43
39
|
}
|
|
44
40
|
|
|
45
|
-
return
|
|
41
|
+
return assocFn(
|
|
46
42
|
index, newValue, input
|
|
47
43
|
)
|
|
48
44
|
}
|
package/src/binary.js
ADDED
package/src/call.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const call = (fn, ...inputs) => fn(...inputs)
|
package/src/collectBy.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { reduce } from './reduce.js'
|
|
2
|
+
|
|
3
|
+
export function collectBy(fn, list){
|
|
4
|
+
if (arguments.length === 1){
|
|
5
|
+
return _list => collectBy(fn, _list)
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const group = reduce(
|
|
9
|
+
(o, x) => {
|
|
10
|
+
const tag = fn(x)
|
|
11
|
+
if (o[ tag ] === undefined){
|
|
12
|
+
o[ tag ] = []
|
|
13
|
+
}
|
|
14
|
+
o[ tag ].push(x)
|
|
15
|
+
|
|
16
|
+
return o
|
|
17
|
+
},
|
|
18
|
+
{},
|
|
19
|
+
list
|
|
20
|
+
)
|
|
21
|
+
const newList = []
|
|
22
|
+
for (const tag in group){
|
|
23
|
+
newList.push(group[ tag ])
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return newList
|
|
27
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { _arity } from './_internals/_arity.js'
|
|
2
|
+
import { head } from './head.js'
|
|
3
|
+
import { identity } from './identity.js'
|
|
4
|
+
import { reduce } from './reduce.js'
|
|
5
|
+
import { reverse } from './reverse.js'
|
|
6
|
+
import { tail } from './tail.js'
|
|
7
|
+
|
|
8
|
+
export function pipeWith(xf, list){
|
|
9
|
+
if (list.length <= 0){
|
|
10
|
+
return identity
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const headList = head(list)
|
|
14
|
+
const tailList = tail(list)
|
|
15
|
+
|
|
16
|
+
return _arity(headList.length, function (){
|
|
17
|
+
return reduce(
|
|
18
|
+
function (result, f){
|
|
19
|
+
return xf.call(
|
|
20
|
+
this, f, result
|
|
21
|
+
)
|
|
22
|
+
},
|
|
23
|
+
headList.apply(this, arguments),
|
|
24
|
+
tailList
|
|
25
|
+
)
|
|
26
|
+
})
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function composeWith(xf, list){
|
|
30
|
+
if (arguments.length === 1) return _list => composeWith(xf, _list)
|
|
31
|
+
|
|
32
|
+
return pipeWith.apply(this, [ xf, reverse(list) ])
|
|
33
|
+
}
|
package/src/curryN.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { _arity } from './_internals/_arity.js'
|
|
2
|
+
|
|
1
3
|
function _curryN(
|
|
2
4
|
n, cache, fn
|
|
3
5
|
){
|
|
@@ -25,71 +27,6 @@ function _curryN(
|
|
|
25
27
|
}
|
|
26
28
|
}
|
|
27
29
|
|
|
28
|
-
function _arity(n, fn){
|
|
29
|
-
switch (n){
|
|
30
|
-
case 0:
|
|
31
|
-
return function (){
|
|
32
|
-
return fn.apply(this, arguments)
|
|
33
|
-
}
|
|
34
|
-
case 1:
|
|
35
|
-
return function (_1){
|
|
36
|
-
return fn.apply(this, arguments)
|
|
37
|
-
}
|
|
38
|
-
case 2:
|
|
39
|
-
return function (_1, _2){
|
|
40
|
-
return fn.apply(this, arguments)
|
|
41
|
-
}
|
|
42
|
-
case 3:
|
|
43
|
-
return function (
|
|
44
|
-
_1, _2, _3
|
|
45
|
-
){
|
|
46
|
-
return fn.apply(this, arguments)
|
|
47
|
-
}
|
|
48
|
-
case 4:
|
|
49
|
-
return function (
|
|
50
|
-
_1, _2, _3, _4
|
|
51
|
-
){
|
|
52
|
-
return fn.apply(this, arguments)
|
|
53
|
-
}
|
|
54
|
-
case 5:
|
|
55
|
-
return function (
|
|
56
|
-
_1, _2, _3, _4, _5
|
|
57
|
-
){
|
|
58
|
-
return fn.apply(this, arguments)
|
|
59
|
-
}
|
|
60
|
-
case 6:
|
|
61
|
-
return function (
|
|
62
|
-
_1, _2, _3, _4, _5, _6
|
|
63
|
-
){
|
|
64
|
-
return fn.apply(this, arguments)
|
|
65
|
-
}
|
|
66
|
-
case 7:
|
|
67
|
-
return function (
|
|
68
|
-
_1, _2, _3, _4, _5, _6, _7
|
|
69
|
-
){
|
|
70
|
-
return fn.apply(this, arguments)
|
|
71
|
-
}
|
|
72
|
-
case 8:
|
|
73
|
-
return function (
|
|
74
|
-
_1, _2, _3, _4, _5, _6, _7, _8
|
|
75
|
-
){
|
|
76
|
-
return fn.apply(this, arguments)
|
|
77
|
-
}
|
|
78
|
-
case 9:
|
|
79
|
-
return function (
|
|
80
|
-
_1, _2, _3, _4, _5, _6, _7, _8, _9
|
|
81
|
-
){
|
|
82
|
-
return fn.apply(this, arguments)
|
|
83
|
-
}
|
|
84
|
-
default:
|
|
85
|
-
return function (
|
|
86
|
-
_1, _2, _3, _4, _5, _6, _7, _8, _9, _10
|
|
87
|
-
){
|
|
88
|
-
return fn.apply(this, arguments)
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
30
|
export function curryN(n, fn){
|
|
94
31
|
if (arguments.length === 1) return _fn => curryN(n, _fn)
|
|
95
32
|
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { createPath } from '../src/_internals/createPath.js'
|
|
2
|
+
import { isArray } from './_internals/isArray.js'
|
|
3
|
+
import { isIndexInteger } from './_internals/isInteger.js'
|
|
4
|
+
import { omit } from './omit.js'
|
|
5
|
+
import { path } from './path.js'
|
|
6
|
+
import { removeIndex } from './removeIndex.js'
|
|
7
|
+
import { update } from './update.js'
|
|
8
|
+
|
|
9
|
+
export function dissocPath(pathInput, input){
|
|
10
|
+
if (arguments.length === 1) return _obj => dissocPath(pathInput, _obj)
|
|
11
|
+
|
|
12
|
+
const pathArrValue = createPath(pathInput)
|
|
13
|
+
// this {...input} spread could be done to satisfy ramda specs, but this is done on so many places
|
|
14
|
+
// TODO: add warning that Rambda simply returns input if path is empty
|
|
15
|
+
if (pathArrValue.length === 0) return input
|
|
16
|
+
|
|
17
|
+
const pathResult = path(pathArrValue, input)
|
|
18
|
+
if (pathResult === undefined) return input
|
|
19
|
+
|
|
20
|
+
const index = pathArrValue[ 0 ]
|
|
21
|
+
const condition =
|
|
22
|
+
typeof input !== 'object' ||
|
|
23
|
+
input === null ||
|
|
24
|
+
!input.hasOwnProperty(index)
|
|
25
|
+
if (pathArrValue.length > 1){
|
|
26
|
+
const nextInput = condition ?
|
|
27
|
+
isIndexInteger(pathArrValue[ 1 ]) ?
|
|
28
|
+
[] :
|
|
29
|
+
{} :
|
|
30
|
+
input[ index ]
|
|
31
|
+
const nextPathInput = Array.prototype.slice.call(pathArrValue, 1)
|
|
32
|
+
const intermediateResult = dissocPath(
|
|
33
|
+
nextPathInput, nextInput, input
|
|
34
|
+
)
|
|
35
|
+
if (isArray(input)) return update(
|
|
36
|
+
index, intermediateResult, input
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
...input,
|
|
41
|
+
[ index ] : intermediateResult,
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (isArray(input)) return removeIndex(index, input)
|
|
45
|
+
|
|
46
|
+
return omit([ index ], input)
|
|
47
|
+
}
|
package/src/equals.js
CHANGED
|
@@ -2,43 +2,39 @@ import { isArray } from './_internals/isArray.js'
|
|
|
2
2
|
import { type } from './type.js'
|
|
3
3
|
|
|
4
4
|
export function _lastIndexOf(valueToFind, list){
|
|
5
|
-
if (!isArray(list))
|
|
5
|
+
if (!isArray(list))
|
|
6
6
|
throw new Error(`Cannot read property 'indexOf' of ${ list }`)
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
const typeOfValue = type(valueToFind)
|
|
9
|
-
if (![ '
|
|
9
|
+
if (![ 'Array', 'NaN', 'Object', 'RegExp' ].includes(typeOfValue))
|
|
10
10
|
return list.lastIndexOf(valueToFind)
|
|
11
11
|
|
|
12
12
|
const { length } = list
|
|
13
13
|
let index = length
|
|
14
14
|
let foundIndex = -1
|
|
15
15
|
|
|
16
|
-
while (--index > -1 && foundIndex === -1)
|
|
17
|
-
if (equals(list[ index ], valueToFind))
|
|
16
|
+
while (--index > -1 && foundIndex === -1)
|
|
17
|
+
if (equals(list[ index ], valueToFind))
|
|
18
18
|
foundIndex = index
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
19
|
|
|
22
20
|
return foundIndex
|
|
23
21
|
}
|
|
24
22
|
|
|
25
23
|
export function _indexOf(valueToFind, list){
|
|
26
|
-
if (!isArray(list))
|
|
24
|
+
if (!isArray(list))
|
|
27
25
|
throw new Error(`Cannot read property 'indexOf' of ${ list }`)
|
|
28
|
-
|
|
26
|
+
|
|
29
27
|
const typeOfValue = type(valueToFind)
|
|
30
|
-
if (![ '
|
|
28
|
+
if (![ 'Array', 'NaN', 'Object', 'RegExp' ].includes(typeOfValue))
|
|
31
29
|
return list.indexOf(valueToFind)
|
|
32
30
|
|
|
33
31
|
let index = -1
|
|
34
32
|
let foundIndex = -1
|
|
35
33
|
const { length } = list
|
|
36
34
|
|
|
37
|
-
while (++index < length && foundIndex === -1)
|
|
38
|
-
if (equals(list[ index ], valueToFind))
|
|
35
|
+
while (++index < length && foundIndex === -1)
|
|
36
|
+
if (equals(list[ index ], valueToFind))
|
|
39
37
|
foundIndex = index
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
38
|
|
|
43
39
|
return foundIndex
|
|
44
40
|
}
|
|
@@ -46,17 +42,16 @@ export function _indexOf(valueToFind, list){
|
|
|
46
42
|
function _arrayFromIterator(iter){
|
|
47
43
|
const list = []
|
|
48
44
|
let next
|
|
49
|
-
while (!(next = iter.next()).done)
|
|
45
|
+
while (!(next = iter.next()).done)
|
|
50
46
|
list.push(next.value)
|
|
51
|
-
}
|
|
52
47
|
|
|
53
48
|
return list
|
|
54
49
|
}
|
|
55
50
|
|
|
56
|
-
function
|
|
57
|
-
if (a.size !== b.size)
|
|
51
|
+
function _compareSets(a, b){
|
|
52
|
+
if (a.size !== b.size)
|
|
58
53
|
return false
|
|
59
|
-
|
|
54
|
+
|
|
60
55
|
const aList = _arrayFromIterator(a.values())
|
|
61
56
|
const bList = _arrayFromIterator(b.values())
|
|
62
57
|
|
|
@@ -65,11 +60,11 @@ function _equalsSets(a, b){
|
|
|
65
60
|
return filtered.length === 0
|
|
66
61
|
}
|
|
67
62
|
|
|
68
|
-
function
|
|
69
|
-
|
|
70
|
-
if (
|
|
63
|
+
function compareErrors(a, b){
|
|
64
|
+
if (a.message !== b.message) return false
|
|
65
|
+
if (a.toString !== b.toString) return false
|
|
71
66
|
|
|
72
|
-
return
|
|
67
|
+
return a.toString() === b.toString()
|
|
73
68
|
}
|
|
74
69
|
|
|
75
70
|
function parseDate(maybeDate){
|
|
@@ -90,40 +85,36 @@ export function equals(a, b){
|
|
|
90
85
|
const aType = type(a)
|
|
91
86
|
|
|
92
87
|
if (aType !== type(b)) return false
|
|
93
|
-
if (aType === 'Function')
|
|
88
|
+
if (aType === 'Function')
|
|
94
89
|
return a.name === undefined ? false : a.name === b.name
|
|
95
|
-
}
|
|
96
90
|
|
|
97
|
-
if ([ 'NaN', '
|
|
91
|
+
if ([ 'NaN', 'Null', 'Undefined' ].includes(aType)) return true
|
|
98
92
|
|
|
99
|
-
if (
|
|
93
|
+
if ([ 'BigInt', 'Number' ].includes(aType)){
|
|
100
94
|
if (Object.is(-0, a) !== Object.is(-0, b)) return false
|
|
101
95
|
|
|
102
96
|
return a.toString() === b.toString()
|
|
103
97
|
}
|
|
104
98
|
|
|
105
|
-
if ([ '
|
|
99
|
+
if ([ 'Boolean', 'String' ].includes(aType))
|
|
106
100
|
return a.toString() === b.toString()
|
|
107
|
-
}
|
|
108
101
|
|
|
109
102
|
if (aType === 'Array'){
|
|
110
103
|
const aClone = Array.from(a)
|
|
111
104
|
const bClone = Array.from(b)
|
|
112
105
|
|
|
113
|
-
if (aClone.toString() !== bClone.toString())
|
|
106
|
+
if (aClone.toString() !== bClone.toString())
|
|
114
107
|
return false
|
|
115
|
-
}
|
|
116
108
|
|
|
117
109
|
let loopArrayFlag = true
|
|
118
110
|
aClone.forEach((aCloneInstance, aCloneIndex) => {
|
|
119
|
-
if (loopArrayFlag)
|
|
111
|
+
if (loopArrayFlag)
|
|
120
112
|
if (
|
|
121
113
|
aCloneInstance !== bClone[ aCloneIndex ] &&
|
|
122
114
|
!equals(aCloneInstance, bClone[ aCloneIndex ])
|
|
123
|
-
)
|
|
115
|
+
)
|
|
124
116
|
loopArrayFlag = false
|
|
125
|
-
|
|
126
|
-
}
|
|
117
|
+
|
|
127
118
|
})
|
|
128
119
|
|
|
129
120
|
return loopArrayFlag
|
|
@@ -132,34 +123,31 @@ export function equals(a, b){
|
|
|
132
123
|
const aRegex = parseRegex(a)
|
|
133
124
|
const bRegex = parseRegex(b)
|
|
134
125
|
|
|
135
|
-
if (aRegex[ 0 ])
|
|
126
|
+
if (aRegex[ 0 ])
|
|
136
127
|
return bRegex[ 0 ] ? aRegex[ 1 ] === bRegex[ 1 ] : false
|
|
137
|
-
|
|
128
|
+
else if (bRegex[ 0 ]) return false
|
|
138
129
|
|
|
139
130
|
const aDate = parseDate(a)
|
|
140
131
|
const bDate = parseDate(b)
|
|
141
132
|
|
|
142
|
-
if (aDate[ 0 ])
|
|
133
|
+
if (aDate[ 0 ])
|
|
143
134
|
return bDate[ 0 ] ? aDate[ 1 ] === bDate[ 1 ] : false
|
|
144
|
-
|
|
135
|
+
else if (bDate[ 0 ]) return false
|
|
145
136
|
|
|
146
|
-
|
|
147
|
-
|
|
137
|
+
if (a instanceof Error){
|
|
138
|
+
if (!(b instanceof Error)) return false
|
|
148
139
|
|
|
149
|
-
|
|
150
|
-
return bError[ 0 ] ?
|
|
151
|
-
aError[ 0 ] === bError[ 0 ] && aError[ 1 ] === bError[ 1 ] :
|
|
152
|
-
false
|
|
153
|
-
}
|
|
154
|
-
if (aType === 'Set'){
|
|
155
|
-
return _equalsSets(a, b)
|
|
140
|
+
return compareErrors(a, b)
|
|
156
141
|
}
|
|
142
|
+
|
|
143
|
+
if (aType === 'Set')
|
|
144
|
+
return _compareSets(a, b)
|
|
145
|
+
|
|
157
146
|
if (aType === 'Object'){
|
|
158
147
|
const aKeys = Object.keys(a)
|
|
159
148
|
|
|
160
|
-
if (aKeys.length !== Object.keys(b).length)
|
|
149
|
+
if (aKeys.length !== Object.keys(b).length)
|
|
161
150
|
return false
|
|
162
|
-
}
|
|
163
151
|
|
|
164
152
|
let loopObjectFlag = true
|
|
165
153
|
aKeys.forEach(aKeyInstance => {
|
|
@@ -167,9 +155,9 @@ export function equals(a, b){
|
|
|
167
155
|
const aValue = a[ aKeyInstance ]
|
|
168
156
|
const bValue = b[ aKeyInstance ]
|
|
169
157
|
|
|
170
|
-
if (aValue !== bValue && !equals(aValue, bValue))
|
|
158
|
+
if (aValue !== bValue && !equals(aValue, bValue))
|
|
171
159
|
loopObjectFlag = false
|
|
172
|
-
|
|
160
|
+
|
|
173
161
|
}
|
|
174
162
|
})
|
|
175
163
|
|
package/src/omit.js
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
import { createPath } from './_internals/createPath.js'
|
|
2
|
+
import { includes } from './_internals/includes.js'
|
|
2
3
|
|
|
3
4
|
export function omit(propsToOmit, obj){
|
|
4
5
|
if (arguments.length === 1) return _obj => omit(propsToOmit, _obj)
|
|
5
6
|
|
|
6
|
-
if (obj === null || obj === undefined)
|
|
7
|
+
if (obj === null || obj === undefined)
|
|
7
8
|
return undefined
|
|
8
|
-
}
|
|
9
9
|
|
|
10
10
|
const propsToOmitValue = createPath(propsToOmit, ',')
|
|
11
11
|
const willReturn = {}
|
|
12
12
|
|
|
13
|
-
for (const key in obj)
|
|
14
|
-
if (!
|
|
13
|
+
for (const key in obj)
|
|
14
|
+
if (!includes(key, propsToOmitValue))
|
|
15
15
|
willReturn[ key ] = obj[ key ]
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
16
|
|
|
19
17
|
return willReturn
|
|
20
18
|
}
|
package/src/partial.js
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
|
+
import { isArray } from './_internals/isArray.js'
|
|
2
|
+
|
|
1
3
|
export function partial(fn, ...args){
|
|
2
4
|
const len = fn.length
|
|
3
5
|
|
|
6
|
+
// If a single array argument is given, those are the args (a la Ramda).
|
|
7
|
+
// Otherwise, the variadic arguments are the args.
|
|
8
|
+
const argList = args.length === 1 && isArray(args[0]) ? args[0] : args
|
|
9
|
+
|
|
4
10
|
return (...rest) => {
|
|
5
|
-
if (
|
|
6
|
-
return fn(...
|
|
11
|
+
if (argList.length + rest.length >= len){
|
|
12
|
+
return fn(...argList, ...rest)
|
|
7
13
|
}
|
|
8
14
|
|
|
9
|
-
return partial(fn, ...[ ...
|
|
15
|
+
return partial(fn, ...[ ...argList, ...rest ])
|
|
10
16
|
}
|
|
11
17
|
}
|
package/src/pipe.js
CHANGED
|
@@ -1,72 +1,6 @@
|
|
|
1
|
+
import { _arity } from './_internals/_arity.js'
|
|
1
2
|
import { reduceFn } from './reduce.js'
|
|
2
3
|
|
|
3
|
-
export function _arity(n, fn){
|
|
4
|
-
switch (n){
|
|
5
|
-
case 0:
|
|
6
|
-
return function (){
|
|
7
|
-
return fn.apply(this, arguments)
|
|
8
|
-
}
|
|
9
|
-
case 1:
|
|
10
|
-
return function (a0){
|
|
11
|
-
return fn.apply(this, arguments)
|
|
12
|
-
}
|
|
13
|
-
case 2:
|
|
14
|
-
return function (a0, a1){
|
|
15
|
-
return fn.apply(this, arguments)
|
|
16
|
-
}
|
|
17
|
-
case 3:
|
|
18
|
-
return function (
|
|
19
|
-
a0, a1, a2
|
|
20
|
-
){
|
|
21
|
-
return fn.apply(this, arguments)
|
|
22
|
-
}
|
|
23
|
-
case 4:
|
|
24
|
-
return function (
|
|
25
|
-
a0, a1, a2, a3
|
|
26
|
-
){
|
|
27
|
-
return fn.apply(this, arguments)
|
|
28
|
-
}
|
|
29
|
-
case 5:
|
|
30
|
-
return function (
|
|
31
|
-
a0, a1, a2, a3, a4
|
|
32
|
-
){
|
|
33
|
-
return fn.apply(this, arguments)
|
|
34
|
-
}
|
|
35
|
-
case 6:
|
|
36
|
-
return function (
|
|
37
|
-
a0, a1, a2, a3, a4, a5
|
|
38
|
-
){
|
|
39
|
-
return fn.apply(this, arguments)
|
|
40
|
-
}
|
|
41
|
-
case 7:
|
|
42
|
-
return function (
|
|
43
|
-
a0, a1, a2, a3, a4, a5, a6
|
|
44
|
-
){
|
|
45
|
-
return fn.apply(this, arguments)
|
|
46
|
-
}
|
|
47
|
-
case 8:
|
|
48
|
-
return function (
|
|
49
|
-
a0, a1, a2, a3, a4, a5, a6, a7
|
|
50
|
-
){
|
|
51
|
-
return fn.apply(this, arguments)
|
|
52
|
-
}
|
|
53
|
-
case 9:
|
|
54
|
-
return function (
|
|
55
|
-
a0, a1, a2, a3, a4, a5, a6, a7, a8
|
|
56
|
-
){
|
|
57
|
-
return fn.apply(this, arguments)
|
|
58
|
-
}
|
|
59
|
-
case 10:
|
|
60
|
-
return function (
|
|
61
|
-
a0, a1, a2, a3, a4, a5, a6, a7, a8, a9
|
|
62
|
-
){
|
|
63
|
-
return fn.apply(this, arguments)
|
|
64
|
-
}
|
|
65
|
-
default:
|
|
66
|
-
throw new Error('First argument to _arity must be a non-negative integer no greater than ten')
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
4
|
export function _pipe(f, g){
|
|
71
5
|
return function (){
|
|
72
6
|
return g.call(this, f.apply(this, arguments))
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export function removeIndex(index, list){
|
|
2
|
+
if (arguments.length === 1) return _list => removeIndex(index, _list)
|
|
3
|
+
if (index <= 0) return list.slice(1)
|
|
4
|
+
if (index >= list.length - 1) return list.slice(0, list.length - 1)
|
|
5
|
+
|
|
6
|
+
return [ ...list.slice(0, index), ...list.slice(index + 1) ]
|
|
7
|
+
}
|