rambda 7.0.2 → 7.1.1
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 +28 -2
- package/README.md +3703 -3294
- package/dist/rambda.js +284 -78
- package/dist/rambda.mjs +270 -78
- package/dist/rambda.umd.js +1 -1
- package/immutable.d.ts +95 -13
- package/index.d.ts +95 -13
- package/package.json +119 -119
- 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/src/flatten.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {_isArray} from './_internals/_isArray'
|
|
1
|
+
import { _isArray } from './_internals/_isArray.js'
|
|
2
2
|
|
|
3
|
-
export function flatten(list, input)
|
|
3
|
+
export function flatten(list, input){
|
|
4
4
|
const willReturn = input === undefined ? [] : input
|
|
5
5
|
|
|
6
|
-
for (let i = 0; i < list.length; i++)
|
|
7
|
-
if (_isArray(list[i]))
|
|
8
|
-
flatten(list[i], willReturn)
|
|
6
|
+
for (let i = 0; i < list.length; i++){
|
|
7
|
+
if (_isArray(list[ i ])){
|
|
8
|
+
flatten(list[ i ], willReturn)
|
|
9
9
|
} else {
|
|
10
|
-
willReturn.push(list[i])
|
|
10
|
+
willReturn.push(list[ i ])
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
package/src/flip.js
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
function flipFn(fn)
|
|
1
|
+
function flipFn(fn){
|
|
2
2
|
return (...input) => {
|
|
3
|
-
if (input.length === 1)
|
|
4
|
-
return holder => fn(holder, input[0])
|
|
5
|
-
} else if (input.length === 2)
|
|
6
|
-
return fn(input[1], input[0])
|
|
7
|
-
} else if (input.length === 3)
|
|
8
|
-
return fn(
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
if (input.length === 1){
|
|
4
|
+
return holder => fn(holder, input[ 0 ])
|
|
5
|
+
} else if (input.length === 2){
|
|
6
|
+
return fn(input[ 1 ], input[ 0 ])
|
|
7
|
+
} else if (input.length === 3){
|
|
8
|
+
return fn(
|
|
9
|
+
input[ 1 ], input[ 0 ], input[ 2 ]
|
|
10
|
+
)
|
|
11
|
+
} else if (input.length === 4){
|
|
12
|
+
return fn(
|
|
13
|
+
input[ 1 ], input[ 0 ], input[ 2 ], input[ 3 ]
|
|
14
|
+
)
|
|
11
15
|
}
|
|
12
16
|
|
|
13
|
-
throw new Error(
|
|
17
|
+
throw new Error('R.flip doesn\'t work with arity > 4')
|
|
14
18
|
}
|
|
15
19
|
}
|
|
16
20
|
|
|
17
|
-
export function flip(fn)
|
|
21
|
+
export function flip(fn){
|
|
18
22
|
return flipFn(fn)
|
|
19
23
|
}
|
package/src/forEach.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {_isArray} from './_internals/_isArray'
|
|
2
|
-
import {_keys} from './_internals/_keys'
|
|
1
|
+
import { _isArray } from './_internals/_isArray.js'
|
|
2
|
+
import { _keys } from './_internals/_keys.js'
|
|
3
3
|
|
|
4
|
-
export function forEach(fn, list)
|
|
4
|
+
export function forEach(fn, list){
|
|
5
5
|
if (arguments.length === 1) return _list => forEach(fn, _list)
|
|
6
6
|
|
|
7
|
-
if (list === undefined)
|
|
7
|
+
if (list === undefined){
|
|
8
8
|
return
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
if (_isArray(list))
|
|
11
|
+
if (_isArray(list)){
|
|
12
12
|
let index = 0
|
|
13
13
|
const len = list.length
|
|
14
14
|
|
|
15
|
-
while (index < len)
|
|
16
|
-
fn(list[index])
|
|
15
|
+
while (index < len){
|
|
16
|
+
fn(list[ index ])
|
|
17
17
|
index++
|
|
18
18
|
}
|
|
19
19
|
} else {
|
|
@@ -21,9 +21,11 @@ export function forEach(fn, list) {
|
|
|
21
21
|
const keys = _keys(list)
|
|
22
22
|
const len = keys.length
|
|
23
23
|
|
|
24
|
-
while (index < len)
|
|
25
|
-
const key = keys[index]
|
|
26
|
-
fn(
|
|
24
|
+
while (index < len){
|
|
25
|
+
const key = keys[ index ]
|
|
26
|
+
fn(
|
|
27
|
+
list[ key ], key, list
|
|
28
|
+
)
|
|
27
29
|
index++
|
|
28
30
|
}
|
|
29
31
|
}
|
package/src/fromPairs.js
CHANGED
package/src/groupBy.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
export function groupBy(groupFn, list)
|
|
1
|
+
export function groupBy(groupFn, list){
|
|
2
2
|
if (arguments.length === 1) return _list => groupBy(groupFn, _list)
|
|
3
3
|
|
|
4
4
|
const result = {}
|
|
5
|
-
for (let i = 0; i < list.length; i++)
|
|
6
|
-
const item = list[i]
|
|
5
|
+
for (let i = 0; i < list.length; i++){
|
|
6
|
+
const item = list[ i ]
|
|
7
7
|
const key = groupFn(item)
|
|
8
8
|
|
|
9
|
-
if (!result[key])
|
|
10
|
-
result[key] = []
|
|
9
|
+
if (!result[ key ]){
|
|
10
|
+
result[ key ] = []
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
result[key].push(item)
|
|
13
|
+
result[ key ].push(item)
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
return result
|
package/src/groupWith.js
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
import {_isArray} from './_internals/_isArray'
|
|
2
|
-
import {cloneList} from './_internals/cloneList'
|
|
1
|
+
import { _isArray } from './_internals/_isArray.js'
|
|
2
|
+
import { cloneList } from './_internals/cloneList.js'
|
|
3
3
|
|
|
4
|
-
export function groupWith(compareFn, list)
|
|
4
|
+
export function groupWith(compareFn, list){
|
|
5
5
|
if (!_isArray(list)) throw new TypeError('list.reduce is not a function')
|
|
6
6
|
|
|
7
7
|
const clone = cloneList(list)
|
|
8
8
|
|
|
9
|
-
if (list.length === 1) return [clone]
|
|
9
|
+
if (list.length === 1) return [ clone ]
|
|
10
10
|
|
|
11
11
|
const toReturn = []
|
|
12
12
|
let holder = []
|
|
13
13
|
|
|
14
|
-
clone.reduce((
|
|
14
|
+
clone.reduce((
|
|
15
|
+
prev, current, i
|
|
16
|
+
) => {
|
|
15
17
|
if (i === 0) return current
|
|
16
18
|
|
|
17
19
|
const okCompare = compareFn(prev, current)
|
|
18
20
|
const holderIsEmpty = holder.length === 0
|
|
19
21
|
const lastCall = i === list.length - 1
|
|
20
22
|
|
|
21
|
-
if (okCompare)
|
|
23
|
+
if (okCompare){
|
|
22
24
|
if (holderIsEmpty) holder.push(prev)
|
|
23
25
|
holder.push(current)
|
|
24
26
|
if (lastCall) toReturn.push(holder)
|
|
@@ -26,15 +28,15 @@ export function groupWith(compareFn, list) {
|
|
|
26
28
|
return current
|
|
27
29
|
}
|
|
28
30
|
|
|
29
|
-
if (holderIsEmpty)
|
|
30
|
-
toReturn.push([prev])
|
|
31
|
-
if (lastCall) toReturn.push([current])
|
|
31
|
+
if (holderIsEmpty){
|
|
32
|
+
toReturn.push([ prev ])
|
|
33
|
+
if (lastCall) toReturn.push([ current ])
|
|
32
34
|
|
|
33
35
|
return current
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
toReturn.push(holder)
|
|
37
|
-
if (lastCall) toReturn.push([current])
|
|
39
|
+
if (lastCall) toReturn.push([ current ])
|
|
38
40
|
holder = []
|
|
39
41
|
|
|
40
42
|
return current
|
package/src/has.js
CHANGED
package/src/hasPath.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {path} from './path'
|
|
1
|
+
import { path } from './path.js'
|
|
2
2
|
|
|
3
|
-
export function hasPath(pathInput, obj)
|
|
4
|
-
if (arguments.length === 1)
|
|
3
|
+
export function hasPath(pathInput, obj){
|
|
4
|
+
if (arguments.length === 1){
|
|
5
5
|
return objHolder => hasPath(pathInput, objHolder)
|
|
6
6
|
}
|
|
7
7
|
|
package/src/head.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export function head(listOrString)
|
|
2
|
-
if (typeof listOrString === 'string') return listOrString[0] || ''
|
|
1
|
+
export function head(listOrString){
|
|
2
|
+
if (typeof listOrString === 'string') return listOrString[ 0 ] || ''
|
|
3
3
|
|
|
4
|
-
return listOrString[0]
|
|
4
|
+
return listOrString[ 0 ]
|
|
5
5
|
}
|
package/src/identical.js
CHANGED
package/src/identity.js
CHANGED
package/src/ifElse.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import {curry} from './curry'
|
|
1
|
+
import { curry } from './curry.js'
|
|
2
2
|
|
|
3
|
-
function ifElseFn(
|
|
3
|
+
function ifElseFn(
|
|
4
|
+
condition, onTrue, onFalse
|
|
5
|
+
){
|
|
4
6
|
return (...input) => {
|
|
5
7
|
const conditionResult =
|
|
6
8
|
typeof condition === 'boolean' ? condition : condition(...input)
|
|
7
9
|
|
|
8
|
-
if (conditionResult === true)
|
|
10
|
+
if (conditionResult === true){
|
|
9
11
|
return onTrue(...input)
|
|
10
12
|
}
|
|
11
13
|
|
package/src/includes.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {_isArray} from './_internals/_isArray'
|
|
2
|
-
import {_indexOf} from './equals'
|
|
1
|
+
import { _isArray } from './_internals/_isArray.js'
|
|
2
|
+
import { _indexOf } from './equals.js'
|
|
3
3
|
|
|
4
|
-
export function includes(valueToFind, iterable)
|
|
4
|
+
export function includes(valueToFind, iterable){
|
|
5
5
|
if (arguments.length === 1)
|
|
6
6
|
return _iterable => includes(valueToFind, _iterable)
|
|
7
|
-
if (typeof iterable === 'string')
|
|
7
|
+
if (typeof iterable === 'string'){
|
|
8
8
|
return iterable.includes(valueToFind)
|
|
9
9
|
}
|
|
10
|
-
if (!iterable)
|
|
11
|
-
throw new TypeError(`Cannot read property \'indexOf\' of ${iterable}`)
|
|
10
|
+
if (!iterable){
|
|
11
|
+
throw new TypeError(`Cannot read property \'indexOf\' of ${ iterable }`)
|
|
12
12
|
}
|
|
13
13
|
if (!_isArray(iterable)) return false
|
|
14
14
|
|
package/src/indexBy.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import {path} from './path'
|
|
1
|
+
import { path } from './path.js'
|
|
2
2
|
|
|
3
|
-
function indexByPath(pathInput, list)
|
|
3
|
+
function indexByPath(pathInput, list){
|
|
4
4
|
const toReturn = {}
|
|
5
|
-
for (let i = 0; i < list.length; i++)
|
|
6
|
-
const item = list[i]
|
|
7
|
-
toReturn[path(pathInput, item)] = item
|
|
5
|
+
for (let i = 0; i < list.length; i++){
|
|
6
|
+
const item = list[ i ]
|
|
7
|
+
toReturn[ path(pathInput, item) ] = item
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
return toReturn
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
export function indexBy(condition, list)
|
|
14
|
-
if (arguments.length === 1)
|
|
13
|
+
export function indexBy(condition, list){
|
|
14
|
+
if (arguments.length === 1){
|
|
15
15
|
return _list => indexBy(condition, _list)
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
if (typeof condition === 'string')
|
|
18
|
+
if (typeof condition === 'string'){
|
|
19
19
|
return indexByPath(condition, list)
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
const toReturn = {}
|
|
23
|
-
for (let i = 0; i < list.length; i++)
|
|
24
|
-
const item = list[i]
|
|
25
|
-
toReturn[condition(item)] = item
|
|
23
|
+
for (let i = 0; i < list.length; i++){
|
|
24
|
+
const item = list[ i ]
|
|
25
|
+
toReturn[ condition(item) ] = item
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
return toReturn
|
package/src/indexOf.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {_indexOf} from './equals'
|
|
1
|
+
import { _indexOf } from './equals.js'
|
|
2
2
|
|
|
3
|
-
export function indexOf(valueToFind, list)
|
|
4
|
-
if (arguments.length === 1)
|
|
3
|
+
export function indexOf(valueToFind, list){
|
|
4
|
+
if (arguments.length === 1){
|
|
5
5
|
return _list => _indexOf(valueToFind, _list)
|
|
6
6
|
}
|
|
7
7
|
|
package/src/init.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import baseSlice from './_internals/baseSlice'
|
|
1
|
+
import baseSlice from './_internals/baseSlice.js'
|
|
2
2
|
|
|
3
|
-
export function init(listOrString)
|
|
3
|
+
export function init(listOrString){
|
|
4
4
|
if (typeof listOrString === 'string') return listOrString.slice(0, -1)
|
|
5
5
|
|
|
6
|
-
return listOrString.length ?
|
|
6
|
+
return listOrString.length ?
|
|
7
|
+
baseSlice(
|
|
8
|
+
listOrString, 0, -1
|
|
9
|
+
) :
|
|
10
|
+
[]
|
|
7
11
|
}
|
package/src/intersection.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {filter} from './filter'
|
|
2
|
-
import {includes} from './includes'
|
|
1
|
+
import { filter } from './filter.js'
|
|
2
|
+
import { includes } from './includes.js'
|
|
3
3
|
|
|
4
|
-
export function intersection(listA, listB)
|
|
4
|
+
export function intersection(listA, listB){
|
|
5
5
|
if (arguments.length === 1) return _list => intersection(listA, _list)
|
|
6
6
|
|
|
7
7
|
return filter(x => includes(x, listA), listB)
|
package/src/intersperse.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export function intersperse(separator, list)
|
|
1
|
+
export function intersperse(separator, list){
|
|
2
2
|
if (arguments.length === 1) return _list => intersperse(separator, _list)
|
|
3
3
|
|
|
4
4
|
let index = -1
|
|
5
5
|
const len = list.length
|
|
6
6
|
const willReturn = []
|
|
7
7
|
|
|
8
|
-
while (++index < len)
|
|
9
|
-
if (index === len - 1)
|
|
10
|
-
willReturn.push(list[index])
|
|
8
|
+
while (++index < len){
|
|
9
|
+
if (index === len - 1){
|
|
10
|
+
willReturn.push(list[ index ])
|
|
11
11
|
} else {
|
|
12
|
-
willReturn.push(list[index], separator)
|
|
12
|
+
willReturn.push(list[ index ], separator)
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
|
package/src/is.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export function is(targetPrototype, x)
|
|
1
|
+
export function is(targetPrototype, x){
|
|
2
2
|
if (arguments.length === 1) return _x => is(targetPrototype, _x)
|
|
3
3
|
|
|
4
4
|
return (
|
|
5
|
-
|
|
5
|
+
x != null && x.constructor === targetPrototype ||
|
|
6
6
|
x instanceof targetPrototype
|
|
7
7
|
)
|
|
8
8
|
}
|
package/src/isEmpty.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {type} from './type'
|
|
1
|
+
import { type } from './type.js'
|
|
2
2
|
|
|
3
|
-
export function isEmpty(input)
|
|
3
|
+
export function isEmpty(input){
|
|
4
4
|
const inputType = type(input)
|
|
5
|
-
if (['Undefined', 'NaN', 'Number', 'Null'].includes(inputType))
|
|
5
|
+
if ([ 'Undefined', 'NaN', 'Number', 'Null' ].includes(inputType))
|
|
6
6
|
return false
|
|
7
7
|
if (!input) return true
|
|
8
8
|
|
|
9
|
-
if (inputType === 'Object')
|
|
9
|
+
if (inputType === 'Object'){
|
|
10
10
|
return Object.keys(input).length === 0
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
if (inputType === 'Array')
|
|
13
|
+
if (inputType === 'Array'){
|
|
14
14
|
return input.length === 0
|
|
15
15
|
}
|
|
16
16
|
|
package/src/isNil.js
CHANGED
package/src/isPromise.js
CHANGED
package/src/join.js
CHANGED
package/src/juxt.js
ADDED
package/src/keys.js
CHANGED
package/src/last.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export function last(listOrString)
|
|
2
|
-
if (typeof listOrString === 'string')
|
|
3
|
-
return listOrString[listOrString.length - 1] || ''
|
|
1
|
+
export function last(listOrString){
|
|
2
|
+
if (typeof listOrString === 'string'){
|
|
3
|
+
return listOrString[ listOrString.length - 1 ] || ''
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
return listOrString[listOrString.length - 1]
|
|
6
|
+
return listOrString[ listOrString.length - 1 ]
|
|
7
7
|
}
|
package/src/lastIndexOf.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {_lastIndexOf} from './equals'
|
|
1
|
+
import { _lastIndexOf } from './equals.js'
|
|
2
2
|
|
|
3
|
-
export function lastIndexOf(valueToFind, list)
|
|
4
|
-
if (arguments.length === 1)
|
|
3
|
+
export function lastIndexOf(valueToFind, list){
|
|
4
|
+
if (arguments.length === 1){
|
|
5
5
|
return _list => _lastIndexOf(valueToFind, _list)
|
|
6
6
|
}
|
|
7
7
|
|
package/src/length.js
CHANGED
package/src/lens.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export function lens(getter, setter)
|
|
2
|
-
return function (functor)
|
|
3
|
-
return function (target)
|
|
1
|
+
export function lens(getter, setter){
|
|
2
|
+
return function (functor){
|
|
3
|
+
return function (target){
|
|
4
4
|
return functor(getter(target)).map(focus => setter(focus, target))
|
|
5
5
|
}
|
|
6
6
|
}
|
package/src/lensIndex.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {lens} from './lens'
|
|
2
|
-
import {nth} from './nth'
|
|
3
|
-
import {update} from './update'
|
|
1
|
+
import { lens } from './lens.js'
|
|
2
|
+
import { nth } from './nth.js'
|
|
3
|
+
import { update } from './update.js'
|
|
4
4
|
|
|
5
|
-
export function lensIndex(index)
|
|
5
|
+
export function lensIndex(index){
|
|
6
6
|
return lens(nth(index), update(index))
|
|
7
7
|
}
|
package/src/lensPath.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {assocPath} from './assocPath'
|
|
2
|
-
import {lens} from './lens'
|
|
3
|
-
import {path} from './path'
|
|
1
|
+
import { assocPath } from './assocPath.js'
|
|
2
|
+
import { lens } from './lens.js'
|
|
3
|
+
import { path } from './path.js'
|
|
4
4
|
|
|
5
|
-
export function lensPath(key)
|
|
5
|
+
export function lensPath(key){
|
|
6
6
|
return lens(path(key), assocPath(key))
|
|
7
7
|
}
|
package/src/lensProp.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {assoc} from './assoc'
|
|
2
|
-
import {lens} from './lens'
|
|
3
|
-
import {prop} from './prop'
|
|
1
|
+
import { assoc } from './assoc.js'
|
|
2
|
+
import { lens } from './lens.js'
|
|
3
|
+
import { prop } from './prop.js'
|
|
4
4
|
|
|
5
|
-
export function lensProp(key)
|
|
5
|
+
export function lensProp(key){
|
|
6
6
|
return lens(prop(key), assoc(key))
|
|
7
7
|
}
|
package/src/map.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import {_isArray} from './_internals/_isArray'
|
|
2
|
-
import {_keys} from './_internals/_keys'
|
|
1
|
+
import { _isArray } from './_internals/_isArray.js'
|
|
2
|
+
import { _keys } from './_internals/_keys.js'
|
|
3
3
|
|
|
4
|
-
export function mapArray(
|
|
4
|
+
export function mapArray(
|
|
5
|
+
fn, list, isIndexed = false
|
|
6
|
+
){
|
|
5
7
|
let index = 0
|
|
6
8
|
const willReturn = Array(list.length)
|
|
7
9
|
|
|
8
|
-
while (index < list.length)
|
|
9
|
-
willReturn[index] = isIndexed ? fn(list[index], index) : fn(list[index])
|
|
10
|
+
while (index < list.length){
|
|
11
|
+
willReturn[ index ] = isIndexed ? fn(list[ index ], index) : fn(list[ index ])
|
|
10
12
|
|
|
11
13
|
index++
|
|
12
14
|
}
|
|
@@ -14,15 +16,17 @@ export function mapArray(fn, list, isIndexed = false) {
|
|
|
14
16
|
return willReturn
|
|
15
17
|
}
|
|
16
18
|
|
|
17
|
-
export function mapObject(fn, obj)
|
|
19
|
+
export function mapObject(fn, obj){
|
|
18
20
|
let index = 0
|
|
19
21
|
const keys = _keys(obj)
|
|
20
22
|
const len = keys.length
|
|
21
23
|
const willReturn = {}
|
|
22
24
|
|
|
23
|
-
while (index < len)
|
|
24
|
-
const key = keys[index]
|
|
25
|
-
willReturn[key] = fn(
|
|
25
|
+
while (index < len){
|
|
26
|
+
const key = keys[ index ]
|
|
27
|
+
willReturn[ key ] = fn(
|
|
28
|
+
obj[ key ], key, obj
|
|
29
|
+
)
|
|
26
30
|
index++
|
|
27
31
|
}
|
|
28
32
|
|
|
@@ -31,9 +35,9 @@ export function mapObject(fn, obj) {
|
|
|
31
35
|
|
|
32
36
|
export const mapObjIndexed = mapObject
|
|
33
37
|
|
|
34
|
-
export function map(fn, iterable)
|
|
38
|
+
export function map(fn, iterable){
|
|
35
39
|
if (arguments.length === 1) return _iterable => map(fn, _iterable)
|
|
36
|
-
if (!iterable)
|
|
40
|
+
if (!iterable){
|
|
37
41
|
throw new Error('Incorrect iterable input')
|
|
38
42
|
}
|
|
39
43
|
|
package/src/match.js
CHANGED
package/src/mathMod.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import _isInteger from './_internals/_isInteger'
|
|
1
|
+
import _isInteger from './_internals/_isInteger.js'
|
|
2
2
|
|
|
3
|
-
export function mathMod(x, y)
|
|
3
|
+
export function mathMod(x, y){
|
|
4
4
|
if (arguments.length === 1) return _y => mathMod(x, _y)
|
|
5
5
|
if (!_isInteger(x) || !_isInteger(y) || y < 1) return NaN
|
|
6
6
|
|
|
7
|
-
return (
|
|
7
|
+
return (x % y + y) % y
|
|
8
8
|
}
|
package/src/max.js
CHANGED
package/src/maxBy.js
CHANGED
package/src/maybe.js
CHANGED
package/src/mean.js
CHANGED