rambda 9.4.2 → 10.0.0-alpha.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 +69 -1
- package/README.md +4637 -13433
- package/dist/rambda.esm.js +1487 -0
- package/dist/rambda.js +952 -2113
- package/dist/rambda.umd.js +1595 -1
- package/immutable.d.ts +1066 -1293
- package/index.d.ts +1066 -1293
- package/package.json +95 -94
- package/rambda.js +10 -138
- package/src/_internals/baseSlice.js +5 -7
- package/src/_internals/createPath.js +4 -6
- package/src/_internals/includes.js +8 -4
- package/src/_internals/set.js +11 -11
- package/src/all.js +8 -6
- package/src/allPass.js +4 -4
- package/src/any.js +10 -10
- package/src/anyPass.js +4 -4
- package/src/append.js +4 -6
- package/src/checkObjectWithSpec.js +16 -0
- package/src/complement.js +1 -1
- package/src/concat.js +2 -4
- package/src/count.js +5 -4
- package/src/countBy.js +6 -7
- package/src/defaultTo.js +4 -6
- package/src/drop.js +4 -2
- package/src/dropLast.js +4 -8
- package/src/dropLastWhile.js +17 -26
- package/src/dropWhile.js +14 -22
- package/src/eqBy.js +3 -8
- package/src/eqProps.js +3 -8
- package/src/equals.js +99 -58
- package/src/evolve.js +19 -52
- package/src/excludes.js +5 -0
- package/src/filter.js +10 -40
- package/src/filterObject.js +13 -0
- package/src/find.js +6 -6
- package/src/findIndex.js +5 -5
- package/src/findLast.js +6 -6
- package/src/findLastIndex.js +5 -5
- package/src/flatMap.js +3 -0
- package/src/flatten.js +5 -5
- package/src/groupBy.js +9 -7
- package/src/head.js +5 -3
- package/src/includes.js +10 -7
- package/src/indexOf.js +2 -6
- package/src/init.js +6 -8
- package/src/innerJoin.js +11 -19
- package/src/intersection.js +2 -4
- package/src/intersperse.js +7 -7
- package/src/join.js +2 -4
- package/src/last.js +4 -4
- package/src/lastIndexOf.js +2 -6
- package/src/map.js +9 -49
- package/src/mapAsync.js +11 -0
- package/src/mapObject.js +18 -0
- package/src/mapObjectAsync.js +10 -0
- package/src/match.js +6 -6
- package/src/maxBy.js +2 -8
- package/src/merge.js +4 -1
- package/src/mergeTypes.js +3 -0
- package/src/minBy.js +2 -8
- package/src/modifyPath.js +22 -25
- package/src/none.js +8 -6
- package/src/objOf.js +2 -6
- package/src/omit.js +26 -11
- package/src/partition.js +20 -23
- package/src/path.js +14 -15
- package/src/pick.js +15 -15
- package/src/pipe.js +70 -13
- package/src/pipeAsync.js +10 -0
- package/src/pluck.js +7 -9
- package/src/prepend.js +2 -6
- package/src/prop.js +2 -10
- package/src/propEq.js +8 -10
- package/src/propOr.js +7 -8
- package/src/propSatisfies.js +2 -7
- package/src/range.js +3 -3
- package/src/reduce.js +15 -30
- package/src/reject.js +2 -4
- package/src/replace.js +2 -8
- package/src/replaceItemAtIndex.js +15 -0
- package/src/sort.js +2 -4
- package/src/sortBy.js +3 -3
- package/src/sortWith.js +9 -13
- package/src/split.js +2 -4
- package/src/splitEvery.js +6 -8
- package/src/symmetricDifference.js +5 -8
- package/src/tail.js +2 -2
- package/src/take.js +11 -9
- package/src/takeLast.js +14 -14
- package/src/takeLastWhile.js +19 -20
- package/src/takeWhile.js +12 -21
- package/src/tap.js +3 -3
- package/src/test.js +2 -8
- package/src/tryCatch.js +5 -14
- package/src/type.js +6 -5
- package/src/union.js +10 -8
- package/src/uniq.js +2 -2
- package/src/uniqBy.js +5 -6
- package/src/uniqWith.js +10 -14
- package/src/unless.js +7 -9
- package/src/unwind.js +6 -14
- package/src/update.js +8 -11
- package/src/when.js +7 -9
- package/src/zip.js +8 -8
- package/src/zipWith.js +5 -7
- package/src/F.js +0 -3
- package/src/T.js +0 -3
- package/src/_internals/_arity.js +0 -64
- package/src/_internals/compare.js +0 -3
- package/src/_internals/constants.js +0 -1
- package/src/_internals/createPathInput.js +0 -7
- package/src/_internals/isFalsy.js +0 -13
- package/src/_internals/isInteger.js +0 -10
- package/src/_internals/isIterable.js +0 -5
- package/src/_internals/isObject.js +0 -5
- package/src/_internals/isTruthy.js +0 -13
- package/src/_internals/objectIs.js +0 -9
- package/src/_internals/utils.js +0 -21
- package/src/add.js +0 -5
- package/src/addIndex.js +0 -23
- package/src/addIndexRight.js +0 -9
- package/src/adjust.js +0 -16
- package/src/always.js +0 -3
- package/src/and.js +0 -5
- package/src/ap.js +0 -7
- package/src/aperture.js +0 -15
- package/src/apply.js +0 -7
- package/src/applySpec.js +0 -132
- package/src/applyTo.js +0 -7
- package/src/ascend.js +0 -23
- package/src/assoc.js +0 -11
- package/src/assocPath.js +0 -46
- package/src/binary.js +0 -5
- package/src/bind.js +0 -9
- package/src/both.js +0 -5
- package/src/call.js +0 -1
- package/src/chain.js +0 -7
- package/src/clamp.js +0 -15
- package/src/clone.js +0 -18
- package/src/collectBy.js +0 -27
- package/src/comparator.js +0 -5
- package/src/compose.js +0 -9
- package/src/composeWith.js +0 -33
- package/src/cond.js +0 -14
- package/src/converge.js +0 -18
- package/src/curry.js +0 -7
- package/src/curryN.js +0 -40
- package/src/dec.js +0 -1
- package/src/descend.js +0 -17
- package/src/difference.js +0 -8
- package/src/differenceWith.js +0 -20
- package/src/dissoc.js +0 -13
- package/src/dissocPath.js +0 -47
- package/src/divide.js +0 -5
- package/src/dropRepeats.js +0 -20
- package/src/dropRepeatsBy.js +0 -21
- package/src/dropRepeatsWith.js +0 -28
- package/src/either.js +0 -8
- package/src/empty.js +0 -15
- package/src/endsWith.js +0 -23
- package/src/flip.js +0 -23
- package/src/forEach.js +0 -19
- package/src/forEachObjIndexed.js +0 -24
- package/src/fromPairs.js +0 -6
- package/src/groupWith.js +0 -46
- package/src/gt.js +0 -6
- package/src/gte.js +0 -6
- package/src/has.js +0 -7
- package/src/hasIn.js +0 -9
- package/src/hasPath.js +0 -9
- package/src/identical.js +0 -7
- package/src/identity.js +0 -3
- package/src/ifElse.js +0 -17
- package/src/inc.js +0 -1
- package/src/indexBy.js +0 -29
- package/src/insert.js +0 -11
- package/src/insertAll.js +0 -7
- package/src/is.js +0 -8
- package/src/isEmpty.js +0 -18
- package/src/isNil.js +0 -3
- package/src/isNotEmpty.js +0 -5
- package/src/isNotNil.js +0 -3
- package/src/isPromise.js +0 -5
- package/src/juxt.js +0 -3
- package/src/keys.js +0 -3
- package/src/length.js +0 -8
- package/src/lens.js +0 -7
- package/src/lensIndex.js +0 -7
- package/src/lensPath.js +0 -7
- package/src/lensProp.js +0 -7
- package/src/lt.js +0 -6
- package/src/lte.js +0 -6
- package/src/mathMod.js +0 -8
- package/src/max.js +0 -5
- package/src/maybe.js +0 -13
- package/src/mean.js +0 -5
- package/src/median.js +0 -17
- package/src/mergeAll.js +0 -11
- package/src/mergeDeepLeft.js +0 -5
- package/src/mergeDeepRight.js +0 -24
- package/src/mergeLeft.js +0 -7
- package/src/mergeRight.js +0 -8
- package/src/mergeWith.js +0 -25
- package/src/min.js +0 -5
- package/src/modify.js +0 -23
- package/src/modulo.js +0 -5
- package/src/move.js +0 -19
- package/src/multiply.js +0 -5
- package/src/negate.js +0 -3
- package/src/not.js +0 -3
- package/src/nth.js +0 -9
- package/src/of.js +0 -3
- package/src/on.js +0 -16
- package/src/once.js +0 -24
- package/src/or.js +0 -5
- package/src/over.js +0 -14
- package/src/partial.js +0 -17
- package/src/partialObject.js +0 -5
- package/src/pathEq.js +0 -11
- package/src/pathOr.js +0 -11
- package/src/pathSatisfies.js +0 -9
- package/src/paths.js +0 -9
- package/src/pickAll.js +0 -23
- package/src/pickBy.js +0 -11
- package/src/product.js +0 -4
- package/src/propIs.js +0 -10
- package/src/props.js +0 -13
- package/src/reduceBy.js +0 -29
- package/src/removeIndex.js +0 -7
- package/src/repeat.js +0 -7
- package/src/reverse.js +0 -9
- package/src/set.js +0 -9
- package/src/slice.js +0 -9
- package/src/splitAt.js +0 -21
- package/src/splitWhen.js +0 -25
- package/src/startsWith.js +0 -23
- package/src/subtract.js +0 -5
- package/src/sum.js +0 -3
- package/src/swap.js +0 -42
- package/src/times.js +0 -12
- package/src/toLower.js +0 -3
- package/src/toPairs.js +0 -3
- package/src/toString.js +0 -3
- package/src/toUpper.js +0 -3
- package/src/transpose.js +0 -10
- package/src/trim.js +0 -3
- package/src/unapply.js +0 -5
- package/src/unnest.js +0 -9
- package/src/values.js +0 -6
- package/src/view.js +0 -10
- package/src/where.js +0 -15
- package/src/whereAny.js +0 -12
- package/src/whereEq.js +0 -14
- package/src/without.js +0 -15
- package/src/xor.js +0 -5
- package/src/zipObj.js +0 -13
package/index.d.ts
CHANGED
|
@@ -1,65 +1,59 @@
|
|
|
1
1
|
export type RambdaTypes = "Object" | "Number" | "Boolean" | "String" | "Null" | "Array" | "RegExp" | "NaN" | "Function" | "Undefined" | "Async" | "Promise" | "Symbol" | "Set" | "Error" | "Map" | "WeakMap" | "Generator" | "GeneratorFunction" | "BigInt" | "ArrayBuffer" | "Date"
|
|
2
2
|
|
|
3
|
+
export type EqualTypes<X, Y> =
|
|
4
|
+
(<T>() => T extends X ? 1 : 2) extends
|
|
5
|
+
(<T>() => T extends Y ? 1 : 2) ? true : false
|
|
6
|
+
|
|
3
7
|
export type NonEmptyArray<T> = [T, ...T[]];
|
|
4
8
|
export type ReadonlyNonEmptyArray<T> = readonly [T, ...T[]];
|
|
9
|
+
export type IterableContainer<T = unknown> = ReadonlyArray<T> | readonly [];
|
|
10
|
+
|
|
5
11
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
export type IndexedIterator<T, U> = (x: T, i: number) => U;
|
|
25
|
-
export type Iterator<T, U> = (x: T) => U;
|
|
26
|
-
export type ObjectIterator<T, U> = (x: T, prop: string, inputObj: Dictionary<T>) => U;
|
|
27
|
-
type Ord = number | string | boolean | Date;
|
|
28
|
-
type Ordering = -1 | 0 | 1;
|
|
29
|
-
type Path = string | (number | string)[];
|
|
30
|
-
export type RamdaPath = (number | string)[];
|
|
31
|
-
export type Predicate<T> = (x: T) => boolean;
|
|
32
|
-
export type IndexedPredicate<T> = (x: T, i: number) => boolean;
|
|
33
|
-
export type ObjectPredicate<T> = (x: T, prop: string, inputObj: Dictionary<T>) => boolean;
|
|
34
|
-
type CondPair<T extends any[], R> = [(...val: T) => boolean, (...val: T) => R]
|
|
12
|
+
|
|
13
|
+
export type Mapped<T extends IterableContainer, K> = {
|
|
14
|
+
-readonly [P in keyof T]: K;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type ElementOf<Type extends readonly any[]> = Type[number];
|
|
18
|
+
export type MergeTypes<T> = {[KeyType in keyof T]: T[KeyType]} & {};
|
|
19
|
+
export type Simplify<T> = T extends infer O ? { [K in keyof O]: O[K] } : never;
|
|
20
|
+
|
|
21
|
+
export type EntryForKey<T, Key extends keyof T> = Key extends number | string
|
|
22
|
+
? [key: `${Key}`, value: Required<T>[Key]]
|
|
23
|
+
: never;
|
|
24
|
+
|
|
25
|
+
export type Entry<T> = MergeTypes<{ [P in keyof T]-?: EntryForKey<T, P> }[keyof T]>;
|
|
26
|
+
|
|
27
|
+
export type Ord = number | string | boolean | Date;
|
|
28
|
+
export type Ordering = -1 | 0 | 1;
|
|
29
|
+
type Path = Array<string> | string;
|
|
35
30
|
type Prop<T, P extends keyof never> = P extends keyof Exclude<T, undefined>
|
|
36
31
|
? T extends undefined ? undefined : T[Extract<P, keyof T>]
|
|
37
32
|
: undefined;
|
|
38
33
|
|
|
39
|
-
type ValueOfRecord<R> =
|
|
40
|
-
R extends Record<any, infer T>
|
|
41
|
-
? T
|
|
42
|
-
: never;
|
|
43
|
-
|
|
44
34
|
interface KeyValuePair<K, V> extends Array<K | V> {
|
|
45
35
|
0: K;
|
|
46
36
|
1: V;
|
|
47
37
|
}
|
|
48
38
|
export type Functor<A> = { map: <B>(fn: (a: A) => B) => Functor<B>; [key: string]: any };
|
|
49
|
-
export type
|
|
50
|
-
|
|
51
|
-
|
|
39
|
+
export type DeepModify<Keys extends readonly PropertyKey[], U, T> =
|
|
40
|
+
Keys extends [infer K, ...infer Rest]
|
|
41
|
+
? K extends keyof U
|
|
42
|
+
? Rest extends readonly []
|
|
43
|
+
? Omit<U, K> & Record<K, T>
|
|
44
|
+
: Rest extends readonly PropertyKey[]
|
|
45
|
+
? Omit<U, K> & Record<K, DeepModify<Rest, U[K], T>>
|
|
46
|
+
: never
|
|
47
|
+
: never
|
|
48
|
+
: never;
|
|
52
49
|
|
|
53
|
-
type Arity1Fn = (x: any) => any;
|
|
54
|
-
type Arity2Fn = (x: any, y: any) => any;
|
|
55
50
|
|
|
56
|
-
type
|
|
51
|
+
export type PickStringToPickPath<T> = T extends `${infer Head},${infer Tail}` ? [Head, ...PickStringToPickPath<Tail>]
|
|
52
|
+
: T extends `${infer Head}` ? [Head]
|
|
53
|
+
: [];
|
|
57
54
|
|
|
58
|
-
export interface Dictionary<T> {[index: string]: T}
|
|
59
|
-
type Partial<T> = { [P in keyof T]?: T[P]};
|
|
60
55
|
|
|
61
|
-
type
|
|
62
|
-
export type Tuple<T, N extends number> = N extends N ? (number extends N ? T[] : _TupleOf<T, N, []>) : never;
|
|
56
|
+
export type Partial<T> = { [P in keyof T]?: T[P]};
|
|
63
57
|
|
|
64
58
|
type Evolvable<E extends Evolver> = {[P in keyof E]?: Evolved<E[P]>};
|
|
65
59
|
|
|
@@ -92,257 +86,93 @@ type EvolveValue<V, E> =
|
|
|
92
86
|
? EvolveNestedValue<V, E>
|
|
93
87
|
: never;
|
|
94
88
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
type RegExpReplacer = string | RegExpReplacerFn
|
|
114
|
-
|
|
115
|
-
/** `First`, when `First` is a supertype of `Second`; otherwise `never`. */
|
|
116
|
-
type IsFirstSubtypeOfSecond<First, Second> = (First extends Second ? Second : never);
|
|
117
|
-
|
|
118
|
-
// RAMBDAX INTERFACES
|
|
119
|
-
// ============================================
|
|
120
|
-
type Func<T> = (input: any) => T;
|
|
121
|
-
type VoidInputFunc<T> = () => T;
|
|
122
|
-
type Fn<In, Out> = (x: In) => Out;
|
|
123
|
-
export type SortObjectPredicate<T> = (aProp: string, bProp: string, aValue: T, bValue: T) => number;
|
|
124
|
-
|
|
125
|
-
export type IdentityFunction<T> = (x: T) => T;
|
|
126
|
-
|
|
127
|
-
interface Filter<T> {
|
|
128
|
-
(list: T[]): T[];
|
|
129
|
-
(obj: Dictionary<T>): Dictionary<T>;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
type ArgumentTypes<T> = T extends (...args: infer U) => infer R ? U : never;
|
|
133
|
-
type isfn<T> = (x: any, y: any) => T;
|
|
134
|
-
|
|
135
|
-
interface Switchem<T> {
|
|
136
|
-
is: isfn<Switchem<T>>;
|
|
137
|
-
default: IdentityFunction<T>;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
interface Schema {
|
|
141
|
-
[key: string]: any;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
interface SchemaAsync {
|
|
145
|
-
[key: string]: Promise<boolean>;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
export interface IsValid {
|
|
149
|
-
input: object;
|
|
150
|
-
schema: Schema;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
export interface IsValidAsync {
|
|
154
|
-
input: object;
|
|
155
|
-
schema: Schema | SchemaAsync;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
export type ProduceRules<Output,K extends keyof Output, Input> = { [P in K]: (input: Input) => Output[P];
|
|
159
|
-
};
|
|
160
|
-
export type ProduceAsyncRules<Output,K extends keyof Output, Input> = { [P in K]: (input: Input) => Promise<Output[P]>;
|
|
161
|
-
};
|
|
162
|
-
type ProduceAsyncRule<Input> = (input: Input) => Promise<any>;
|
|
163
|
-
type Async<T> = (x: any) => Promise<T>;
|
|
164
|
-
type AsyncIterable<T, K> = (x: T) => Promise<K>;
|
|
165
|
-
type AsyncIterableIndexed<T, K> = (x: T, i: number) => Promise<K>;
|
|
166
|
-
type AsyncPredicate<T> = (x: T) => Promise<boolean>;
|
|
167
|
-
type AsyncPredicateIndexed<T> = (x: T, i: number) => Promise<boolean>;
|
|
168
|
-
type AsyncWithProp<T> = (x: any, prop?: string) => Promise<T>;
|
|
169
|
-
|
|
170
|
-
export type ApplyDiffUpdate = {op:'update', path: string, value: any};
|
|
171
|
-
export type ApplyDiffAdd = {op:'add', path: string, value: any};
|
|
172
|
-
export type ApplyDiffRemove = {op:'remove', path: string};
|
|
173
|
-
export type ApplyDiffRule = ApplyDiffUpdate | ApplyDiffAdd | ApplyDiffRemove;
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
export function F(): boolean;
|
|
89
|
+
declare const emptyObjectSymbol: unique symbol;
|
|
90
|
+
type EmptyObject = {[emptyObjectSymbol]?: never};
|
|
91
|
+
type EnumerableStringKeyOf<T> =
|
|
92
|
+
Required<T> extends Record<infer K, unknown>
|
|
93
|
+
? `${Exclude<K, symbol>}`
|
|
94
|
+
: never;
|
|
95
|
+
type EnumerableStringKeyedValueOf<T> = ValuesOf<{
|
|
96
|
+
[K in keyof T]-?: K extends symbol ? never : T[K];
|
|
97
|
+
}>;
|
|
98
|
+
type ValuesOf<T> =
|
|
99
|
+
T extends EmptyObject
|
|
100
|
+
? T[keyof T]
|
|
101
|
+
: T extends Record<PropertyKey, infer V>
|
|
102
|
+
? V
|
|
103
|
+
: never;
|
|
104
|
+
type MappedValues<T extends object, Value> = MergeTypes<{
|
|
105
|
+
-readonly [P in keyof T as `${P extends number | string ? P : never}`]: Value;
|
|
106
|
+
}>;
|
|
177
107
|
|
|
178
108
|
export function T(): boolean;
|
|
179
109
|
|
|
180
110
|
/**
|
|
181
111
|
* It adds `a` and `b`.
|
|
182
112
|
*/
|
|
183
|
-
export function add(a: number, b: number): number;
|
|
184
113
|
export function add(a: number): (b: number) => number;
|
|
185
114
|
|
|
186
|
-
export function addIndex(originalFn: any): (fn: any) => (list: any[]) => any[];
|
|
187
|
-
export function addIndex(originalFn: any): (fn: any, list: any[]) => any[];
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Same as `R.addIndex`, but it will passed indexes are decreasing, instead of increasing.
|
|
191
|
-
*/
|
|
192
|
-
export function addIndexRight(originalFn: any): (fn: any) => (list: any[]) => any[];
|
|
193
|
-
export function addIndexRight(originalFn: any): (fn: any, list: any[]) => any[];
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* It replaces `index` in array `list` with the result of `replaceFn(list[i])`.
|
|
197
|
-
*/
|
|
198
|
-
export function adjust<T>(index: number, replaceFn: (x: T) => T, list: T[]): T[];
|
|
199
|
-
export function adjust<T>(index: number, replaceFn: (x: T) => T): (list: T[]) => T[];
|
|
200
|
-
|
|
201
115
|
/**
|
|
202
116
|
* It returns `true`, if all members of array `list` returns `true`, when applied as argument to `predicate` function.
|
|
203
117
|
*/
|
|
204
|
-
export function all<T>(predicate: (x: T) => boolean, list: T[]): boolean;
|
|
205
118
|
export function all<T>(predicate: (x: T) => boolean): (list: T[]) => boolean;
|
|
206
119
|
|
|
207
120
|
/**
|
|
208
121
|
* It returns `true`, if all functions of `predicates` return `true`, when `input` is their argument.
|
|
209
122
|
*/
|
|
210
|
-
export function allPass<
|
|
211
|
-
export function allPass<T>(predicates: ((...inputs: T[]) => boolean)[]): (...inputs: T[]) => boolean;
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* It returns function that always returns `x`.
|
|
215
|
-
*/
|
|
216
|
-
export function always<T>(x: T): (...args: unknown[]) => T;
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Logical AND
|
|
220
|
-
*/
|
|
221
|
-
export function and<T, U>(x: T, y: U): T | U;
|
|
222
|
-
export function and<T>(x: T): <U>(y: U) => T | U;
|
|
123
|
+
export function allPass<F extends (...args: any[]) => boolean>(predicates: readonly F[]): F;
|
|
223
124
|
|
|
224
125
|
/**
|
|
225
126
|
* It returns `true`, if at least one member of `list` returns true, when passed to a `predicate` function.
|
|
226
127
|
*/
|
|
227
|
-
export function any<T>(predicate: (x: T) => boolean, list: T[]): boolean;
|
|
228
128
|
export function any<T>(predicate: (x: T) => boolean): (list: T[]) => boolean;
|
|
229
129
|
|
|
230
130
|
/**
|
|
231
131
|
* It accepts list of `predicates` and returns a function. This function with its `input` will return `true`, if any of `predicates` returns `true` for this `input`.
|
|
232
132
|
*/
|
|
233
|
-
export function anyPass<T
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
export function
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
133
|
+
export function anyPass<T, TF1 extends T, TF2 extends T>(
|
|
134
|
+
predicates: [(a: T) => a is TF1, (a: T) => a is TF2],
|
|
135
|
+
): (a: T) => a is TF1 | TF2;
|
|
136
|
+
export function anyPass<T, TF1 extends T, TF2 extends T, TF3 extends T>(
|
|
137
|
+
predicates: [(a: T) => a is TF1, (a: T) => a is TF2, (a: T) => a is TF3],
|
|
138
|
+
): (a: T) => a is TF1 | TF2 | TF3;
|
|
139
|
+
export function anyPass<T, TF1 extends T, TF2 extends T, TF3 extends T>(
|
|
140
|
+
predicates: [(a: T) => a is TF1, (a: T) => a is TF2, (a: T) => a is TF3],
|
|
141
|
+
): (a: T) => a is TF1 | TF2 | TF3;
|
|
142
|
+
export function anyPass<T, TF1 extends T, TF2 extends T, TF3 extends T, TF4 extends T>(
|
|
143
|
+
predicates: [(a: T) => a is TF1, (a: T) => a is TF2, (a: T) => a is TF3, (a: T) => a is TF4],
|
|
144
|
+
): (a: T) => a is TF1 | TF2 | TF3 | TF4;
|
|
145
|
+
export function anyPass<T, TF1 extends T, TF2 extends T, TF3 extends T, TF4 extends T, TF5 extends T>(
|
|
146
|
+
predicates: [
|
|
147
|
+
(a: T) => a is TF1,
|
|
148
|
+
(a: T) => a is TF2,
|
|
149
|
+
(a: T) => a is TF3,
|
|
150
|
+
(a: T) => a is TF4,
|
|
151
|
+
(a: T) => a is TF5
|
|
152
|
+
],
|
|
153
|
+
): (a: T) => a is TF1 | TF2 | TF3 | TF4 | TF5;
|
|
154
|
+
export function anyPass<T, TF1 extends T, TF2 extends T, TF3 extends T, TF4 extends T, TF5 extends T, TF6 extends T>(
|
|
155
|
+
predicates: [
|
|
156
|
+
(a: T) => a is TF1,
|
|
157
|
+
(a: T) => a is TF2,
|
|
158
|
+
(a: T) => a is TF3,
|
|
159
|
+
(a: T) => a is TF4,
|
|
160
|
+
(a: T) => a is TF5,
|
|
161
|
+
(a: T) => a is TF6
|
|
162
|
+
],
|
|
163
|
+
): (a: T) => a is TF1 | TF2 | TF3 | TF4 | TF5 | TF6;
|
|
164
|
+
export function anyPass<F extends (...args: any[]) => boolean>(predicates: readonly F[]): F;
|
|
248
165
|
|
|
249
166
|
/**
|
|
250
167
|
* It adds element `x` at the end of `iterable`.
|
|
251
168
|
*/
|
|
252
|
-
export function append<T>(
|
|
253
|
-
export function append<T
|
|
254
|
-
export function append<T>(xToAppend: T): <U>(iterable: IsFirstSubtypeOfSecond<T, U>[]) => U[];
|
|
255
|
-
export function append<T>(xToAppend: T): (iterable: T[]) => T[];
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* It applies function `fn` to the list of arguments.
|
|
259
|
-
*
|
|
260
|
-
* This is useful for creating a fixed-arity function from a variadic function. `fn` should be a bound function if context is significant.
|
|
261
|
-
*/
|
|
262
|
-
export function apply<T = any>(fn: (...args: any[]) => T, args: any[]): T;
|
|
263
|
-
export function apply<T = any>(fn: (...args: any[]) => T): (args: any[]) => T;
|
|
264
|
-
|
|
265
|
-
export function applySpec<Spec extends Record<string, AnyFunction>>(
|
|
266
|
-
spec: Spec
|
|
267
|
-
): (
|
|
268
|
-
...args: Parameters<ValueOfRecord<Spec>>
|
|
269
|
-
) => { [Key in keyof Spec]: ReturnType<Spec[Key]> };
|
|
270
|
-
export function applySpec<T>(spec: any): (...args: unknown[]) => T;
|
|
271
|
-
|
|
272
|
-
export function applyTo<T, U>(el: T, fn: (t: T) => U): U;
|
|
273
|
-
export function applyTo<T>(el: T): <U>(fn: (t: T) => U) => U;
|
|
274
|
-
|
|
275
|
-
export function ascend<T>(fn: (obj: T) => Ord, a: T, b: T): Ordering;
|
|
276
|
-
export function ascend<T>(fn: (obj: T) => Ord): (a: T, b: T) => Ordering;
|
|
277
|
-
|
|
278
|
-
/**
|
|
279
|
-
* It makes a shallow clone of `obj` with setting or overriding the property `prop` with `newValue`.
|
|
280
|
-
*/
|
|
281
|
-
export function assoc<K extends PropertyKey>(prop: K): {
|
|
282
|
-
<T>(val: T): <U extends Record<K, T>>(obj: U) => U;
|
|
283
|
-
<U extends Record<K, T>, T>(val: T, obj: U): U;
|
|
284
|
-
};
|
|
285
|
-
export function assoc<T, K extends PropertyKey>(prop: K, val: T): {
|
|
286
|
-
<U>(obj: U): U extends Record<K, any> ? U[K] extends T ? U : Record<K, T> & Omit<U, K> : U & Record<K, T>;
|
|
287
|
-
};
|
|
288
|
-
export function assoc<U, K extends keyof U, T extends U[K]>(prop: K, val: T, obj: U): U;
|
|
289
|
-
|
|
290
|
-
/**
|
|
291
|
-
* It makes a shallow clone of `obj` with setting or overriding with `newValue` the property found with `path`.
|
|
292
|
-
*/
|
|
293
|
-
export function assocPath<Output>(path: Path, newValue: any, obj: object): Output;
|
|
294
|
-
export function assocPath<Output>(path: Path, newValue: any): (obj: object) => Output;
|
|
295
|
-
export function assocPath<Output>(path: Path): (newValue: any) => (obj: object) => Output;
|
|
296
|
-
|
|
297
|
-
export function binary<T extends (...arg: any[]) => any>(fn: T): (...args: any[]) => ReturnType<T>;
|
|
169
|
+
export function append<T>(el: T): (list: T[]) => T[];
|
|
170
|
+
export function append<T>(el: T): (list: readonly T[]) => T[];
|
|
298
171
|
|
|
299
172
|
/**
|
|
300
|
-
*
|
|
301
|
-
*/
|
|
302
|
-
export function bind<F extends AnyFunction, T>(fn: F, thisObj: T): (...args: Parameters<F>) => ReturnType<F>;
|
|
303
|
-
export function bind<F extends AnyFunction, T>(fn: F): (thisObj: T) => (...args: Parameters<F>) => ReturnType<F>;
|
|
304
|
-
|
|
305
|
-
/**
|
|
306
|
-
* It returns a function with `input` argument.
|
|
307
|
-
*
|
|
308
|
-
* This function will return `true`, if both `firstCondition` and `secondCondition` return `true` when `input` is passed as their argument.
|
|
309
|
-
*/
|
|
310
|
-
export function both(pred1: Pred, pred2: Pred): Pred;
|
|
311
|
-
export function both<T>(pred1: Predicate<T>, pred2: Predicate<T>): Predicate<T>;
|
|
312
|
-
export function both<T>(pred1: Predicate<T>): (pred2: Predicate<T>) => Predicate<T>;
|
|
313
|
-
export function both(pred1: Pred): (pred2: Pred) => Pred;
|
|
314
|
-
|
|
315
|
-
export function call<T extends (...args: any[]) => any>(fn: T, ...args: Parameters<T>): ReturnType<T>;
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* The method is also known as `flatMap`.
|
|
319
|
-
*/
|
|
320
|
-
export function chain<T, U>(fn: (n: T) => U[], list: T[]): U[];
|
|
321
|
-
export function chain<T, U>(fn: (n: T) => U[]): (list: T[]) => U[];
|
|
322
|
-
|
|
323
|
-
/**
|
|
324
|
-
* Restrict a number `input` to be within `min` and `max` limits.
|
|
325
|
-
*
|
|
326
|
-
* If `input` is bigger than `max`, then the result is `max`.
|
|
327
|
-
*
|
|
328
|
-
* If `input` is smaller than `min`, then the result is `min`.
|
|
329
|
-
*/
|
|
330
|
-
export function clamp(min: number, max: number, input: number): number;
|
|
331
|
-
export function clamp(min: number, max: number): (input: number) => number;
|
|
332
|
-
|
|
333
|
-
/**
|
|
334
|
-
* It creates a deep copy of the `input`, which may contain (nested) Arrays and Objects, Numbers, Strings, Booleans and Dates.
|
|
335
|
-
*/
|
|
336
|
-
export function clone<T>(input: T): T;
|
|
337
|
-
export function clone<T>(input: T[]): T[];
|
|
338
|
-
|
|
339
|
-
export function collectBy<T, K extends PropertyKey>(keyFn: (value: T) => K, list: T[]): T[][];
|
|
340
|
-
export function collectBy<T, K extends PropertyKey>(keyFn: (value: T) => K): (list: T[]) => T[][];
|
|
341
|
-
|
|
342
|
-
/**
|
|
343
|
-
* It returns a comparator function that can be used in `sort` method.
|
|
173
|
+
* It returns `true` if all each property in `conditions` returns `true` when applied to corresponding property in `input` object.
|
|
344
174
|
*/
|
|
345
|
-
export function
|
|
175
|
+
export function checkObjectWithSpec<T>(spec: T): <U>(testObj: U) => boolean;
|
|
346
176
|
|
|
347
177
|
/**
|
|
348
178
|
* It returns `inverted` version of `origin` function that accept `input` as argument.
|
|
@@ -351,129 +181,21 @@ export function comparator<T>(pred: (a: T, b: T) => boolean): (x: T, y: T) => Or
|
|
|
351
181
|
*/
|
|
352
182
|
export function complement<T extends any[]>(predicate: (...args: T) => unknown): (...args: T) => boolean;
|
|
353
183
|
|
|
354
|
-
/**
|
|
355
|
-
* It performs right-to-left function composition.
|
|
356
|
-
*/
|
|
357
|
-
export function compose<TArgs extends any[], R1, R2, R3, R4, R5, R6, R7, TResult>(
|
|
358
|
-
...func: [
|
|
359
|
-
fnLast: (a: any) => TResult,
|
|
360
|
-
...func: Array<(a: any) => any>,
|
|
361
|
-
f7: (a: R6) => R7,
|
|
362
|
-
f6: (a: R5) => R6,
|
|
363
|
-
f5: (a: R4) => R5,
|
|
364
|
-
f4: (a: R3) => R4,
|
|
365
|
-
f3: (a: R2) => R3,
|
|
366
|
-
f2: (a: R1) => R2,
|
|
367
|
-
f1: (...args: TArgs) => R1
|
|
368
|
-
]
|
|
369
|
-
): (...args: TArgs) => TResult;
|
|
370
|
-
export function compose<TArgs extends any[], R1, R2, R3, R4, R5, R6, R7, TResult>(
|
|
371
|
-
f7: (a: R6) => R7,
|
|
372
|
-
f6: (a: R5) => R6,
|
|
373
|
-
f5: (a: R4) => R5,
|
|
374
|
-
f4: (a: R3) => R4,
|
|
375
|
-
f3: (a: R2) => R3,
|
|
376
|
-
f2: (a: R1) => R2,
|
|
377
|
-
f1: (...args: TArgs) => R1
|
|
378
|
-
): (...args: TArgs) => R7;
|
|
379
|
-
export function compose<TArgs extends any[], R1, R2, R3, R4, R5, R6, R7>(
|
|
380
|
-
f7: (a: R6) => R7,
|
|
381
|
-
f6: (a: R5) => R6,
|
|
382
|
-
f5: (a: R4) => R5,
|
|
383
|
-
f4: (a: R3) => R4,
|
|
384
|
-
f3: (a: R2) => R3,
|
|
385
|
-
f2: (a: R1) => R2,
|
|
386
|
-
f1: (...args: TArgs) => R1
|
|
387
|
-
): (...args: TArgs) => R7;
|
|
388
|
-
export function compose<TArgs extends any[], R1, R2, R3, R4, R5, R6>(
|
|
389
|
-
f6: (a: R5) => R6,
|
|
390
|
-
f5: (a: R4) => R5,
|
|
391
|
-
f4: (a: R3) => R4,
|
|
392
|
-
f3: (a: R2) => R3,
|
|
393
|
-
f2: (a: R1) => R2,
|
|
394
|
-
f1: (...args: TArgs) => R1
|
|
395
|
-
): (...args: TArgs) => R6;
|
|
396
|
-
export function compose<TArgs extends any[], R1, R2, R3, R4, R5>(
|
|
397
|
-
f5: (a: R4) => R5,
|
|
398
|
-
f4: (a: R3) => R4,
|
|
399
|
-
f3: (a: R2) => R3,
|
|
400
|
-
f2: (a: R1) => R2,
|
|
401
|
-
f1: (...args: TArgs) => R1
|
|
402
|
-
): (...args: TArgs) => R5;
|
|
403
|
-
export function compose<TArgs extends any[], R1, R2, R3, R4>(
|
|
404
|
-
f4: (a: R3) => R4,
|
|
405
|
-
f3: (a: R2) => R3,
|
|
406
|
-
f2: (a: R1) => R2,
|
|
407
|
-
f1: (...args: TArgs) => R1
|
|
408
|
-
): (...args: TArgs) => R4;
|
|
409
|
-
export function compose<TArgs extends any[], R1, R2, R3>(
|
|
410
|
-
f3: (a: R2) => R3,
|
|
411
|
-
f2: (a: R1) => R2,
|
|
412
|
-
f1: (...args: TArgs) => R1
|
|
413
|
-
): (...args: TArgs) => R3;
|
|
414
|
-
export function compose<TArgs extends any[], R1, R2>(
|
|
415
|
-
f2: (a: R1) => R2,
|
|
416
|
-
f1: (...args: TArgs) => R1
|
|
417
|
-
): (...args: TArgs) => R2;
|
|
418
|
-
export function compose<TArgs extends any[], R1>(
|
|
419
|
-
f1: (...args: TArgs) => R1
|
|
420
|
-
): (...args: TArgs) => R1;
|
|
421
|
-
|
|
422
|
-
export function composeWith<TArgs extends any[], TResult>(
|
|
423
|
-
transformer: (fn: (...args: any[]) => any, intermediatResult: any) => any,
|
|
424
|
-
fns: AtLeastOneFunctionsFlowFromRightToLeft<TArgs, TResult>,
|
|
425
|
-
): (...args: TArgs) => TResult;
|
|
426
|
-
export function composeWith(
|
|
427
|
-
transformer: (fn: (...args: any[]) => any, intermediatResult: any) => any,
|
|
428
|
-
): <TArgs extends any[], TResult>(
|
|
429
|
-
fns: AtLeastOneFunctionsFlowFromRightToLeft<TArgs, TResult>,
|
|
430
|
-
) => (...args: TArgs) => TResult;
|
|
431
|
-
|
|
432
184
|
/**
|
|
433
185
|
* It returns a new string or array, which is the result of merging `x` and `y`.
|
|
434
186
|
*/
|
|
435
|
-
export function concat<T>(x: T[], y: T[]): T[];
|
|
436
187
|
export function concat<T>(x: T[]): (y: T[]) => T[];
|
|
437
|
-
export function concat(x: string, y: string): string;
|
|
438
188
|
export function concat(x: string): (y: string) => string;
|
|
439
189
|
|
|
440
|
-
/**
|
|
441
|
-
* It takes list with `conditions` and returns a new function `fn` that expects `input` as argument.
|
|
442
|
-
*
|
|
443
|
-
* This function will start evaluating the `conditions` in order to find the first winner(order of conditions matter).
|
|
444
|
-
*
|
|
445
|
-
* The winner is this condition, which left side returns `true` when `input` is its argument. Then the evaluation of the right side of the winner will be the final result.
|
|
446
|
-
*
|
|
447
|
-
* If no winner is found, then `fn` returns `undefined`.
|
|
448
|
-
*/
|
|
449
|
-
export function cond<T extends any[], R>(conditions: Array<CondPair<T, R>>): (...args: T) => R;
|
|
450
|
-
|
|
451
|
-
/**
|
|
452
|
-
* Accepts a converging function and a list of branching functions and returns a new function. When invoked, this new function is applied to some arguments, each branching function is applied to those same arguments. The results of each branching function are passed as arguments to the converging function to produce the return value.
|
|
453
|
-
*/
|
|
454
|
-
export function converge(after: ((...a: any[]) => any), fns: ((...x: any[]) => any)[]): (...y: any[]) => any;
|
|
455
|
-
|
|
456
190
|
/**
|
|
457
191
|
* It counts how many times `predicate` function returns `true`, when supplied with iteration of `list`.
|
|
458
192
|
*/
|
|
459
|
-
export function count<T>(predicate: (x: T) => boolean, list: T[]): number;
|
|
460
193
|
export function count<T>(predicate: (x: T) => boolean): (list: T[]) => number;
|
|
461
194
|
|
|
462
195
|
/**
|
|
463
196
|
* It counts elements in a list after each instance of the input list is passed through `transformFn` function.
|
|
464
197
|
*/
|
|
465
|
-
export function countBy<T
|
|
466
|
-
export function countBy<T extends unknown>(transformFn: (x: T) => any): (list: T[]) => Record<string, number>;
|
|
467
|
-
|
|
468
|
-
/**
|
|
469
|
-
* It expects a function as input and returns its curried version.
|
|
470
|
-
*/
|
|
471
|
-
export function curry(fn: AnyFunction): (...a: any[]) => any;
|
|
472
|
-
|
|
473
|
-
/**
|
|
474
|
-
* It returns a curried equivalent of the provided function, with the specified arity.
|
|
475
|
-
*/
|
|
476
|
-
export function curryN(length: number, fn: AnyFunction): (...a: any[]) => any;
|
|
198
|
+
export function countBy<T>(fn: (a: T) => string | number): (list: T[]) => { [index: string]: number };
|
|
477
199
|
|
|
478
200
|
/**
|
|
479
201
|
* It decrements a number.
|
|
@@ -486,121 +208,33 @@ export function dec(x: number): number;
|
|
|
486
208
|
* Else, it returns the first truthy `inputArguments` instance(from left to right).
|
|
487
209
|
*/
|
|
488
210
|
export function defaultTo<T>(defaultValue: T, input: T | null | undefined): T;
|
|
489
|
-
export function defaultTo<T>(defaultValue: T): (input:
|
|
490
|
-
|
|
491
|
-
export function descend<T>(fn: (obj: T) => Ord, a: T, b: T): Ordering;
|
|
492
|
-
export function descend<T>(fn: (obj: T) => Ord): (a: T, b: T) => Ordering;
|
|
493
|
-
|
|
494
|
-
/**
|
|
495
|
-
* It returns the uniq set of all elements in the first list `a` not contained in the second list `b`.
|
|
496
|
-
*
|
|
497
|
-
* `R.equals` is used to determine equality.
|
|
498
|
-
*/
|
|
499
|
-
export function difference<T>(a: T[], b: T[]): T[];
|
|
500
|
-
export function difference<T>(a: T[]): (b: T[]) => T[];
|
|
501
|
-
|
|
502
|
-
export function differenceWith<T1, T2>(
|
|
503
|
-
pred: (a: T1, b: T2) => boolean,
|
|
504
|
-
list1: T1[],
|
|
505
|
-
list2: T2[],
|
|
506
|
-
): T1[];
|
|
507
|
-
export function differenceWith<T1, T2>(
|
|
508
|
-
pred: (a: T1, b: T2) => boolean,
|
|
509
|
-
): (list1: T1[], list2: T2[]) => T1[];
|
|
510
|
-
export function differenceWith<T1, T2>(
|
|
511
|
-
pred: (a: T1, b: T2) => boolean,
|
|
512
|
-
list1: T1[],
|
|
513
|
-
): (list2: T2[]) => T1[];
|
|
514
|
-
|
|
515
|
-
/**
|
|
516
|
-
* It returns a new object that does not contain property `prop`.
|
|
517
|
-
*/
|
|
518
|
-
export function dissoc<K extends PropertyKey>(prop: K): <U extends { [P in K]?: any}>(obj: string extends keyof U ? U : undefined extends U[K] ? U : never) => U;
|
|
519
|
-
export function dissoc<U, K extends keyof U>(prop: string extends keyof U ? K : undefined extends U[K] ? K : never, obj: U): U;
|
|
520
|
-
|
|
521
|
-
export function dissocPath<T>(path: Path, obj: any): T;
|
|
522
|
-
export function dissocPath<T>(path: Path): (obj: any) => T;
|
|
523
|
-
|
|
524
|
-
export function divide(x: number, y: number): number;
|
|
525
|
-
export function divide(x: number): (y: number) => number;
|
|
211
|
+
export function defaultTo<T>(defaultValue: T): <U>(input: U | null | undefined) => EqualTypes<U, T> extends true ? T : never
|
|
526
212
|
|
|
527
213
|
/**
|
|
528
214
|
* It returns `howMany` items dropped from beginning of list or string `input`.
|
|
529
215
|
*/
|
|
530
|
-
export function drop<T>(howMany: number
|
|
531
|
-
export function drop(howMany: number, input: string): string;
|
|
532
|
-
export function drop<T>(howMany: number): {
|
|
533
|
-
<T>(input: T[]): T[];
|
|
534
|
-
(input: string): string;
|
|
535
|
-
};
|
|
216
|
+
export function drop<T>(howMany: number): (list: T[]) => T[];
|
|
536
217
|
|
|
537
218
|
/**
|
|
538
|
-
* It returns `howMany` items dropped from
|
|
219
|
+
* It returns `howMany` items dropped from the end of list or string `input`.
|
|
539
220
|
*/
|
|
540
|
-
export function dropLast<T>(howMany: number
|
|
541
|
-
export function dropLast(howMany: number, input: string): string;
|
|
542
|
-
export function dropLast<T>(howMany: number): {
|
|
543
|
-
<T>(input: T[]): T[];
|
|
544
|
-
(input: string): string;
|
|
545
|
-
};
|
|
221
|
+
export function dropLast<T>(howMany: number): (list: T[]) => T[];
|
|
546
222
|
|
|
547
|
-
export function dropLastWhile(predicate: (x:
|
|
548
|
-
export function dropLastWhile(predicate: (x:
|
|
549
|
-
export function dropLastWhile<T>(predicate: (x: T) => boolean, iterable: T[]): T[];
|
|
550
|
-
export function dropLastWhile<T>(predicate: (x: T) => boolean): <T>(iterable: T[]) => T[];
|
|
223
|
+
export function dropLastWhile<T>(predicate: (x: T, index: number) => boolean): (list: T[]) => T[];
|
|
224
|
+
export function dropLastWhile<T>(predicate: (x: T) => boolean): (list: T[]) => T[];
|
|
551
225
|
|
|
552
|
-
|
|
553
|
-
* It removes any successive duplicates according to `R.equals`.
|
|
554
|
-
*/
|
|
555
|
-
export function dropRepeats<T>(list: T[]): T[];
|
|
556
|
-
|
|
557
|
-
export function dropRepeatsBy<T, U>(fn: (a: T) => U, list: T[]): T[];
|
|
558
|
-
export function dropRepeatsBy<T, U>(
|
|
559
|
-
fn: (a: T) => U
|
|
560
|
-
): (list: T[]) => T[];
|
|
561
|
-
export function dropRepeatsBy(fn: any): <T>(list: T[]) => T[];
|
|
226
|
+
export function dropRepeatsBy<T, U>(fn: (a: T) => U): (list: T[]) => T[];
|
|
562
227
|
|
|
563
|
-
export function dropRepeatsWith<T>(predicate: (x: T, y: T) => boolean, list: T[]): T[];
|
|
564
228
|
export function dropRepeatsWith<T>(predicate: (x: T, y: T) => boolean): (list: T[]) => T[];
|
|
565
229
|
|
|
566
|
-
export function dropWhile(
|
|
567
|
-
export function dropWhile(
|
|
568
|
-
export function dropWhile<T>(fn: Predicate<T>, iterable: T[]): T[];
|
|
569
|
-
export function dropWhile<T>(fn: Predicate<T>): (iterable: T[]) => T[];
|
|
230
|
+
export function dropWhile<T>(predicate: (x: T, index: number) => boolean): (list: T[]) => T[];
|
|
231
|
+
export function dropWhile<T>(predicate: (x: T) => boolean): (list: T[]) => T[];
|
|
570
232
|
|
|
571
|
-
|
|
572
|
-
* It returns a new `predicate` function from `firstPredicate` and `secondPredicate` inputs.
|
|
573
|
-
*
|
|
574
|
-
* This `predicate` function will return `true`, if any of the two input predicates return `true`.
|
|
575
|
-
*/
|
|
576
|
-
export function either(firstPredicate: Pred, secondPredicate: Pred): Pred;
|
|
577
|
-
export function either<T>(firstPredicate: Predicate<T>, secondPredicate: Predicate<T>): Predicate<T>;
|
|
578
|
-
export function either<T>(firstPredicate: Predicate<T>): (secondPredicate: Predicate<T>) => Predicate<T>;
|
|
579
|
-
export function either(firstPredicate: Pred): (secondPredicate: Pred) => Pred;
|
|
580
|
-
|
|
581
|
-
export function empty<T>(x: T): T;
|
|
582
|
-
|
|
583
|
-
/**
|
|
584
|
-
* When iterable is a string, then it behaves as `String.prototype.endsWith`.
|
|
585
|
-
* When iterable is a list, then it uses R.equals to determine if the target list ends in the same way as the given target.
|
|
586
|
-
*/
|
|
587
|
-
export function endsWith<T extends string>(question: T, str: string): boolean;
|
|
588
|
-
export function endsWith<T extends string>(question: T): (str: string) => boolean;
|
|
589
|
-
export function endsWith<T>(question: T[], list: T[]): boolean;
|
|
590
|
-
export function endsWith<T>(question: T[]): (list: T[]) => boolean;
|
|
591
|
-
|
|
592
|
-
export function eqBy<T>(fn: (a: T) => unknown, a: T, b: T): boolean;
|
|
593
|
-
export function eqBy<T>(fn: (a: T) => unknown, a: T): (b: T) => boolean;
|
|
594
|
-
export function eqBy<T>(fn: (a: T) => unknown): {
|
|
595
|
-
(a: T, b: T): boolean;
|
|
596
|
-
(a: T): (b: T) => boolean;
|
|
597
|
-
};
|
|
233
|
+
export function eqBy<T>(fn: (x: T) => unknown, a: T): (b: T) => boolean;
|
|
598
234
|
|
|
599
235
|
/**
|
|
600
236
|
* It returns `true` if property `prop` in `obj1` is equal to property `prop` in `obj2` according to `R.equals`.
|
|
601
237
|
*/
|
|
602
|
-
export function eqProps<T, U>(prop: string, obj1: T, obj2: U): boolean;
|
|
603
|
-
export function eqProps<P extends string>(prop: P): <T, U>(obj1: Record<P, T>, obj2: Record<P, U>) => boolean;
|
|
604
238
|
export function eqProps<T>(prop: string, obj1: T): <U>(obj2: U) => boolean;
|
|
605
239
|
|
|
606
240
|
/**
|
|
@@ -610,27 +244,50 @@ export function equals<T>(x: T, y: T): boolean;
|
|
|
610
244
|
export function equals<T>(x: T): (y: T) => boolean;
|
|
611
245
|
|
|
612
246
|
/**
|
|
613
|
-
* It takes object
|
|
247
|
+
* It takes object of functions as set of rules. These `rules` are applied to the `iterable` input to produce the result.
|
|
614
248
|
*/
|
|
615
|
-
export function evolve<T, U>(rules: ((x: T) => U)[], list: T[]): U[];
|
|
616
|
-
export function evolve<T, U>(rules: ((x: T) => U)[]) : (list: T[]) => U[];
|
|
617
|
-
export function evolve<E extends Evolver, V extends Evolvable<E>>(rules: E, obj: V): Evolve<V, E>;
|
|
618
249
|
export function evolve<E extends Evolver>(rules: E): <V extends Evolvable<E>>(obj: V) => Evolve<V, E>;
|
|
619
250
|
|
|
251
|
+
/**
|
|
252
|
+
* Opposite of `R.includes`
|
|
253
|
+
*
|
|
254
|
+
* `R.equals` is used to determine equality.
|
|
255
|
+
*/
|
|
256
|
+
export function excludes<T extends string>(valueToFind: T): (input: string) => boolean;
|
|
257
|
+
export function excludes<T>(valueToFind: T): (input: T[]) => boolean;
|
|
258
|
+
|
|
620
259
|
/**
|
|
621
260
|
* It filters list or object `input` using a `predicate` function.
|
|
622
261
|
*/
|
|
623
|
-
export function filter<T
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
export function filter<T>(
|
|
262
|
+
export function filter<T, S extends T>(
|
|
263
|
+
predicate: (value: T) => value is S,
|
|
264
|
+
): (list: T[]) => S[];
|
|
265
|
+
export function filter<T>(
|
|
266
|
+
predicate: BooleanConstructor,
|
|
267
|
+
): (list: readonly T[]) => NonNullable<T>[];
|
|
268
|
+
export function filter<T>(
|
|
269
|
+
predicate: BooleanConstructor,
|
|
270
|
+
): (list: T[]) => NonNullable<T>[];
|
|
271
|
+
export function filter<T>(
|
|
272
|
+
predicate: (value: T) => boolean,
|
|
273
|
+
): (list: T[]) => T[];
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* It loops over each property of `obj` and returns a new object with only those properties that satisfy the `predicate`.
|
|
277
|
+
*/
|
|
278
|
+
export function filterObject<T extends object>(
|
|
279
|
+
valueMapper: (
|
|
280
|
+
value: EnumerableStringKeyedValueOf<T>,
|
|
281
|
+
key: EnumerableStringKeyOf<T>,
|
|
282
|
+
data: T,
|
|
283
|
+
) => boolean,
|
|
284
|
+
): <U extends T>(data: T) => U;
|
|
627
285
|
|
|
628
286
|
/**
|
|
629
287
|
* It returns the first element of `list` that satisfy the `predicate`.
|
|
630
288
|
*
|
|
631
289
|
* If there is no such element, it returns `undefined`.
|
|
632
290
|
*/
|
|
633
|
-
export function find<T>(predicate: (x: T) => boolean, list: T[]): T | undefined;
|
|
634
291
|
export function find<T>(predicate: (x: T) => boolean): (list: T[]) => T | undefined;
|
|
635
292
|
|
|
636
293
|
/**
|
|
@@ -638,7 +295,6 @@ export function find<T>(predicate: (x: T) => boolean): (list: T[]) => T | undefi
|
|
|
638
295
|
*
|
|
639
296
|
* If there is no such element, then `-1` is returned.
|
|
640
297
|
*/
|
|
641
|
-
export function findIndex<T>(predicate: (x: T) => boolean, list: T[]): number;
|
|
642
298
|
export function findIndex<T>(predicate: (x: T) => boolean): (list: T[]) => number;
|
|
643
299
|
|
|
644
300
|
/**
|
|
@@ -646,7 +302,6 @@ export function findIndex<T>(predicate: (x: T) => boolean): (list: T[]) => numbe
|
|
|
646
302
|
*
|
|
647
303
|
* If there is no such element, then `undefined` is returned.
|
|
648
304
|
*/
|
|
649
|
-
export function findLast<T>(fn: (x: T) => boolean, list: T[]): T | undefined;
|
|
650
305
|
export function findLast<T>(fn: (x: T) => boolean): (list: T[]) => T | undefined;
|
|
651
306
|
|
|
652
307
|
/**
|
|
@@ -654,97 +309,34 @@ export function findLast<T>(fn: (x: T) => boolean): (list: T[]) => T | undefined
|
|
|
654
309
|
*
|
|
655
310
|
* If there is no such element, then `-1` is returned.
|
|
656
311
|
*/
|
|
657
|
-
export function findLastIndex<T>(predicate: (x: T) => boolean, list: T[]): number;
|
|
658
312
|
export function findLastIndex<T>(predicate: (x: T) => boolean): (list: T[]) => number;
|
|
659
313
|
|
|
660
314
|
/**
|
|
661
|
-
* It
|
|
315
|
+
* It maps `fn` over `list` and then flatten the result by one-level.
|
|
662
316
|
*/
|
|
663
|
-
export function
|
|
317
|
+
export function flatMap<T, U extends unknown>(transformFn: (x: T extends any[] ? T[number]: never) => U): (listOfLists: T[]) => U[];
|
|
664
318
|
|
|
665
319
|
/**
|
|
666
|
-
* It
|
|
667
|
-
*/
|
|
668
|
-
export function flip<T, U, TResult>(fn: (arg0: T, arg1: U) => TResult): (arg1: U, arg0?: T) => TResult;
|
|
669
|
-
|
|
670
|
-
/**
|
|
671
|
-
* It applies `iterable` function over all members of `list` and returns `list`.
|
|
672
|
-
*/
|
|
673
|
-
export function forEach<T>(fn: Iterator<T, void>, list: T[]): T[];
|
|
674
|
-
export function forEach<T>(fn: Iterator<T, void>): (list: T[]) => T[];
|
|
675
|
-
export function forEach<T>(fn: ObjectIterator<T, void>, list: Dictionary<T>): Dictionary<T>;
|
|
676
|
-
export function forEach<T, U>(fn: ObjectIterator<T, void>): (list: Dictionary<T>) => Dictionary<T>;
|
|
677
|
-
|
|
678
|
-
export function forEachObjIndexed<T>(fn: (value: T[keyof T], key: keyof T, obj: T) => void, obj: T): T;
|
|
679
|
-
export function forEachObjIndexed<T>(fn: (value: T[keyof T], key: keyof T, obj: T) => void): (obj: T) => T;
|
|
680
|
-
|
|
681
|
-
/**
|
|
682
|
-
* It transforms a `listOfPairs` to an object.
|
|
320
|
+
* It deeply flattens an array.
|
|
683
321
|
*/
|
|
684
|
-
export function
|
|
685
|
-
export function fromPairs<V>(listOfPairs: ([string, V])[]): { [index: string]: V };
|
|
322
|
+
export function flatten<T>(list: any[]): T[];
|
|
686
323
|
|
|
687
324
|
/**
|
|
688
325
|
* It splits `list` according to a provided `groupFn` function and returns an object.
|
|
689
326
|
*/
|
|
690
327
|
export function groupBy<T, K extends string = string>(fn: (a: T) => K): (list: T[]) => Partial<Record<K, T[]>>;
|
|
691
|
-
export function groupBy<T, K extends string = string>(fn: (a: T) => K, list: T[]): Partial<Record<K, T[]>>;
|
|
692
|
-
|
|
693
|
-
/**
|
|
694
|
-
* It returns separated version of list or string `input`, where separation is done with equality `compareFn` function.
|
|
695
|
-
*/
|
|
696
|
-
export function groupWith<T>(compareFn: (x: T, y: T) => boolean): (input: T[]) => (T[])[];
|
|
697
|
-
export function groupWith<T>(compareFn: (x: T, y: T) => boolean, input: T[]): (T[])[];
|
|
698
|
-
export function groupWith<T>(compareFn: (x: T, y: T) => boolean, input: string): string[];
|
|
699
|
-
|
|
700
|
-
export function gt<T, U>(x: T, y: U): boolean;
|
|
701
|
-
export function gt<T, U>(x: T): (y: U) => boolean;
|
|
702
|
-
|
|
703
|
-
export function gte<T, U>(x: T, y: U): boolean;
|
|
704
|
-
export function gte<T, U>(x: T): (y: U) => boolean;
|
|
705
|
-
|
|
706
|
-
/**
|
|
707
|
-
* It returns `true` if `obj` has property `prop`.
|
|
708
|
-
*/
|
|
709
|
-
export function has<T>(prop: string, obj: T): boolean;
|
|
710
|
-
export function has(prop: string): <T>(obj: T) => boolean;
|
|
711
|
-
|
|
712
|
-
export function hasIn(searchProperty: string): <T>(obj: T) => boolean;
|
|
713
|
-
export function hasIn<T>(searchProperty: string, obj: T): boolean;
|
|
714
|
-
|
|
715
|
-
/**
|
|
716
|
-
* It will return true, if `input` object has truthy `path`(calculated with `R.path`).
|
|
717
|
-
*/
|
|
718
|
-
export function hasPath<T>(
|
|
719
|
-
path: string | string[],
|
|
720
|
-
input: object
|
|
721
|
-
): boolean;
|
|
722
|
-
export function hasPath<T>(
|
|
723
|
-
path: string | string[]
|
|
724
|
-
): (input: object) => boolean;
|
|
725
328
|
|
|
726
329
|
/**
|
|
727
330
|
* It returns the first element of list or string `input`. It returns `undefined` if array has length of 0.
|
|
728
331
|
*/
|
|
729
|
-
export function head(
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
* It returns `true` if its arguments `a` and `b` are identical.
|
|
738
|
-
*
|
|
739
|
-
* Otherwise, it returns `false`.
|
|
740
|
-
*/
|
|
741
|
-
export function identical<T>(x: T, y: T): boolean;
|
|
742
|
-
export function identical<T>(x: T): (y: T) => boolean;
|
|
743
|
-
|
|
744
|
-
/**
|
|
745
|
-
* It just passes back the supplied `input` argument.
|
|
746
|
-
*/
|
|
747
|
-
export function identity<T>(input: T): T;
|
|
332
|
+
export function head<T>(listOrString: T): T extends string ? string :
|
|
333
|
+
T extends [] ? undefined:
|
|
334
|
+
T extends readonly [infer F, ...infer R] ? F :
|
|
335
|
+
T extends readonly [infer F] ? F :
|
|
336
|
+
T extends [infer F] ? F :
|
|
337
|
+
T extends [infer F, ...infer R] ? F :
|
|
338
|
+
T extends unknown[] ? T[number] :
|
|
339
|
+
undefined;
|
|
748
340
|
|
|
749
341
|
/**
|
|
750
342
|
* It expects `condition`, `onTrue` and `onFalse` functions as inputs and it returns a new function with example name of `fn`.
|
|
@@ -758,41 +350,17 @@ export function ifElse<T, TFiltered extends T, TOnTrueResult, TOnFalseResult>(
|
|
|
758
350
|
): (a: T) => TOnTrueResult | TOnFalseResult;
|
|
759
351
|
export function ifElse<TArgs extends any[], TOnTrueResult, TOnFalseResult>(fn: (...args: TArgs) => boolean, onTrue: (...args: TArgs) => TOnTrueResult, onFalse: (...args: TArgs) => TOnFalseResult): (...args: TArgs) => TOnTrueResult | TOnFalseResult;
|
|
760
352
|
|
|
761
|
-
/**
|
|
762
|
-
* It increments a number.
|
|
763
|
-
*/
|
|
764
|
-
export function inc(x: number): number;
|
|
765
|
-
|
|
766
353
|
/**
|
|
767
354
|
* If `input` is string, then this method work as native `String.includes`.
|
|
768
355
|
*
|
|
769
356
|
* If `input` is array, then `R.equals` is used to define if `valueToFind` belongs to the list.
|
|
770
357
|
*/
|
|
771
|
-
export function includes<T extends string>(valueToFind: T, input: string): boolean;
|
|
772
358
|
export function includes<T extends string>(valueToFind: T): (input: string) => boolean;
|
|
773
|
-
export function includes<T>(valueToFind: T, input: T[]): boolean;
|
|
774
359
|
export function includes<T>(valueToFind: T): (input: T[]) => boolean;
|
|
775
360
|
|
|
776
361
|
/**
|
|
777
|
-
* It
|
|
778
|
-
*
|
|
779
|
-
* If `condition` is a function, then all list members are passed through it.
|
|
780
|
-
*
|
|
781
|
-
* If `condition` is a string, then all list members are passed through `R.path(condition)`.
|
|
782
|
-
*/
|
|
783
|
-
export function indexBy<T, K extends string | number = string>(condition: (key: T) => K, list: T[]): { [key in K]: T };
|
|
784
|
-
export function indexBy<T, K extends string | number | undefined = string>(condition: (key: T) => K, list: T[]): { [key in NonNullable<K>]?: T };
|
|
785
|
-
export function indexBy<T, K extends string | number = string>(condition: (key: T) => K): (list: T[]) => { [key in K]: T };
|
|
786
|
-
export function indexBy<T, K extends string | number | undefined = string>(condition: (key: T) => K | undefined): (list: T[]) => { [key in NonNullable<K>]?: T };
|
|
787
|
-
export function indexBy<T>(condition: string, list: T[]): { [key: string]: T };
|
|
788
|
-
export function indexBy<T>(condition: string): (list: T[]) => { [key: string]: T };
|
|
789
|
-
|
|
790
|
-
/**
|
|
791
|
-
* It returns the index of the first element of `list` equals to `valueToFind`.
|
|
792
|
-
*
|
|
793
|
-
* If there is no such element, it returns `-1`.
|
|
362
|
+
* It uses `R.equals` for list of objects/arrays or native `indexOf` for any other case.
|
|
794
363
|
*/
|
|
795
|
-
export function indexOf<T>(valueToFind: T, list: T[]): number;
|
|
796
364
|
export function indexOf<T>(valueToFind: T): (list: T[]) => number;
|
|
797
365
|
|
|
798
366
|
/**
|
|
@@ -804,22 +372,10 @@ export function init(input: string): string;
|
|
|
804
372
|
/**
|
|
805
373
|
* It returns a new list by applying a `predicate` function to all elements of `list1` and `list2` and keeping only these elements where `predicate` returns `true`.
|
|
806
374
|
*/
|
|
807
|
-
export function innerJoin<T1, T2>(
|
|
808
|
-
pred: (a: T1, b: T2) => boolean,
|
|
809
|
-
): (list1: T1[], list2: T2[]) => T1[];
|
|
810
375
|
export function innerJoin<T1, T2>(
|
|
811
376
|
pred: (a: T1, b: T2) => boolean,
|
|
812
377
|
list1: T1[],
|
|
813
378
|
): (list2: T2[]) => T1[];
|
|
814
|
-
export function innerJoin<T1, T2>(pred: (a: T1, b: T2) => boolean, list1: T1[], list2: T2[]): T1[];
|
|
815
|
-
|
|
816
|
-
export function insert(index: number): <T>(itemToInsert: T, list: T[]) => T[];
|
|
817
|
-
export function insert<T>(index: number, itemToInsert: T): (list: T[]) => T[];
|
|
818
|
-
export function insert<T>(index: number, itemToInsert: T, list: T[]): T[];
|
|
819
|
-
|
|
820
|
-
export function insertAll(index: number): <T>(itemsToInsert: T[], list: T[]) => T[];
|
|
821
|
-
export function insertAll<T>(index: number, itemsToInsert: T[]): (list: T[]) => T[];
|
|
822
|
-
export function insertAll<T>(index: number, itemsToInsert: T[], list: T[]): T[];
|
|
823
379
|
|
|
824
380
|
/**
|
|
825
381
|
* It loops through `listA` and `listB` and returns the intersection of the two according to `R.equals`.
|
|
@@ -830,65 +386,29 @@ export function intersection<T>(listA: T[]): (listB: T[]) => T[];
|
|
|
830
386
|
/**
|
|
831
387
|
* It adds a `separator` between members of `list`.
|
|
832
388
|
*/
|
|
833
|
-
export function intersperse<T>(separator: T, list: T[]): T[];
|
|
834
389
|
export function intersperse<T>(separator: T): (list: T[]) => T[];
|
|
835
390
|
|
|
836
|
-
/**
|
|
837
|
-
* It returns `true` if `x` is instance of `targetPrototype`.
|
|
838
|
-
*/
|
|
839
|
-
export function is<C extends () => any>(targetPrototype: C, val: any): val is ReturnType<C>;
|
|
840
|
-
export function is<C extends new () => any>(targetPrototype: C, val: any): val is InstanceType<C>;
|
|
841
|
-
export function is<C extends () => any>(targetPrototype: C): (val: any) => val is ReturnType<C>;
|
|
842
|
-
export function is<C extends new () => any>(targetPrototype: C): (val: any) => val is InstanceType<C>;
|
|
843
|
-
|
|
844
|
-
/**
|
|
845
|
-
* It returns `true` if `x` is `empty`.
|
|
846
|
-
*/
|
|
847
|
-
export function isEmpty<T>(x: T): boolean;
|
|
848
|
-
|
|
849
|
-
/**
|
|
850
|
-
* It returns `true` if `x` is either `null` or `undefined`.
|
|
851
|
-
*/
|
|
852
|
-
export function isNil(x: any): x is null | undefined;
|
|
853
|
-
|
|
854
391
|
export function isNotEmpty<T>(value: T[]): value is NonEmptyArray<T>;
|
|
855
392
|
export function isNotEmpty<T>(value: readonly T[]): value is ReadonlyNonEmptyArray<T>;
|
|
856
393
|
export function isNotEmpty(value: any): boolean;
|
|
857
394
|
|
|
858
|
-
export function isNotNil<T>(value: T): value is NonNullable<T>;
|
|
859
|
-
|
|
860
395
|
/**
|
|
861
396
|
* It returns a string of all `list` instances joined with a `glue`.
|
|
862
397
|
*/
|
|
863
398
|
export function join<T>(glue: string, list: T[]): string;
|
|
864
399
|
export function join<T>(glue: string): (list: T[]) => string;
|
|
865
400
|
|
|
866
|
-
/**
|
|
867
|
-
* It applies list of function to a list of inputs.
|
|
868
|
-
*/
|
|
869
|
-
export function juxt<A extends any[], R1>(fns: [(...a: A) => R1]): (...a: A) => [R1];
|
|
870
|
-
export function juxt<A extends any[], R1, R2>(fns: [(...a: A) => R1, (...a: A) => R2]): (...a: A) => [R1, R2];
|
|
871
|
-
export function juxt<A extends any[], R1, R2, R3>(fns: [(...a: A) => R1, (...a: A) => R2, (...a: A) => R3]): (...a: A) => [R1, R2, R3];
|
|
872
|
-
export function juxt<A extends any[], R1, R2, R3, R4>(fns: [(...a: A) => R1, (...a: A) => R2, (...a: A) => R3, (...a: A) => R4]): (...a: A) => [R1, R2, R3, R4];
|
|
873
|
-
export function juxt<A extends any[], R1, R2, R3, R4, R5>(fns: [(...a: A) => R1, (...a: A) => R2, (...a: A) => R3, (...a: A) => R4, (...a: A) => R5]): (...a: A) => [R1, R2, R3, R4, R5];
|
|
874
|
-
export function juxt<A extends any[], U>(fns: Array<(...args: A) => U>): (...args: A) => U[];
|
|
875
|
-
|
|
876
|
-
/**
|
|
877
|
-
* It applies `Object.keys` over `x` and returns its keys.
|
|
878
|
-
*/
|
|
879
|
-
export function keys<T extends object>(x: T): (keyof T & string)[];
|
|
880
|
-
export function keys<T>(x: T): string[];
|
|
881
|
-
|
|
882
401
|
/**
|
|
883
402
|
* It returns the last element of `input`, as the `input` can be either a string or an array. It returns `undefined` if array has length of 0.
|
|
884
403
|
*/
|
|
885
|
-
export function last(
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
404
|
+
export function last<T>(listOrString: T): T extends string ? string :
|
|
405
|
+
T extends [] ? undefined :
|
|
406
|
+
T extends readonly [...infer R, infer L] ? L :
|
|
407
|
+
T extends readonly [infer L] ? L :
|
|
408
|
+
T extends [infer L] ? L :
|
|
409
|
+
T extends [...infer R, infer L] ? L :
|
|
410
|
+
T extends unknown[] ? T[number] :
|
|
411
|
+
undefined;
|
|
892
412
|
|
|
893
413
|
/**
|
|
894
414
|
* It returns the last index of `target` in `list` array.
|
|
@@ -900,95 +420,64 @@ export function last(str: string): string | undefined;
|
|
|
900
420
|
export function lastIndexOf<T>(target: T, list: T[]): number;
|
|
901
421
|
export function lastIndexOf<T>(target: T): (list: T[]) => number;
|
|
902
422
|
|
|
903
|
-
/**
|
|
904
|
-
* It returns the `length` property of list or string `input`.
|
|
905
|
-
*/
|
|
906
|
-
export function length<T>(input: T[]): number;
|
|
907
|
-
|
|
908
|
-
/**
|
|
909
|
-
* It returns a `lens` for the given `getter` and `setter` functions.
|
|
910
|
-
*
|
|
911
|
-
* The `getter` **gets** the value of the focus; the `setter` **sets** the value of the focus.
|
|
912
|
-
*
|
|
913
|
-
* The setter should not mutate the data structure.
|
|
914
|
-
*/
|
|
915
|
-
export function lens<S, A>(getter: (s: S) => A, setter: (a: A, s: S) => S): Lens<S, A>;
|
|
916
|
-
|
|
917
|
-
/**
|
|
918
|
-
* It returns a lens that focuses on specified `index`.
|
|
919
|
-
*/
|
|
920
|
-
export function lensIndex<A>(n: number): Lens<A[], A>;
|
|
921
|
-
export function lensIndex<A extends any[], N extends number>(n: N): Lens<A, A[N]>;
|
|
922
|
-
|
|
923
|
-
/**
|
|
924
|
-
* It returns a lens that focuses on specified `path`.
|
|
925
|
-
*/
|
|
926
|
-
export function lensPath<S, K0 extends keyof S = keyof S>(path: [K0]): Lens<S, S[K0]>;
|
|
927
|
-
export function lensPath<S, K0 extends keyof S = keyof S, K1 extends keyof S[K0] = keyof S[K0]>(
|
|
928
|
-
path: [K0, K1],
|
|
929
|
-
): Lens<S, S[K0][K1]>;
|
|
930
|
-
export function lensPath<
|
|
931
|
-
S,
|
|
932
|
-
K0 extends keyof S = keyof S,
|
|
933
|
-
K1 extends keyof S[K0] = keyof S[K0],
|
|
934
|
-
K2 extends keyof S[K0][K1] = keyof S[K0][K1]
|
|
935
|
-
>(path: [K0, K1, K2]): Lens<S, S[K0][K1][K2]>;
|
|
936
|
-
export function lensPath<
|
|
937
|
-
S,
|
|
938
|
-
K0 extends keyof S = keyof S,
|
|
939
|
-
K1 extends keyof S[K0] = keyof S[K0],
|
|
940
|
-
K2 extends keyof S[K0][K1] = keyof S[K0][K1],
|
|
941
|
-
K3 extends keyof S[K0][K1][K2] = keyof S[K0][K1][K2]
|
|
942
|
-
>(path: [K0, K1, K2, K3]): Lens<S, S[K0][K1][K2][K3]>;
|
|
943
|
-
export function lensPath<
|
|
944
|
-
S,
|
|
945
|
-
K0 extends keyof S = keyof S,
|
|
946
|
-
K1 extends keyof S[K0] = keyof S[K0],
|
|
947
|
-
K2 extends keyof S[K0][K1] = keyof S[K0][K1],
|
|
948
|
-
K3 extends keyof S[K0][K1][K2] = keyof S[K0][K1][K2],
|
|
949
|
-
K4 extends keyof S[K0][K1][K2][K3] = keyof S[K0][K1][K2][K3]
|
|
950
|
-
>(path: [K0, K1, K2, K3, K4]): Lens<S, S[K0][K1][K2][K3][K4]>;
|
|
951
|
-
export function lensPath<
|
|
952
|
-
S,
|
|
953
|
-
K0 extends keyof S = keyof S,
|
|
954
|
-
K1 extends keyof S[K0] = keyof S[K0],
|
|
955
|
-
K2 extends keyof S[K0][K1] = keyof S[K0][K1],
|
|
956
|
-
K3 extends keyof S[K0][K1][K2] = keyof S[K0][K1][K2],
|
|
957
|
-
K4 extends keyof S[K0][K1][K2][K3] = keyof S[K0][K1][K2][K3],
|
|
958
|
-
K5 extends keyof S[K0][K1][K2][K3][K4] = keyof S[K0][K1][K2][K3][K4]
|
|
959
|
-
>(path: [K0, K1, K2, K3, K4, K5]): Lens<S, S[K0][K1][K2][K3][K4][K5]>;
|
|
960
|
-
export function lensPath<S = any, A = any>(path: Path): Lens<S, A>;
|
|
961
|
-
|
|
962
|
-
/**
|
|
963
|
-
* It returns a lens that focuses on specified property `prop`.
|
|
964
|
-
*/
|
|
965
|
-
export function lensProp<S, K extends keyof S = keyof S>(prop: K): Lens<S, S[K]>;
|
|
966
|
-
|
|
967
|
-
export function lt<T, U>(x: T, y: U): boolean;
|
|
968
|
-
export function lt<T, U>(x: T): (y: U) => boolean;
|
|
969
|
-
|
|
970
|
-
export function lte<T, U>(x: T, y: U): boolean;
|
|
971
|
-
export function lte<T, U>(x: T): (y: U) => boolean;
|
|
972
|
-
|
|
973
423
|
/**
|
|
974
424
|
* It returns the result of looping through `iterable` with `fn`.
|
|
975
425
|
*
|
|
976
426
|
* It works with both array and object.
|
|
977
427
|
*/
|
|
978
|
-
export function map<T
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
export function map<T
|
|
982
|
-
|
|
983
|
-
|
|
428
|
+
export function map<T extends IterableContainer, U>(
|
|
429
|
+
fn: (value: T[number], index: number) => U,
|
|
430
|
+
): (data: T) => Mapped<T, U>;
|
|
431
|
+
export function map<T extends IterableContainer, U>(
|
|
432
|
+
fn: (value: T[number]) => U,
|
|
433
|
+
): (data: T) => Mapped<T, U>;
|
|
434
|
+
export function map<T extends IterableContainer, U>(
|
|
435
|
+
fn: (value: T[number], index: number) => U,
|
|
436
|
+
data: T
|
|
437
|
+
) : Mapped<T, U>;
|
|
438
|
+
export function map<T extends IterableContainer, U>(
|
|
439
|
+
fn: (value: T[number]) => U,
|
|
440
|
+
data: T
|
|
441
|
+
) : Mapped<T, U>;
|
|
442
|
+
|
|
443
|
+
/**
|
|
444
|
+
* Sequential asynchronous mapping with `fn` over members of `list`.
|
|
445
|
+
*/
|
|
446
|
+
export function mapAsync<T extends IterableContainer, U>(
|
|
447
|
+
fn: (value: T[number], index: number) => Promise<U>,
|
|
448
|
+
): (data: T) => Promise<Mapped<T, U>>;
|
|
449
|
+
export function mapAsync<T extends IterableContainer, U>(
|
|
450
|
+
fn: (value: T[number]) => Promise<U>,
|
|
451
|
+
): (data: T) => Promise<Mapped<T, U>>;
|
|
452
|
+
export function mapAsync<T extends IterableContainer, U>(
|
|
453
|
+
fn: (value: T[number], index: number) => Promise<U>,
|
|
454
|
+
data: T
|
|
455
|
+
): Promise<Mapped<T, U>>;
|
|
456
|
+
export function mapAsync<T extends IterableContainer, U>(
|
|
457
|
+
fn: (value: T[number]) => Promise<U>,
|
|
458
|
+
data: T
|
|
459
|
+
): Promise<Mapped<T, U>>;
|
|
460
|
+
|
|
461
|
+
export function mapObject<T extends object, Value>(
|
|
462
|
+
valueMapper: (
|
|
463
|
+
value: EnumerableStringKeyedValueOf<T>,
|
|
464
|
+
key: EnumerableStringKeyOf<T>,
|
|
465
|
+
data: T,
|
|
466
|
+
) => Value,
|
|
467
|
+
): (data: T) => MappedValues<T, Value>;
|
|
468
|
+
|
|
469
|
+
export function mapObjectAsync<T extends object, Value>(
|
|
470
|
+
valueMapper: (
|
|
471
|
+
value: EnumerableStringKeyedValueOf<T>,
|
|
472
|
+
key: EnumerableStringKeyOf<T>,
|
|
473
|
+
data: T,
|
|
474
|
+
) => Promise<Value>,
|
|
475
|
+
): (data: T) => Promise<MappedValues<T, Value>>;
|
|
476
|
+
|
|
477
|
+
// API_MARKER_END
|
|
478
|
+
// ============================================
|
|
984
479
|
|
|
985
|
-
|
|
986
|
-
* It works the same way as `R.map` does for objects. It is added as Ramda also has this method.
|
|
987
|
-
*/
|
|
988
|
-
export function mapObjIndexed<T>(fn: ObjectIterator<T, T>, iterable: Dictionary<T>): Dictionary<T>;
|
|
989
|
-
export function mapObjIndexed<T, U>(fn: ObjectIterator<T, U>, iterable: Dictionary<T>): Dictionary<U>;
|
|
990
|
-
export function mapObjIndexed<T>(fn: ObjectIterator<T, T>): (iterable: Dictionary<T>) => Dictionary<T>;
|
|
991
|
-
export function mapObjIndexed<T, U>(fn: ObjectIterator<T, U>): (iterable: Dictionary<T>) => Dictionary<U>;
|
|
480
|
+
export as namespace R
|
|
992
481
|
|
|
993
482
|
/**
|
|
994
483
|
* Curried version of `String.prototype.match` which returns empty array, when there is no match.
|
|
@@ -1031,30 +520,6 @@ export function median(list: number[]): number;
|
|
|
1031
520
|
export function merge<A, B>(target: A, newProps: B): A & B
|
|
1032
521
|
export function merge<Output>(target: any): (newProps: any) => Output;
|
|
1033
522
|
|
|
1034
|
-
/**
|
|
1035
|
-
* It merges all objects of `list` array sequentially and returns the result.
|
|
1036
|
-
*/
|
|
1037
|
-
export function mergeAll<T>(list: object[]): T;
|
|
1038
|
-
export function mergeAll(list: object[]): object;
|
|
1039
|
-
|
|
1040
|
-
export function mergeDeepLeft<Output>(newProps: object, target: object): Output;
|
|
1041
|
-
export function mergeDeepLeft<Output>(newProps: object): (target: object) => Output;
|
|
1042
|
-
|
|
1043
|
-
/**
|
|
1044
|
-
* Creates a new object with the own properties of the first object merged with the own properties of the second object. If a key exists in both objects:
|
|
1045
|
-
*
|
|
1046
|
-
* - and both values are objects, the two values will be recursively merged
|
|
1047
|
-
* - otherwise the value from the second object will be used.
|
|
1048
|
-
*/
|
|
1049
|
-
export function mergeDeepRight<Output>(target: object, newProps: object): Output;
|
|
1050
|
-
export function mergeDeepRight<Output>(target: object): (newProps: object) => Output;
|
|
1051
|
-
|
|
1052
|
-
/**
|
|
1053
|
-
* Same as `R.merge`, but in opposite direction.
|
|
1054
|
-
*/
|
|
1055
|
-
export function mergeLeft<Output>(newProps: object, target: object): Output;
|
|
1056
|
-
export function mergeLeft<Output>(newProps: object): (target: object) => Output;
|
|
1057
|
-
|
|
1058
523
|
/**
|
|
1059
524
|
* It creates a copy of `target` object with overwritten `newProps` properties. Previously known as `R.merge` but renamed after Ramda did the same.
|
|
1060
525
|
*/
|
|
@@ -1062,498 +527,948 @@ export function mergeRight<A, B>(target: A, newProps: B): A & B
|
|
|
1062
527
|
export function mergeRight<Output>(target: any): (newProps: any) => Output;
|
|
1063
528
|
|
|
1064
529
|
/**
|
|
1065
|
-
*
|
|
530
|
+
* Helper to merge all calculated TypeScript definitions into one definition.
|
|
531
|
+
* It returns its input and it is intended to be used as last method inside `R.pipe` chain.
|
|
1066
532
|
*/
|
|
1067
|
-
export function
|
|
1068
|
-
export function mergeWith<Output>(fn: (x: any, z: any) => any, a: Record<string, unknown>, b: Record<string, unknown>): Output;
|
|
1069
|
-
export function mergeWith(fn: (x: any, z: any) => any, a: Record<string, unknown>): (b: Record<string, unknown>) => Record<string, unknown>;
|
|
1070
|
-
export function mergeWith<Output>(fn: (x: any, z: any) => any, a: Record<string, unknown>): (b: Record<string, unknown>) => Output;
|
|
1071
|
-
export function mergeWith(fn: (x: any, z: any) => any): <U, V>(a: U, b: V) => Record<string, unknown>;
|
|
1072
|
-
export function mergeWith<Output>(fn: (x: any, z: any) => any): <U, V>(a: U, b: V) => Output;
|
|
533
|
+
export function mergeTypes<T>(x: T): MergeTypes<T>;
|
|
1073
534
|
|
|
1074
535
|
/**
|
|
1075
536
|
* It returns the lesser value between `x` and `y`.
|
|
1076
537
|
*/
|
|
1077
|
-
export function min<T extends Ord>(x: T, y: T): T;
|
|
1078
538
|
export function min<T extends Ord>(x: T): (y: T) => T;
|
|
1079
539
|
|
|
1080
540
|
/**
|
|
1081
541
|
* It returns the lesser value between `x` and `y` according to `compareFn` function.
|
|
1082
542
|
*/
|
|
1083
|
-
export function minBy<T>(compareFn: (input: T) => Ord, x: T, y: T): T;
|
|
1084
543
|
export function minBy<T>(compareFn: (input: T) => Ord, x: T): (y: T) => T;
|
|
1085
|
-
export function minBy<T>(compareFn: (input: T) => Ord): (x: T) => (y: T) => T;
|
|
1086
|
-
|
|
1087
|
-
export function modify<K extends PropertyKey, T>(prop: K, fn: (value: T) => T): <U extends Record<K, T>>(object: U) => U;
|
|
1088
|
-
export function modify<U, K extends keyof U>(prop: K, fn: (value: U[K]) => U[K], object: U): U;
|
|
1089
|
-
export function modify<K extends PropertyKey>(prop: K): {
|
|
1090
|
-
<T>(fn: (value: T) => T): <U extends Record<K, T>>(object: U) => U;
|
|
1091
|
-
<T, U extends Record<K, T>>(fn: (value: T) => T, object: U): U;
|
|
1092
|
-
};
|
|
1093
544
|
|
|
1094
545
|
/**
|
|
1095
|
-
* It changes a property
|
|
546
|
+
* It changes a property with the result of transformer function.
|
|
1096
547
|
*/
|
|
1097
|
-
export function
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
/**
|
|
1102
|
-
* Curried version of `x%y`.
|
|
1103
|
-
*/
|
|
1104
|
-
export function modulo(x: number, y: number): number;
|
|
1105
|
-
export function modulo(x: number): (y: number) => number;
|
|
1106
|
-
|
|
1107
|
-
/**
|
|
1108
|
-
* It returns a copy of `list` with exchanged `fromIndex` and `toIndex` elements.
|
|
1109
|
-
*/
|
|
1110
|
-
export function move<T>(fromIndex: number, toIndex: number, list: T[]): T[];
|
|
1111
|
-
export function move(fromIndex: number, toIndex: number): <T>(list: T[]) => T[];
|
|
1112
|
-
export function move(fromIndex: number): {
|
|
1113
|
-
<T>(toIndex: number, list: T[]): T[];
|
|
1114
|
-
(toIndex: number): <T>(list: T[]) => T[];
|
|
1115
|
-
};
|
|
548
|
+
export function modify<K extends string, A, P>(
|
|
549
|
+
prop: K,
|
|
550
|
+
fn: (a: A) => P,
|
|
551
|
+
): <T extends Record<K, A>>(target: T) => Omit<T, K> & Record<K, P>;
|
|
1116
552
|
|
|
1117
553
|
/**
|
|
1118
|
-
*
|
|
554
|
+
* It changes a property of object on the base of provided path and transformer function.
|
|
1119
555
|
*/
|
|
1120
|
-
export function
|
|
1121
|
-
export function
|
|
1122
|
-
|
|
1123
|
-
|
|
556
|
+
export function modifyPath<U, T>(path: [], fn: (value: U) => T): (obj: U) => T;
|
|
557
|
+
export function modifyPath<
|
|
558
|
+
K0 extends keyof U,
|
|
559
|
+
U,
|
|
560
|
+
T
|
|
561
|
+
>(path: [K0], fn: (value: U[K0]) => T): (obj: U) => DeepModify<[K0], U, T>;
|
|
562
|
+
export function modifyPath<
|
|
563
|
+
K0 extends keyof U,
|
|
564
|
+
U,
|
|
565
|
+
T
|
|
566
|
+
>(path: `${K0}`, fn: (value: U[K0]) => T): (obj: U) => DeepModify<[K0], U, T>;
|
|
567
|
+
export function modifyPath<
|
|
568
|
+
K0 extends keyof U,
|
|
569
|
+
K1 extends keyof U[K0],
|
|
570
|
+
U,
|
|
571
|
+
T
|
|
572
|
+
>(path: [K0, K1], fn: (value: U[K0][K1]) => T): (obj: U) => DeepModify<[K0, K1], U, T>;
|
|
573
|
+
export function modifyPath<
|
|
574
|
+
K0 extends keyof U,
|
|
575
|
+
K1 extends keyof U[K0],
|
|
576
|
+
U,
|
|
577
|
+
T
|
|
578
|
+
>(path: `${K0}.${K1}`, fn: (value: U[K0][K1]) => T): (obj: U) => DeepModify<[K0, K1], U, T>;
|
|
579
|
+
export function modifyPath<
|
|
580
|
+
K0 extends keyof U,
|
|
581
|
+
K1 extends keyof U[K0],
|
|
582
|
+
K2 extends keyof U[K0][K1],
|
|
583
|
+
U,
|
|
584
|
+
T
|
|
585
|
+
>(path: [K0, K1, K2], fn: (value: U[K0][K1][K2]) => T): (obj: U) => DeepModify<[K0, K1, K2], U, T>;
|
|
586
|
+
export function modifyPath<
|
|
587
|
+
K0 extends keyof U,
|
|
588
|
+
K1 extends keyof U[K0],
|
|
589
|
+
K2 extends keyof U[K0][K1],
|
|
590
|
+
U,
|
|
591
|
+
T
|
|
592
|
+
>(path: `${K0}.${K1}.${K2}`, fn: (value: U[K0][K1][K2]) => T): (obj: U) => DeepModify<[K0, K1, K2], U, T>;
|
|
593
|
+
export function modifyPath<
|
|
594
|
+
K0 extends keyof U,
|
|
595
|
+
K1 extends keyof U[K0],
|
|
596
|
+
K2 extends keyof U[K0][K1],
|
|
597
|
+
K3 extends keyof U[K0][K1][K2],
|
|
598
|
+
U,
|
|
599
|
+
T
|
|
600
|
+
>(path: [K0, K1, K2, K3], fn: (value: U[K0][K1][K2][K3]) => T): (obj: U) => DeepModify<[K0, K1, K2, K3], U, T>;
|
|
601
|
+
export function modifyPath<
|
|
602
|
+
K0 extends keyof U,
|
|
603
|
+
K1 extends keyof U[K0],
|
|
604
|
+
K2 extends keyof U[K0][K1],
|
|
605
|
+
K3 extends keyof U[K0][K1][K2],
|
|
606
|
+
U,
|
|
607
|
+
T
|
|
608
|
+
>(path: `${K0}.${K1}.${K2}.${K3}`, fn: (value: U[K0][K1][K2][K3]) => T): (obj: U) => DeepModify<[K0, K1, K2, K3], U, T>;
|
|
609
|
+
export function modifyPath<
|
|
610
|
+
K0 extends keyof U,
|
|
611
|
+
K1 extends keyof U[K0],
|
|
612
|
+
K2 extends keyof U[K0][K1],
|
|
613
|
+
K3 extends keyof U[K0][K1][K2],
|
|
614
|
+
K4 extends keyof U[K0][K1][K2][K3],
|
|
615
|
+
U,
|
|
616
|
+
T
|
|
617
|
+
>(path: [K0, K1, K2, K3, K4], fn: (value: U[K0][K1][K2][K3][K4]) => T): (obj: U) => DeepModify<[K0, K1, K2, K3, K4], U, T>;
|
|
618
|
+
export function modifyPath<
|
|
619
|
+
K0 extends keyof U,
|
|
620
|
+
K1 extends keyof U[K0],
|
|
621
|
+
K2 extends keyof U[K0][K1],
|
|
622
|
+
K3 extends keyof U[K0][K1][K2],
|
|
623
|
+
K4 extends keyof U[K0][K1][K2][K3],
|
|
624
|
+
U,
|
|
625
|
+
T
|
|
626
|
+
>(path: `${K0}.${K1}.${K2}.${K3}.${K4}`, fn: (value: U[K0][K1][K2][K3][K4]) => T): (obj: U) => DeepModify<[K0, K1, K2, K3, K4], U, T>;
|
|
627
|
+
export function modifyPath<
|
|
628
|
+
K0 extends keyof U,
|
|
629
|
+
K1 extends keyof U[K0],
|
|
630
|
+
K2 extends keyof U[K0][K1],
|
|
631
|
+
K3 extends keyof U[K0][K1][K2],
|
|
632
|
+
K4 extends keyof U[K0][K1][K2][K3],
|
|
633
|
+
K5 extends keyof U[K0][K1][K2][K3][K4],
|
|
634
|
+
U,
|
|
635
|
+
T
|
|
636
|
+
>(path: [K0, K1, K2, K3, K4, K5], fn: (value: U[K0][K1][K2][K3][K4][K5]) => T): (obj: U) => DeepModify<[K0, K1, K2, K3, K4, K5], U, T>;
|
|
637
|
+
export function modifyPath<
|
|
638
|
+
K0 extends keyof U,
|
|
639
|
+
K1 extends keyof U[K0],
|
|
640
|
+
K2 extends keyof U[K0][K1],
|
|
641
|
+
K3 extends keyof U[K0][K1][K2],
|
|
642
|
+
K4 extends keyof U[K0][K1][K2][K3],
|
|
643
|
+
K5 extends keyof U[K0][K1][K2][K3][K4],
|
|
644
|
+
U,
|
|
645
|
+
T
|
|
646
|
+
>(path: `${K0}.${K1}.${K2}.${K3}.${K4}.${K5}`, fn: (value: U[K0][K1][K2][K3][K4][K5]) => T): (obj: U) => DeepModify<[K0, K1, K2, K3, K4, K5], U, T>;
|
|
647
|
+
export function modifyPath<
|
|
648
|
+
K0 extends keyof U,
|
|
649
|
+
K1 extends keyof U[K0],
|
|
650
|
+
K2 extends keyof U[K0][K1],
|
|
651
|
+
K3 extends keyof U[K0][K1][K2],
|
|
652
|
+
K4 extends keyof U[K0][K1][K2][K3],
|
|
653
|
+
K5 extends keyof U[K0][K1][K2][K3][K4],
|
|
654
|
+
K6 extends keyof U[K0][K1][K2][K3][K4][K5],
|
|
655
|
+
U,
|
|
656
|
+
T
|
|
657
|
+
>(path: [K0, K1, K2, K3, K4, K5, K6], fn: (value: U[K0][K1][K2][K3][K4][K5][K6]) => T): (obj: U) => DeepModify<[K0, K1, K2, K3, K4, K5, K6], U, T>;
|
|
658
|
+
export function modifyPath<
|
|
659
|
+
K0 extends keyof U,
|
|
660
|
+
K1 extends keyof U[K0],
|
|
661
|
+
K2 extends keyof U[K0][K1],
|
|
662
|
+
K3 extends keyof U[K0][K1][K2],
|
|
663
|
+
K4 extends keyof U[K0][K1][K2][K3],
|
|
664
|
+
K5 extends keyof U[K0][K1][K2][K3][K4],
|
|
665
|
+
K6 extends keyof U[K0][K1][K2][K3][K4][K5],
|
|
666
|
+
U,
|
|
667
|
+
T
|
|
668
|
+
>(path: `${K0}.${K1}.${K2}.${K3}.${K4}.${K5}.${K6}`, fn: (value: U[K0][K1][K2][K3][K4][K5][K6]) => T): (obj: U) => DeepModify<[K0, K1, K2, K3, K4, K5, K6], U, T>;
|
|
669
|
+
export function modifyPath<B, A = any>(path: Path, fn: (a: any) => any): (obj: A) => B;
|
|
1124
670
|
|
|
1125
671
|
/**
|
|
1126
672
|
* It returns `true`, if all members of array `list` returns `false`, when applied as argument to `predicate` function.
|
|
1127
673
|
*/
|
|
1128
|
-
export function none<T>(predicate: (x: T) => boolean, list: T[]): boolean;
|
|
1129
674
|
export function none<T>(predicate: (x: T) => boolean): (list: T[]) => boolean;
|
|
1130
675
|
|
|
1131
|
-
/**
|
|
1132
|
-
* It returns a boolean negated version of `input`.
|
|
1133
|
-
*/
|
|
1134
|
-
export function not(input: any): boolean;
|
|
1135
|
-
|
|
1136
|
-
/**
|
|
1137
|
-
* Curried version of `input[index]`.
|
|
1138
|
-
*/
|
|
1139
|
-
export function nth(index: number, input: string): string;
|
|
1140
|
-
export function nth<T>(index: number, input: T[]): T | undefined;
|
|
1141
|
-
export function nth(n: number): {
|
|
1142
|
-
<T>(input: T[]): T | undefined;
|
|
1143
|
-
(input: string): string;
|
|
1144
|
-
};
|
|
1145
|
-
|
|
1146
676
|
/**
|
|
1147
677
|
* It creates an object with a single key-value pair.
|
|
1148
678
|
*/
|
|
1149
|
-
export function objOf<T, K extends
|
|
1150
|
-
export function objOf<K extends string>(key: K): <T>(value: T) => Record<K, T>;
|
|
1151
|
-
|
|
1152
|
-
export function of<T>(x: T): T[];
|
|
1153
|
-
|
|
1154
|
-
/**
|
|
1155
|
-
* It returns a partial copy of an `obj` without `propsToOmit` properties.
|
|
1156
|
-
*/
|
|
1157
|
-
export function omit<T, K extends string>(propsToOmit: K[], obj: T): Omit<T, K>;
|
|
1158
|
-
export function omit<K extends string>(propsToOmit: K[]): <T>(obj: T) => Omit<T, K>;
|
|
1159
|
-
export function omit<T, U>(propsToOmit: string, obj: T): U;
|
|
1160
|
-
export function omit<T, U>(propsToOmit: string): (obj: T) => U;
|
|
1161
|
-
export function omit<T>(propsToOmit: string, obj: object): T;
|
|
1162
|
-
export function omit<T>(propsToOmit: string): (obj: object) => T;
|
|
679
|
+
export function objOf<T, K extends PropertyKey>(key: K): (value: T) => { [P in K]: T };
|
|
1163
680
|
|
|
1164
681
|
/**
|
|
1165
|
-
* It
|
|
682
|
+
* It will return `true` if `specification` object fully or partially include `obj` object.
|
|
1166
683
|
*
|
|
1167
|
-
*
|
|
1168
|
-
*/
|
|
1169
|
-
export function on<T, U, R>(binaryFn: (a: U, b: U) => R, unaryFn: (value: T) => U, a: T, b: T): R;
|
|
1170
|
-
export function on<T, U, R>(binaryFn: (a: U, b: U) => R, unaryFn: (value: T) => U, a: T): (b: T) => R;
|
|
1171
|
-
export function on<T, U, R>(binaryFn: (a: U, b: U) => R, unaryFn: (value: T) => U): {
|
|
1172
|
-
(a: T, b: T): R;
|
|
1173
|
-
(a: T): (b: T) => R;
|
|
1174
|
-
};
|
|
1175
|
-
|
|
1176
|
-
/**
|
|
1177
|
-
* It returns a function, which invokes only once `fn` function.
|
|
1178
|
-
*/
|
|
1179
|
-
export function once<T extends AnyFunction, C = unknown>(fn: T, context?: C): T;
|
|
1180
|
-
|
|
1181
|
-
/**
|
|
1182
|
-
* Logical OR
|
|
1183
|
-
*/
|
|
1184
|
-
export function or<T, U>(a: T, b: U): T | U;
|
|
1185
|
-
export function or<T>(a: T): <U>(b: U) => T | U;
|
|
1186
|
-
|
|
1187
|
-
/**
|
|
1188
|
-
* It returns a copied **Object** or **Array** with modified value received by applying function `fn` to `lens` focus.
|
|
684
|
+
* `R.equals` is used to determine equality.
|
|
1189
685
|
*/
|
|
1190
|
-
export function
|
|
1191
|
-
(fn: (a: A) => A): (value: S) => S;
|
|
1192
|
-
(fn: (a: A) => A, value: S): S;
|
|
1193
|
-
};
|
|
1194
|
-
export function over<S, A>(lens: Lens<S, A>, fn: (a: A) => A): (value: S) => S;
|
|
1195
|
-
export function over<S, A>(lens: Lens<S, A>, fn: (a: A) => A, value: S): S;
|
|
686
|
+
export function objectIncludes<T>(specification: T): <U>(obj: U) => boolean;
|
|
1196
687
|
|
|
1197
688
|
/**
|
|
1198
|
-
* It
|
|
1199
|
-
*
|
|
1200
|
-
* `R.partial` will keep returning a function until all the arguments that the function `fn` expects are passed.
|
|
1201
|
-
* The name comes from the fact that you partially inject the inputs.
|
|
1202
|
-
*/
|
|
1203
|
-
export function partial<V0, V1, T>(fn: (x0: V0, x1: V1) => T, args: [V0]): (x1: V1) => T;
|
|
1204
|
-
export function partial<V0, V1, V2, T>(fn: (x0: V0, x1: V1, x2: V2) => T, args: [V0, V1]): (x2: V2) => T;
|
|
1205
|
-
export function partial<V0, V1, V2, T>(fn: (x0: V0, x1: V1, x2: V2) => T, args: [V0]): (x1: V1, x2: V2) => T;
|
|
1206
|
-
export function partial<V0, V1, V2, V3, T>(
|
|
1207
|
-
fn: (x0: V0, x1: V1, x2: V2, x3: V3) => T,
|
|
1208
|
-
args: [V0, V1, V2],
|
|
1209
|
-
): (x2: V3) => T;
|
|
1210
|
-
export function partial<V0, V1, V2, V3, T>(
|
|
1211
|
-
fn: (x0: V0, x1: V1, x2: V2, x3: V3) => T,
|
|
1212
|
-
args: [V0, V1],
|
|
1213
|
-
): (x2: V2, x3: V3) => T;
|
|
1214
|
-
export function partial<V0, V1, V2, V3, T>(
|
|
1215
|
-
fn: (x0: V0, x1: V1, x2: V2, x3: V3) => T,
|
|
1216
|
-
args: [V0],
|
|
1217
|
-
): (x1: V1, x2: V2, x3: V3) => T;
|
|
1218
|
-
export function partial<T>(fn: (...a: any[]) => T, args: any[]): (...a: any[]) => T;
|
|
1219
|
-
|
|
1220
|
-
/**
|
|
1221
|
-
* `R.partialObject` is a curry helper designed specifically for functions accepting object as a single argument.
|
|
1222
|
-
*
|
|
1223
|
-
* Initially the function knows only a part from the whole input object and then `R.partialObject` helps in preparing the function for the second part, when it receives the rest of the input.
|
|
689
|
+
* It returns a partial copy of an `obj` without `propsToOmit` properties.
|
|
1224
690
|
*/
|
|
1225
|
-
export function
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
): (
|
|
691
|
+
export function omit<
|
|
692
|
+
S extends string,
|
|
693
|
+
Keys extends PickStringToPickPath<S>,
|
|
694
|
+
>(propsToPick: S): <U extends Partial<Record<ElementOf<Keys>, any>>>(obj: ElementOf<Keys> extends keyof U ? U : never) => ElementOf<Keys> extends keyof U ? MergeTypes<Omit<U, ElementOf<Keys>>> : never;
|
|
695
|
+
export function omit<const Keys extends PropertyKey[]>(propsToPick: Keys): <U extends Partial<Record<ElementOf<Keys>, any>>>(obj: ElementOf<Keys> extends keyof U ? U : never) => ElementOf<Keys> extends keyof U ? MergeTypes<Omit<U, ElementOf<Keys>>> : never;
|
|
1229
696
|
|
|
1230
697
|
/**
|
|
1231
698
|
* It will return array of two objects/arrays according to `predicate` function. The first member holds all instances of `input` that pass the `predicate` function, while the second member - those who doesn't.
|
|
1232
699
|
*/
|
|
700
|
+
export function partition<T, S extends T>(
|
|
701
|
+
predicate: (value: T, index: number, data: ReadonlyArray<T>) => value is S,
|
|
702
|
+
): (data: ReadonlyArray<T>) => [Array<S>, Array<Exclude<T, S>>];
|
|
1233
703
|
export function partition<T>(
|
|
1234
|
-
predicate:
|
|
1235
|
-
|
|
1236
|
-
): [T[], T[]];
|
|
1237
|
-
export function partition<T>(
|
|
1238
|
-
predicate: Predicate<T>
|
|
1239
|
-
): (input: T[]) => [T[], T[]];
|
|
1240
|
-
export function partition<T>(
|
|
1241
|
-
predicate: (x: T, prop?: string) => boolean,
|
|
1242
|
-
input: { [key: string]: T}
|
|
1243
|
-
): [{ [key: string]: T}, { [key: string]: T}];
|
|
1244
|
-
export function partition<T>(
|
|
1245
|
-
predicate: (x: T, prop?: string) => boolean
|
|
1246
|
-
): (input: { [key: string]: T}) => [{ [key: string]: T}, { [key: string]: T}];
|
|
704
|
+
predicate: (value: T, index: number, data: ReadonlyArray<T>) => boolean,
|
|
705
|
+
): (data: ReadonlyArray<T>) => [Array<T>, Array<T>];
|
|
1247
706
|
|
|
1248
707
|
/**
|
|
1249
708
|
* If `pathToSearch` is `'a.b'` then it will return `1` if `obj` is `{a:{b:1}}`.
|
|
1250
709
|
*
|
|
1251
710
|
* It will return `undefined`, if such path is not found.
|
|
1252
711
|
*/
|
|
1253
|
-
export function path<S, K0 extends keyof S
|
|
1254
|
-
export function path<S, K0 extends keyof S
|
|
712
|
+
export function path<S, K0 extends keyof S>(path: [K0]): (obj: S) => S[K0];
|
|
713
|
+
export function path<S, K0 extends keyof S>(path: `${K0}`): (obj: S) => S[K0];
|
|
714
|
+
export function path<S, K0 extends keyof S, K1 extends keyof S[K0]>(path: [K0, K1]): (obj: S) => S[K0][K1];
|
|
715
|
+
export function path<S, K0 extends keyof S, K1 extends keyof S[K0]>(path: `${K0}.${K1}`): (obj: S) => S[K0][K1];
|
|
716
|
+
export function path<
|
|
717
|
+
S,
|
|
718
|
+
K0 extends keyof S,
|
|
719
|
+
K1 extends keyof S[K0],
|
|
720
|
+
K2 extends keyof S[K0][K1]
|
|
721
|
+
>(path: [K0, K1, K2]): (obj: S) => S[K0][K1][K2];
|
|
1255
722
|
export function path<
|
|
1256
723
|
S,
|
|
1257
|
-
K0 extends keyof S
|
|
1258
|
-
K1 extends keyof S[K0]
|
|
1259
|
-
K2 extends keyof S[K0][K1]
|
|
1260
|
-
>(path:
|
|
724
|
+
K0 extends keyof S,
|
|
725
|
+
K1 extends keyof S[K0],
|
|
726
|
+
K2 extends keyof S[K0][K1]
|
|
727
|
+
>(path: `${K0}.${K1}.${K2}`): (obj: S) => S[K0][K1][K2];
|
|
1261
728
|
export function path<
|
|
1262
729
|
S,
|
|
1263
|
-
K0 extends keyof S
|
|
1264
|
-
K1 extends keyof S[K0]
|
|
1265
|
-
K2 extends keyof S[K0][K1]
|
|
1266
|
-
K3 extends keyof S[K0][K1][K2]
|
|
1267
|
-
>(path: [K0, K1, K2, K3]
|
|
730
|
+
K0 extends keyof S,
|
|
731
|
+
K1 extends keyof S[K0],
|
|
732
|
+
K2 extends keyof S[K0][K1],
|
|
733
|
+
K3 extends keyof S[K0][K1][K2]
|
|
734
|
+
>(path: [K0, K1, K2, K3]): (obj: S) => S[K0][K1][K2][K3];
|
|
1268
735
|
export function path<
|
|
1269
736
|
S,
|
|
1270
|
-
K0 extends keyof S
|
|
1271
|
-
K1 extends keyof S[K0]
|
|
1272
|
-
K2 extends keyof S[K0][K1]
|
|
1273
|
-
K3 extends keyof S[K0][K1][K2]
|
|
1274
|
-
|
|
737
|
+
K0 extends keyof S,
|
|
738
|
+
K1 extends keyof S[K0],
|
|
739
|
+
K2 extends keyof S[K0][K1],
|
|
740
|
+
K3 extends keyof S[K0][K1][K2]
|
|
741
|
+
>(path: `${K0}.${K1}.${K2}.${K3}`): (obj: S) => S[K0][K1][K2][K3];
|
|
742
|
+
export function path<
|
|
743
|
+
S,
|
|
744
|
+
K0 extends keyof S,
|
|
745
|
+
K1 extends keyof S[K0],
|
|
746
|
+
K2 extends keyof S[K0][K1],
|
|
747
|
+
K3 extends keyof S[K0][K1][K2],
|
|
748
|
+
K4 extends keyof S[K0][K1][K2][K3]
|
|
749
|
+
>(path: [K0, K1, K2, K3, K4]): (obj: S) => S[K0][K1][K2][K3][K4];
|
|
750
|
+
export function path<
|
|
751
|
+
S,
|
|
752
|
+
K0 extends keyof S,
|
|
753
|
+
K1 extends keyof S[K0],
|
|
754
|
+
K2 extends keyof S[K0][K1],
|
|
755
|
+
K3 extends keyof S[K0][K1][K2],
|
|
756
|
+
K4 extends keyof S[K0][K1][K2][K3]
|
|
757
|
+
>(path: `${K0}.${K1}.${K2}.${K3}.${K4}`): (obj: S) => S[K0][K1][K2][K3][K4];
|
|
758
|
+
export function path<
|
|
759
|
+
S,
|
|
760
|
+
K0 extends keyof S,
|
|
761
|
+
K1 extends keyof S[K0],
|
|
762
|
+
K2 extends keyof S[K0][K1],
|
|
763
|
+
K3 extends keyof S[K0][K1][K2],
|
|
764
|
+
K4 extends keyof S[K0][K1][K2][K3]
|
|
1275
765
|
>(path: [K0, K1, K2, K3, K4], obj: S): S[K0][K1][K2][K3][K4];
|
|
1276
766
|
export function path<
|
|
1277
767
|
S,
|
|
1278
|
-
K0 extends keyof S
|
|
1279
|
-
K1 extends keyof S[K0]
|
|
1280
|
-
K2 extends keyof S[K0][K1]
|
|
1281
|
-
K3 extends keyof S[K0][K1][K2]
|
|
1282
|
-
K4 extends keyof S[K0][K1][K2][K3]
|
|
1283
|
-
K5 extends keyof S[K0][K1][K2][K3][K4]
|
|
768
|
+
K0 extends keyof S,
|
|
769
|
+
K1 extends keyof S[K0],
|
|
770
|
+
K2 extends keyof S[K0][K1],
|
|
771
|
+
K3 extends keyof S[K0][K1][K2],
|
|
772
|
+
K4 extends keyof S[K0][K1][K2][K3],
|
|
773
|
+
K5 extends keyof S[K0][K1][K2][K3][K4]
|
|
774
|
+
>(path: [K0, K1, K2, K3, K4, K5]): (obj: S) => S[K0][K1][K2][K3][K4][K5];
|
|
775
|
+
export function path<
|
|
776
|
+
S,
|
|
777
|
+
K0 extends keyof S,
|
|
778
|
+
K1 extends keyof S[K0],
|
|
779
|
+
K2 extends keyof S[K0][K1],
|
|
780
|
+
K3 extends keyof S[K0][K1][K2],
|
|
781
|
+
K4 extends keyof S[K0][K1][K2][K3],
|
|
782
|
+
K5 extends keyof S[K0][K1][K2][K3][K4]
|
|
783
|
+
>(path: `${K0}.${K1}.${K2}.${K3}.${K4}.${K5}`): (obj: S) => S[K0][K1][K2][K3][K4][K5];
|
|
784
|
+
export function path<
|
|
785
|
+
S,
|
|
786
|
+
K0 extends keyof S,
|
|
787
|
+
K1 extends keyof S[K0],
|
|
788
|
+
K2 extends keyof S[K0][K1],
|
|
789
|
+
K3 extends keyof S[K0][K1][K2],
|
|
790
|
+
K4 extends keyof S[K0][K1][K2][K3],
|
|
791
|
+
K5 extends keyof S[K0][K1][K2][K3][K4]
|
|
1284
792
|
>(path: [K0, K1, K2, K3, K4, K5], obj: S): S[K0][K1][K2][K3][K4][K5];
|
|
1285
|
-
export function path<
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
793
|
+
export function path<
|
|
794
|
+
S,
|
|
795
|
+
K0 extends keyof S,
|
|
796
|
+
K1 extends keyof S[K0],
|
|
797
|
+
K2 extends keyof S[K0][K1],
|
|
798
|
+
K3 extends keyof S[K0][K1][K2],
|
|
799
|
+
K4 extends keyof S[K0][K1][K2][K3],
|
|
800
|
+
K5 extends keyof S[K0][K1][K2][K3][K4],
|
|
801
|
+
K6 extends keyof S[K0][K1][K2][K3][K4][K5]
|
|
802
|
+
>(path: [K0, K1, K2, K3, K4, K5, K6]): (obj: S) => S[K0][K1][K2][K3][K4][K5][K6];
|
|
803
|
+
export function path<
|
|
804
|
+
S,
|
|
805
|
+
K0 extends keyof S,
|
|
806
|
+
K1 extends keyof S[K0],
|
|
807
|
+
K2 extends keyof S[K0][K1],
|
|
808
|
+
K3 extends keyof S[K0][K1][K2],
|
|
809
|
+
K4 extends keyof S[K0][K1][K2][K3],
|
|
810
|
+
K5 extends keyof S[K0][K1][K2][K3][K4],
|
|
811
|
+
K6 extends keyof S[K0][K1][K2][K3][K4][K5]
|
|
812
|
+
>(path: `${K0}.${K1}.${K2}.${K3}.${K4}.${K5}.${K6}`): (obj: S) => S[K0][K1][K2][K3][K4][K5][K6];
|
|
813
|
+
export function path<
|
|
814
|
+
S,
|
|
815
|
+
K0 extends keyof S,
|
|
816
|
+
K1 extends keyof S[K0],
|
|
817
|
+
K2 extends keyof S[K0][K1],
|
|
818
|
+
K3 extends keyof S[K0][K1][K2],
|
|
819
|
+
K4 extends keyof S[K0][K1][K2][K3],
|
|
820
|
+
K5 extends keyof S[K0][K1][K2][K3][K4],
|
|
821
|
+
K6 extends keyof S[K0][K1][K2][K3][K4][K5]
|
|
822
|
+
>(path: [K0, K1, K2, K3, K4, K5, K6], obj: S): S[K0][K1][K2][K3][K4][K5][K6];
|
|
823
|
+
export function path<
|
|
824
|
+
S,
|
|
825
|
+
K0 extends keyof S,
|
|
826
|
+
K1 extends keyof S[K0],
|
|
827
|
+
K2 extends keyof S[K0][K1],
|
|
828
|
+
K3 extends keyof S[K0][K1][K2],
|
|
829
|
+
K4 extends keyof S[K0][K1][K2][K3],
|
|
830
|
+
K5 extends keyof S[K0][K1][K2][K3][K4],
|
|
831
|
+
K6 extends keyof S[K0][K1][K2][K3][K4][K5],
|
|
832
|
+
K7 extends keyof S[K0][K1][K2][K3][K4][K5][K6]
|
|
833
|
+
>(path: [K0, K1, K2, K3, K4, K5, K6, K7]): (obj: S) => S[K0][K1][K2][K3][K4][K5][K6][K7];
|
|
834
|
+
export function path<
|
|
835
|
+
S,
|
|
836
|
+
K0 extends keyof S,
|
|
837
|
+
K1 extends keyof S[K0],
|
|
838
|
+
K2 extends keyof S[K0][K1],
|
|
839
|
+
K3 extends keyof S[K0][K1][K2],
|
|
840
|
+
K4 extends keyof S[K0][K1][K2][K3],
|
|
841
|
+
K5 extends keyof S[K0][K1][K2][K3][K4],
|
|
842
|
+
K6 extends keyof S[K0][K1][K2][K3][K4][K5],
|
|
843
|
+
K7 extends keyof S[K0][K1][K2][K3][K4][K5][K6]
|
|
844
|
+
>(path: `${K0}.${K1}.${K2}.${K3}.${K4}.${K5}.${K6}.${K7}`): (obj: S) => S[K0][K1][K2][K3][K4][K5][K6][K7];
|
|
845
|
+
export function path<
|
|
846
|
+
S,
|
|
847
|
+
K0 extends keyof S,
|
|
848
|
+
K1 extends keyof S[K0],
|
|
849
|
+
K2 extends keyof S[K0][K1],
|
|
850
|
+
K3 extends keyof S[K0][K1][K2],
|
|
851
|
+
K4 extends keyof S[K0][K1][K2][K3],
|
|
852
|
+
K5 extends keyof S[K0][K1][K2][K3][K4],
|
|
853
|
+
K6 extends keyof S[K0][K1][K2][K3][K4][K5],
|
|
854
|
+
K7 extends keyof S[K0][K1][K2][K3][K4][K5][K6],
|
|
855
|
+
K8 extends keyof S[K0][K1][K2][K3][K4][K5][K6][K7]
|
|
856
|
+
>(path: [K0, K1, K2, K3, K4, K5, K6, K7, K8]): (obj: S) => S[K0][K1][K2][K3][K4][K5][K6][K7][K8];
|
|
857
|
+
export function path<
|
|
858
|
+
S,
|
|
859
|
+
K0 extends keyof S,
|
|
860
|
+
K1 extends keyof S[K0],
|
|
861
|
+
K2 extends keyof S[K0][K1],
|
|
862
|
+
K3 extends keyof S[K0][K1][K2],
|
|
863
|
+
K4 extends keyof S[K0][K1][K2][K3],
|
|
864
|
+
K5 extends keyof S[K0][K1][K2][K3][K4],
|
|
865
|
+
K6 extends keyof S[K0][K1][K2][K3][K4][K5],
|
|
866
|
+
K7 extends keyof S[K0][K1][K2][K3][K4][K5][K6],
|
|
867
|
+
K8 extends keyof S[K0][K1][K2][K3][K4][K5][K6][K7]
|
|
868
|
+
>(path: `${K0}.${K1}.${K2}.${K3}.${K4}.${K5}.${K6}.${K7}.${K8}`): (obj: S) => S[K0][K1][K2][K3][K4][K5][K6][K7][K8];
|
|
1289
869
|
|
|
1290
870
|
/**
|
|
1291
|
-
* It returns
|
|
871
|
+
* It returns a partial copy of an `input` containing only `propsToPick` properties.
|
|
1292
872
|
*
|
|
1293
|
-
* `
|
|
1294
|
-
*/
|
|
1295
|
-
export function pathEq(pathToSearch: Path, target: any, input: any): boolean;
|
|
1296
|
-
export function pathEq(pathToSearch: Path, target: any): (input: any) => boolean;
|
|
1297
|
-
export function pathEq(pathToSearch: Path): (target: any) => (input: any) => boolean;
|
|
1298
|
-
|
|
1299
|
-
/**
|
|
1300
|
-
* It reads `obj` input and returns either `R.path(pathToSearch, Record<string, unknown>)` result or `defaultValue` input.
|
|
1301
|
-
*/
|
|
1302
|
-
export function pathOr<T>(defaultValue: T, pathToSearch: Path, obj: any): T;
|
|
1303
|
-
export function pathOr<T>(defaultValue: T, pathToSearch: Path): (obj: any) => T;
|
|
1304
|
-
export function pathOr<T>(defaultValue: T): (pathToSearch: Path) => (obj: any) => T;
|
|
1305
|
-
|
|
1306
|
-
export function pathSatisfies<T, U>(pred: (val: T) => boolean, path: Path): (obj: U) => boolean;
|
|
1307
|
-
export function pathSatisfies<T, U>(pred: (val: T) => boolean, path: Path, obj: U): boolean;
|
|
1308
|
-
|
|
1309
|
-
/**
|
|
1310
|
-
* It loops over members of `pathsToSearch` as `singlePath` and returns the array produced by `R.path(singlePath, Record<string, unknown>)`.
|
|
873
|
+
* `input` can be either an object or an array.
|
|
1311
874
|
*
|
|
1312
|
-
*
|
|
875
|
+
* String annotation of `propsToPick` is one of the differences between `Rambda` and `Ramda`.
|
|
1313
876
|
*/
|
|
1314
|
-
export function
|
|
1315
|
-
export function
|
|
1316
|
-
|
|
1317
|
-
|
|
877
|
+
export function pick<K extends PropertyKey>(propsToPick: K[]): <T>(input: T) => MergeTypes<Pick<T, Exclude<keyof T, Exclude<keyof T, K>>>>;
|
|
878
|
+
export function pick<
|
|
879
|
+
S extends string,
|
|
880
|
+
K extends PickStringToPickPath<K>
|
|
881
|
+
>(propsToPick: S): <T>(input: T) => MergeTypes<Pick<T, Exclude<keyof T, Exclude<keyof T, K>>>>;
|
|
1318
882
|
|
|
1319
883
|
/**
|
|
1320
|
-
* It
|
|
884
|
+
* It performs left-to-right function composition, where first argument is the input for the chain of functions.
|
|
1321
885
|
*
|
|
1322
|
-
* `
|
|
886
|
+
* This is huge difference from `Ramda.pipe` where input is passed like `R.pipe(...fns)(input)`.
|
|
887
|
+
* Here we have `R.pipe(input, ...fns)`.
|
|
1323
888
|
*
|
|
1324
|
-
*
|
|
1325
|
-
*/
|
|
1326
|
-
export function
|
|
1327
|
-
export function
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
export function
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
889
|
+
* It has much better TypeScript support than `Ramda.pipe` and this is the reason why `Rambda` goes in this direction.
|
|
890
|
+
*/
|
|
891
|
+
export function pipe<A, B>(value: A, op1: (input: A) => B): B;
|
|
892
|
+
export function pipe<A, B, C>(
|
|
893
|
+
value: A,
|
|
894
|
+
op1: (input: A) => B,
|
|
895
|
+
op2: (input: B) => C,
|
|
896
|
+
): C;
|
|
897
|
+
export function pipe<A, B, C, D>(
|
|
898
|
+
value: A,
|
|
899
|
+
op1: (input: A) => B,
|
|
900
|
+
op2: (input: B) => C,
|
|
901
|
+
op3: (input: C) => D,
|
|
902
|
+
): D;
|
|
903
|
+
export function pipe<A, B, C, D, E>(
|
|
904
|
+
value: A,
|
|
905
|
+
op1: (input: A) => B,
|
|
906
|
+
op2: (input: B) => C,
|
|
907
|
+
op3: (input: C) => D,
|
|
908
|
+
op4: (input: D) => E,
|
|
909
|
+
): E;
|
|
910
|
+
export function pipe<A, B, C, D, E, F>(
|
|
911
|
+
value: A,
|
|
912
|
+
op1: (input: A) => B,
|
|
913
|
+
op2: (input: B) => C,
|
|
914
|
+
op3: (input: C) => D,
|
|
915
|
+
op4: (input: D) => E,
|
|
916
|
+
op5: (input: E) => F,
|
|
917
|
+
): F;
|
|
918
|
+
export function pipe<A, B, C, D, E, F, G>(
|
|
919
|
+
value: A,
|
|
920
|
+
op1: (input: A) => B,
|
|
921
|
+
op2: (input: B) => C,
|
|
922
|
+
op3: (input: C) => D,
|
|
923
|
+
op4: (input: D) => E,
|
|
924
|
+
op5: (input: E) => F,
|
|
925
|
+
op6: (input: F) => G,
|
|
926
|
+
): G;
|
|
927
|
+
export function pipe<A, B, C, D, E, F, G, H>(
|
|
928
|
+
value: A,
|
|
929
|
+
op1: (input: A) => B,
|
|
930
|
+
op2: (input: B) => C,
|
|
931
|
+
op3: (input: C) => D,
|
|
932
|
+
op4: (input: D) => E,
|
|
933
|
+
op5: (input: E) => F,
|
|
934
|
+
op6: (input: F) => G,
|
|
935
|
+
op7: (input: G) => H,
|
|
936
|
+
): H;
|
|
937
|
+
export function pipe<A, B, C, D, E, F, G, H, I>(
|
|
938
|
+
value: A,
|
|
939
|
+
op1: (input: A) => B,
|
|
940
|
+
op2: (input: B) => C,
|
|
941
|
+
op3: (input: C) => D,
|
|
942
|
+
op4: (input: D) => E,
|
|
943
|
+
op5: (input: E) => F,
|
|
944
|
+
op6: (input: F) => G,
|
|
945
|
+
op7: (input: G) => H,
|
|
946
|
+
op8: (input: H) => I,
|
|
947
|
+
): I;
|
|
948
|
+
export function pipe<A, B, C, D, E, F, G, H, I, J>(
|
|
949
|
+
value: A,
|
|
950
|
+
op1: (input: A) => B,
|
|
951
|
+
op2: (input: B) => C,
|
|
952
|
+
op3: (input: C) => D,
|
|
953
|
+
op4: (input: D) => E,
|
|
954
|
+
op5: (input: E) => F,
|
|
955
|
+
op6: (input: F) => G,
|
|
956
|
+
op7: (input: G) => H,
|
|
957
|
+
op8: (input: H) => I,
|
|
958
|
+
op9: (input: I) => J,
|
|
959
|
+
): J;
|
|
960
|
+
export function pipe<A, B, C, D, E, F, G, H, I, J, K>(
|
|
961
|
+
value: A,
|
|
962
|
+
op01: (input: A) => B,
|
|
963
|
+
op02: (input: B) => C,
|
|
964
|
+
op03: (input: C) => D,
|
|
965
|
+
op04: (input: D) => E,
|
|
966
|
+
op05: (input: E) => F,
|
|
967
|
+
op06: (input: F) => G,
|
|
968
|
+
op07: (input: G) => H,
|
|
969
|
+
op08: (input: H) => I,
|
|
970
|
+
op09: (input: I) => J,
|
|
971
|
+
op10: (input: J) => K,
|
|
972
|
+
): K;
|
|
973
|
+
export function pipe<A, B, C, D, E, F, G, H, I, J, K, L>(
|
|
974
|
+
value: A,
|
|
975
|
+
op01: (input: A) => B,
|
|
976
|
+
op02: (input: B) => C,
|
|
977
|
+
op03: (input: C) => D,
|
|
978
|
+
op04: (input: D) => E,
|
|
979
|
+
op05: (input: E) => F,
|
|
980
|
+
op06: (input: F) => G,
|
|
981
|
+
op07: (input: G) => H,
|
|
982
|
+
op08: (input: H) => I,
|
|
983
|
+
op09: (input: I) => J,
|
|
984
|
+
op10: (input: J) => K,
|
|
985
|
+
op11: (input: K) => L,
|
|
986
|
+
): L;
|
|
987
|
+
export function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M>(
|
|
988
|
+
value: A,
|
|
989
|
+
op01: (input: A) => B,
|
|
990
|
+
op02: (input: B) => C,
|
|
991
|
+
op03: (input: C) => D,
|
|
992
|
+
op04: (input: D) => E,
|
|
993
|
+
op05: (input: E) => F,
|
|
994
|
+
op06: (input: F) => G,
|
|
995
|
+
op07: (input: G) => H,
|
|
996
|
+
op08: (input: H) => I,
|
|
997
|
+
op09: (input: I) => J,
|
|
998
|
+
op10: (input: J) => K,
|
|
999
|
+
op11: (input: K) => L,
|
|
1000
|
+
op12: (input: L) => M,
|
|
1001
|
+
): M;
|
|
1002
|
+
export function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N>(
|
|
1003
|
+
value: A,
|
|
1004
|
+
op01: (input: A) => B,
|
|
1005
|
+
op02: (input: B) => C,
|
|
1006
|
+
op03: (input: C) => D,
|
|
1007
|
+
op04: (input: D) => E,
|
|
1008
|
+
op05: (input: E) => F,
|
|
1009
|
+
op06: (input: F) => G,
|
|
1010
|
+
op07: (input: G) => H,
|
|
1011
|
+
op08: (input: H) => I,
|
|
1012
|
+
op09: (input: I) => J,
|
|
1013
|
+
op10: (input: J) => K,
|
|
1014
|
+
op11: (input: K) => L,
|
|
1015
|
+
op12: (input: L) => M,
|
|
1016
|
+
op13: (input: M) => N,
|
|
1017
|
+
): N;
|
|
1018
|
+
export function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(
|
|
1019
|
+
value: A,
|
|
1020
|
+
op01: (input: A) => B,
|
|
1021
|
+
op02: (input: B) => C,
|
|
1022
|
+
op03: (input: C) => D,
|
|
1023
|
+
op04: (input: D) => E,
|
|
1024
|
+
op05: (input: E) => F,
|
|
1025
|
+
op06: (input: F) => G,
|
|
1026
|
+
op07: (input: G) => H,
|
|
1027
|
+
op08: (input: H) => I,
|
|
1028
|
+
op09: (input: I) => J,
|
|
1029
|
+
op10: (input: J) => K,
|
|
1030
|
+
op11: (input: K) => L,
|
|
1031
|
+
op12: (input: L) => M,
|
|
1032
|
+
op13: (input: M) => N,
|
|
1033
|
+
op14: (input: N) => O,
|
|
1034
|
+
): O;
|
|
1035
|
+
export function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P>(
|
|
1036
|
+
value: A,
|
|
1037
|
+
op01: (input: A) => B,
|
|
1038
|
+
op02: (input: B) => C,
|
|
1039
|
+
op03: (input: C) => D,
|
|
1040
|
+
op04: (input: D) => E,
|
|
1041
|
+
op05: (input: E) => F,
|
|
1042
|
+
op06: (input: F) => G,
|
|
1043
|
+
op07: (input: G) => H,
|
|
1044
|
+
op08: (input: H) => I,
|
|
1045
|
+
op09: (input: I) => J,
|
|
1046
|
+
op10: (input: J) => K,
|
|
1047
|
+
op11: (input: K) => L,
|
|
1048
|
+
op12: (input: L) => M,
|
|
1049
|
+
op13: (input: M) => N,
|
|
1050
|
+
op14: (input: N) => O,
|
|
1051
|
+
op15: (input: O) => P,
|
|
1052
|
+
): P;
|
|
1053
|
+
export function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q>(
|
|
1054
|
+
value: A,
|
|
1055
|
+
op01: (input: A) => B,
|
|
1056
|
+
op02: (input: B) => C,
|
|
1057
|
+
op03: (input: C) => D,
|
|
1058
|
+
op04: (input: D) => E,
|
|
1059
|
+
op05: (input: E) => F,
|
|
1060
|
+
op06: (input: F) => G,
|
|
1061
|
+
op07: (input: G) => H,
|
|
1062
|
+
op08: (input: H) => I,
|
|
1063
|
+
op09: (input: I) => J,
|
|
1064
|
+
op10: (input: J) => K,
|
|
1065
|
+
op11: (input: K) => L,
|
|
1066
|
+
op12: (input: L) => M,
|
|
1067
|
+
op13: (input: M) => N,
|
|
1068
|
+
op14: (input: N) => O,
|
|
1069
|
+
op15: (input: O) => P,
|
|
1070
|
+
op16: (input: P) => Q,
|
|
1071
|
+
): Q;
|
|
1072
|
+
export function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R>(
|
|
1073
|
+
value: A,
|
|
1074
|
+
op01: (input: A) => B,
|
|
1075
|
+
op02: (input: B) => C,
|
|
1076
|
+
op03: (input: C) => D,
|
|
1077
|
+
op04: (input: D) => E,
|
|
1078
|
+
op05: (input: E) => F,
|
|
1079
|
+
op06: (input: F) => G,
|
|
1080
|
+
op07: (input: G) => H,
|
|
1081
|
+
op08: (input: H) => I,
|
|
1082
|
+
op09: (input: I) => J,
|
|
1083
|
+
op10: (input: J) => K,
|
|
1084
|
+
op11: (input: K) => L,
|
|
1085
|
+
op12: (input: L) => M,
|
|
1086
|
+
op13: (input: M) => N,
|
|
1087
|
+
op14: (input: N) => O,
|
|
1088
|
+
op15: (input: O) => P,
|
|
1089
|
+
op16: (input: P) => Q,
|
|
1090
|
+
op17: (input: Q) => R,
|
|
1091
|
+
): R;
|
|
1092
|
+
export function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S>(
|
|
1093
|
+
value: A,
|
|
1094
|
+
op01: (input: A) => B,
|
|
1095
|
+
op02: (input: B) => C,
|
|
1096
|
+
op03: (input: C) => D,
|
|
1097
|
+
op04: (input: D) => E,
|
|
1098
|
+
op05: (input: E) => F,
|
|
1099
|
+
op06: (input: F) => G,
|
|
1100
|
+
op07: (input: G) => H,
|
|
1101
|
+
op08: (input: H) => I,
|
|
1102
|
+
op09: (input: I) => J,
|
|
1103
|
+
op10: (input: J) => K,
|
|
1104
|
+
op11: (input: K) => L,
|
|
1105
|
+
op12: (input: L) => M,
|
|
1106
|
+
op13: (input: M) => N,
|
|
1107
|
+
op14: (input: N) => O,
|
|
1108
|
+
op15: (input: O) => P,
|
|
1109
|
+
op16: (input: P) => Q,
|
|
1110
|
+
op17: (input: Q) => R,
|
|
1111
|
+
op18: (input: R) => S,
|
|
1112
|
+
): S;
|
|
1113
|
+
export function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T>(
|
|
1114
|
+
value: A,
|
|
1115
|
+
op01: (input: A) => B,
|
|
1116
|
+
op02: (input: B) => C,
|
|
1117
|
+
op03: (input: C) => D,
|
|
1118
|
+
op04: (input: D) => E,
|
|
1119
|
+
op05: (input: E) => F,
|
|
1120
|
+
op06: (input: F) => G,
|
|
1121
|
+
op07: (input: G) => H,
|
|
1122
|
+
op08: (input: H) => I,
|
|
1123
|
+
op09: (input: I) => J,
|
|
1124
|
+
op10: (input: J) => K,
|
|
1125
|
+
op11: (input: K) => L,
|
|
1126
|
+
op12: (input: L) => M,
|
|
1127
|
+
op13: (input: M) => N,
|
|
1128
|
+
op14: (input: N) => O,
|
|
1129
|
+
op15: (input: O) => P,
|
|
1130
|
+
op16: (input: P) => Q,
|
|
1131
|
+
op17: (input: Q) => R,
|
|
1132
|
+
op18: (input: R) => S,
|
|
1133
|
+
op19: (input: S) => T,
|
|
1134
|
+
): T;
|
|
1135
|
+
export function pipe<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U>(
|
|
1136
|
+
value: A,
|
|
1137
|
+
op01: (input: A) => B,
|
|
1138
|
+
op02: (input: B) => C,
|
|
1139
|
+
op03: (input: C) => D,
|
|
1140
|
+
op04: (input: D) => E,
|
|
1141
|
+
op05: (input: E) => F,
|
|
1142
|
+
op06: (input: F) => G,
|
|
1143
|
+
op07: (input: G) => H,
|
|
1144
|
+
op08: (input: H) => I,
|
|
1145
|
+
op09: (input: I) => J,
|
|
1146
|
+
op10: (input: J) => K,
|
|
1147
|
+
op11: (input: K) => L,
|
|
1148
|
+
op12: (input: L) => M,
|
|
1149
|
+
op13: (input: M) => N,
|
|
1150
|
+
op14: (input: N) => O,
|
|
1151
|
+
op15: (input: O) => P,
|
|
1152
|
+
op16: (input: P) => Q,
|
|
1153
|
+
op17: (input: Q) => R,
|
|
1154
|
+
op18: (input: R) => S,
|
|
1155
|
+
op19: (input: S) => T,
|
|
1156
|
+
op20: (input: T) => U,
|
|
1157
|
+
): U;
|
|
1158
|
+
|
|
1159
|
+
/**
|
|
1160
|
+
* It accepts input as first argument and series of functions as next arguments. It is same as `R.pipe` but with support for asynchronous functions.
|
|
1161
|
+
*/
|
|
1162
|
+
export function pipeAsync<A, B>(input: A, fn0: (x: Awaited<A>) => B) : B;
|
|
1163
|
+
export function pipeAsync<A, B, C>(input: A, fn0: (x: Awaited<A>) => B, fn1: (x: Awaited<B>) => C) : C;
|
|
1164
|
+
export function pipeAsync<A, B, C, D>(input: A, fn0: (x: Awaited<A>) => B, fn1: (x: Awaited<B>) => C, fn2: (x: Awaited<C>) => D) : D;
|
|
1165
|
+
export function pipeAsync<A, B, C, D, E>(input: A, fn0: (x: Awaited<A>) => B, fn1: (x: Awaited<B>) => C, fn2: (x: Awaited<C>) => D, fn3: (x: Awaited<D>) => E) : E;
|
|
1166
|
+
export function pipeAsync<A, B, C, D, E, F>(input: A, fn0: (x: Awaited<A>) => B, fn1: (x: Awaited<B>) => C, fn2: (x: Awaited<C>) => D, fn3: (x: Awaited<D>) => E, fn4: (x: Awaited<E>) => F) : F;
|
|
1167
|
+
export function pipeAsync<A, B, C, D, E, F, G>(input: A, fn0: (x: Awaited<A>) => B, fn1: (x: Awaited<B>) => C, fn2: (x: Awaited<C>) => D, fn3: (x: Awaited<D>) => E, fn4: (x: Awaited<E>) => F, fn5: (x: Awaited<F>) => G) : G;
|
|
1168
|
+
export function pipeAsync<A, B, C, D, E, F, G, H>(input: A, fn0: (x: Awaited<A>) => B, fn1: (x: Awaited<B>) => C, fn2: (x: Awaited<C>) => D, fn3: (x: Awaited<D>) => E, fn4: (x: Awaited<E>) => F, fn5: (x: Awaited<F>) => G, fn6: (x: Awaited<G>) => H) : H;
|
|
1169
|
+
export function pipeAsync<A, B, C, D, E, F, G, H, I>(input: A, fn0: (x: Awaited<A>) => B, fn1: (x: Awaited<B>) => C, fn2: (x: Awaited<C>) => D, fn3: (x: Awaited<D>) => E, fn4: (x: Awaited<E>) => F, fn5: (x: Awaited<F>) => G, fn6: (x: Awaited<G>) => H, fn7: (x: Awaited<H>) => I) : I;
|
|
1170
|
+
export function pipeAsync<A, B, C, D, E, F, G, H, I, J>(
|
|
1171
|
+
input: A,
|
|
1172
|
+
fn0: (x: Awaited<A>) => B,
|
|
1173
|
+
fn1: (x: Awaited<B>) => C,
|
|
1174
|
+
fn2: (x: Awaited<C>) => D,
|
|
1175
|
+
fn3: (x: Awaited<D>) => E,
|
|
1176
|
+
fn4: (x: Awaited<E>) => F,
|
|
1177
|
+
fn5: (x: Awaited<F>) => G,
|
|
1178
|
+
fn6: (x: Awaited<G>) => H,
|
|
1179
|
+
fn7: (x: Awaited<H>) => I,
|
|
1180
|
+
fn8: (x: Awaited<I>) => J,
|
|
1181
|
+
) : J;
|
|
1182
|
+
export function pipeAsync<A, B, C, D, E, F, G, H, I, J, K>(
|
|
1183
|
+
input: A,
|
|
1184
|
+
fn0: (x: Awaited<A>) => B,
|
|
1185
|
+
fn1: (x: Awaited<B>) => C,
|
|
1186
|
+
fn2: (x: Awaited<C>) => D,
|
|
1187
|
+
fn3: (x: Awaited<D>) => E,
|
|
1188
|
+
fn4: (x: Awaited<E>) => F,
|
|
1189
|
+
fn5: (x: Awaited<F>) => G,
|
|
1190
|
+
fn6: (x: Awaited<G>) => H,
|
|
1191
|
+
fn7: (x: Awaited<H>) => I,
|
|
1192
|
+
fn8: (x: Awaited<I>) => J,
|
|
1193
|
+
fn9: (x: Awaited<J>) => K,
|
|
1194
|
+
): K;
|
|
1195
|
+
|
|
1196
|
+
export function pipeAsync<A, B, C, D, E, F, G, H, I, J, K, L>(
|
|
1197
|
+
input: A,
|
|
1198
|
+
fn0: (x: Awaited<A>) => B,
|
|
1199
|
+
fn1: (x: Awaited<B>) => C,
|
|
1200
|
+
fn2: (x: Awaited<C>) => D,
|
|
1201
|
+
fn3: (x: Awaited<D>) => E,
|
|
1202
|
+
fn4: (x: Awaited<E>) => F,
|
|
1203
|
+
fn5: (x: Awaited<F>) => G,
|
|
1204
|
+
fn6: (x: Awaited<G>) => H,
|
|
1205
|
+
fn7: (x: Awaited<H>) => I,
|
|
1206
|
+
fn8: (x: Awaited<I>) => J,
|
|
1207
|
+
fn9: (x: Awaited<J>) => K,
|
|
1208
|
+
fn10: (x: Awaited<K>) => L,
|
|
1209
|
+
): L;
|
|
1210
|
+
|
|
1211
|
+
export function pipeAsync<A, B, C, D, E, F, G, H, I, J, K, L, M>(
|
|
1212
|
+
input: A,
|
|
1213
|
+
fn0: (x: Awaited<A>) => B,
|
|
1214
|
+
fn1: (x: Awaited<B>) => C,
|
|
1215
|
+
fn2: (x: Awaited<C>) => D,
|
|
1216
|
+
fn3: (x: Awaited<D>) => E,
|
|
1217
|
+
fn4: (x: Awaited<E>) => F,
|
|
1218
|
+
fn5: (x: Awaited<F>) => G,
|
|
1219
|
+
fn6: (x: Awaited<G>) => H,
|
|
1220
|
+
fn7: (x: Awaited<H>) => I,
|
|
1221
|
+
fn8: (x: Awaited<I>) => J,
|
|
1222
|
+
fn9: (x: Awaited<J>) => K,
|
|
1223
|
+
fn10: (x: Awaited<K>) => L,
|
|
1224
|
+
fn11: (x: Awaited<L>) => M,
|
|
1225
|
+
): M;
|
|
1226
|
+
|
|
1227
|
+
export function pipeAsync<A, B, C, D, E, F, G, H, I, J, K, L, M, N>(
|
|
1228
|
+
input: A,
|
|
1229
|
+
fn0: (x: Awaited<A>) => B,
|
|
1230
|
+
fn1: (x: Awaited<B>) => C,
|
|
1231
|
+
fn2: (x: Awaited<C>) => D,
|
|
1232
|
+
fn3: (x: Awaited<D>) => E,
|
|
1233
|
+
fn4: (x: Awaited<E>) => F,
|
|
1234
|
+
fn5: (x: Awaited<F>) => G,
|
|
1235
|
+
fn6: (x: Awaited<G>) => H,
|
|
1236
|
+
fn7: (x: Awaited<H>) => I,
|
|
1237
|
+
fn8: (x: Awaited<I>) => J,
|
|
1238
|
+
fn9: (x: Awaited<J>) => K,
|
|
1239
|
+
fn10: (x: Awaited<K>) => L,
|
|
1240
|
+
fn11: (x: Awaited<L>) => M,
|
|
1241
|
+
fn12: (x: Awaited<M>) => N,
|
|
1242
|
+
): N;
|
|
1243
|
+
|
|
1244
|
+
export function pipeAsync<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(
|
|
1245
|
+
input: A,
|
|
1246
|
+
fn0: (x: Awaited<A>) => B,
|
|
1247
|
+
fn1: (x: Awaited<B>) => C,
|
|
1248
|
+
fn2: (x: Awaited<C>) => D,
|
|
1249
|
+
fn3: (x: Awaited<D>) => E,
|
|
1250
|
+
fn4: (x: Awaited<E>) => F,
|
|
1251
|
+
fn5: (x: Awaited<F>) => G,
|
|
1252
|
+
fn6: (x: Awaited<G>) => H,
|
|
1253
|
+
fn7: (x: Awaited<H>) => I,
|
|
1254
|
+
fn8: (x: Awaited<I>) => J,
|
|
1255
|
+
fn9: (x: Awaited<J>) => K,
|
|
1256
|
+
fn10: (x: Awaited<K>) => L,
|
|
1257
|
+
fn11: (x: Awaited<L>) => M,
|
|
1258
|
+
fn12: (x: Awaited<M>) => N,
|
|
1259
|
+
fn13: (x: Awaited<N>) => O,
|
|
1260
|
+
): O;
|
|
1261
|
+
|
|
1262
|
+
export function pipeAsync<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P>(
|
|
1263
|
+
input: A,
|
|
1264
|
+
fn0: (x: Awaited<A>) => B,
|
|
1265
|
+
fn1: (x: Awaited<B>) => C,
|
|
1266
|
+
fn2: (x: Awaited<C>) => D,
|
|
1267
|
+
fn3: (x: Awaited<D>) => E,
|
|
1268
|
+
fn4: (x: Awaited<E>) => F,
|
|
1269
|
+
fn5: (x: Awaited<F>) => G,
|
|
1270
|
+
fn6: (x: Awaited<G>) => H,
|
|
1271
|
+
fn7: (x: Awaited<H>) => I,
|
|
1272
|
+
fn8: (x: Awaited<I>) => J,
|
|
1273
|
+
fn9: (x: Awaited<J>) => K,
|
|
1274
|
+
fn10: (x: Awaited<K>) => L,
|
|
1275
|
+
fn11: (x: Awaited<L>) => M,
|
|
1276
|
+
fn12: (x: Awaited<M>) => N,
|
|
1277
|
+
fn13: (x: Awaited<N>) => O,
|
|
1278
|
+
fn14: (x: Awaited<O>) => P,
|
|
1279
|
+
): P;
|
|
1280
|
+
|
|
1281
|
+
export function pipeAsync<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q>(
|
|
1282
|
+
input: A,
|
|
1283
|
+
fn0: (x: Awaited<A>) => B,
|
|
1284
|
+
fn1: (x: Awaited<B>) => C,
|
|
1285
|
+
fn2: (x: Awaited<C>) => D,
|
|
1286
|
+
fn3: (x: Awaited<D>) => E,
|
|
1287
|
+
fn4: (x: Awaited<E>) => F,
|
|
1288
|
+
fn5: (x: Awaited<F>) => G,
|
|
1289
|
+
fn6: (x: Awaited<G>) => H,
|
|
1290
|
+
fn7: (x: Awaited<H>) => I,
|
|
1291
|
+
fn8: (x: Awaited<I>) => J,
|
|
1292
|
+
fn9: (x: Awaited<J>) => K,
|
|
1293
|
+
fn10: (x: Awaited<K>) => L,
|
|
1294
|
+
fn11: (x: Awaited<L>) => M,
|
|
1295
|
+
fn12: (x: Awaited<M>) => N,
|
|
1296
|
+
fn13: (x: Awaited<N>) => O,
|
|
1297
|
+
fn14: (x: Awaited<O>) => P,
|
|
1298
|
+
fn15: (x: Awaited<P>) => Q,
|
|
1299
|
+
): Q;
|
|
1300
|
+
|
|
1301
|
+
export function pipeAsync<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R>(
|
|
1302
|
+
input: A,
|
|
1303
|
+
fn0: (x: Awaited<A>) => B,
|
|
1304
|
+
fn1: (x: Awaited<B>) => C,
|
|
1305
|
+
fn2: (x: Awaited<C>) => D,
|
|
1306
|
+
fn3: (x: Awaited<D>) => E,
|
|
1307
|
+
fn4: (x: Awaited<E>) => F,
|
|
1308
|
+
fn5: (x: Awaited<F>) => G,
|
|
1309
|
+
fn6: (x: Awaited<G>) => H,
|
|
1310
|
+
fn7: (x: Awaited<H>) => I,
|
|
1311
|
+
fn8: (x: Awaited<I>) => J,
|
|
1312
|
+
fn9: (x: Awaited<J>) => K,
|
|
1313
|
+
fn10: (x: Awaited<K>) => L,
|
|
1314
|
+
fn11: (x: Awaited<L>) => M,
|
|
1315
|
+
fn12: (x: Awaited<M>) => N,
|
|
1316
|
+
fn13: (x: Awaited<N>) => O,
|
|
1317
|
+
fn14: (x: Awaited<O>) => P,
|
|
1318
|
+
fn15: (x: Awaited<P>) => Q,
|
|
1319
|
+
fn16: (x: Awaited<Q>) => R,
|
|
1320
|
+
): R;
|
|
1321
|
+
|
|
1322
|
+
export function pipeAsync<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S>(
|
|
1323
|
+
input: A,
|
|
1324
|
+
fn0: (x: Awaited<A>) => B,
|
|
1325
|
+
fn1: (x: Awaited<B>) => C,
|
|
1326
|
+
fn2: (x: Awaited<C>) => D,
|
|
1327
|
+
fn3: (x: Awaited<D>) => E,
|
|
1328
|
+
fn4: (x: Awaited<E>) => F,
|
|
1329
|
+
fn5: (x: Awaited<F>) => G,
|
|
1330
|
+
fn6: (x: Awaited<G>) => H,
|
|
1331
|
+
fn7: (x: Awaited<H>) => I,
|
|
1332
|
+
fn8: (x: Awaited<I>) => J,
|
|
1333
|
+
fn9: (x: Awaited<J>) => K,
|
|
1334
|
+
fn10: (x: Awaited<K>) => L,
|
|
1335
|
+
fn11: (x: Awaited<L>) => M,
|
|
1336
|
+
fn12: (x: Awaited<M>) => N,
|
|
1337
|
+
fn13: (x: Awaited<N>) => O,
|
|
1338
|
+
fn14: (x: Awaited<O>) => P,
|
|
1339
|
+
fn15: (x: Awaited<P>) => Q,
|
|
1340
|
+
fn16: (x: Awaited<Q>) => R,
|
|
1341
|
+
fn17: (x: Awaited<R>) => S,
|
|
1342
|
+
): S;
|
|
1343
|
+
|
|
1344
|
+
export function pipeAsync<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T>(
|
|
1345
|
+
input: A,
|
|
1346
|
+
fn0: (x: Awaited<A>) => B,
|
|
1347
|
+
fn1: (x: Awaited<B>) => C,
|
|
1348
|
+
fn2: (x: Awaited<C>) => D,
|
|
1349
|
+
fn3: (x: Awaited<D>) => E,
|
|
1350
|
+
fn4: (x: Awaited<E>) => F,
|
|
1351
|
+
fn5: (x: Awaited<F>) => G,
|
|
1352
|
+
fn6: (x: Awaited<G>) => H,
|
|
1353
|
+
fn7: (x: Awaited<H>) => I,
|
|
1354
|
+
fn8: (x: Awaited<I>) => J,
|
|
1355
|
+
fn9: (x: Awaited<J>) => K,
|
|
1356
|
+
fn10: (x: Awaited<K>) => L,
|
|
1357
|
+
fn11: (x: Awaited<L>) => M,
|
|
1358
|
+
fn12: (x: Awaited<M>) => N,
|
|
1359
|
+
fn13: (x: Awaited<N>) => O,
|
|
1360
|
+
fn14: (x: Awaited<O>) => P,
|
|
1361
|
+
fn15: (x: Awaited<P>) => Q,
|
|
1362
|
+
fn16: (x: Awaited<Q>) => R,
|
|
1363
|
+
fn17: (x: Awaited<R>) => S,
|
|
1364
|
+
fn18: (x: Awaited<S>) => T,
|
|
1365
|
+
): T;
|
|
1366
|
+
|
|
1367
|
+
export function pipeAsync<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U>(
|
|
1368
|
+
input: A,
|
|
1369
|
+
fn0: (x: Awaited<A>) => B,
|
|
1370
|
+
fn1: (x: Awaited<B>) => C,
|
|
1371
|
+
fn2: (x: Awaited<C>) => D,
|
|
1372
|
+
fn3: (x: Awaited<D>) => E,
|
|
1373
|
+
fn4: (x: Awaited<E>) => F,
|
|
1374
|
+
fn5: (x: Awaited<F>) => G,
|
|
1375
|
+
fn6: (x: Awaited<G>) => H,
|
|
1376
|
+
fn7: (x: Awaited<H>) => I,
|
|
1377
|
+
fn8: (x: Awaited<I>) => J,
|
|
1378
|
+
fn9: (x: Awaited<J>) => K,
|
|
1379
|
+
fn10: (x: Awaited<K>) => L,
|
|
1380
|
+
fn11: (x: Awaited<L>) => M,
|
|
1381
|
+
fn12: (x: Awaited<M>) => N,
|
|
1382
|
+
fn13: (x: Awaited<N>) => O,
|
|
1383
|
+
fn14: (x: Awaited<O>) => P,
|
|
1384
|
+
fn15: (x: Awaited<P>) => Q,
|
|
1385
|
+
fn16: (x: Awaited<Q>) => R,
|
|
1386
|
+
fn17: (x: Awaited<R>) => S,
|
|
1387
|
+
fn18: (x: Awaited<S>) => T,
|
|
1388
|
+
fn19: (x: Awaited<T>) => U,
|
|
1389
|
+
): U;
|
|
1403
1390
|
|
|
1404
1391
|
/**
|
|
1405
1392
|
* It returns list of the values of `property` taken from the all objects inside `list`.
|
|
1393
|
+
* Basically, this is `R.map(R.prop(property))`.
|
|
1406
1394
|
*/
|
|
1407
|
-
export function pluck<K extends keyof T
|
|
1408
|
-
export function pluck<T>(property: number, list: { [k: number]: T }[]): T[];
|
|
1409
|
-
export function pluck<P extends string>(property: P): <T>(list: Record<P, T>[]) => T[];
|
|
1410
|
-
export function pluck(property: number): <T>(list: { [k: number]: T }[]) => T[];
|
|
1395
|
+
export function pluck<T, K extends keyof T>(property: K): (list: T[]) => T[K][];
|
|
1411
1396
|
|
|
1412
1397
|
/**
|
|
1413
1398
|
* It adds element `x` at the beginning of `list`.
|
|
1414
1399
|
*/
|
|
1415
1400
|
export function prepend<T>(xToPrepend: T, iterable: T[]): T[];
|
|
1416
|
-
export function prepend<T, U>(xToPrepend: T, iterable: IsFirstSubtypeOfSecond<T, U>[]) : U[];
|
|
1417
|
-
export function prepend<T>(xToPrepend: T): <U>(iterable: IsFirstSubtypeOfSecond<T, U>[]) => U[];
|
|
1418
1401
|
export function prepend<T>(xToPrepend: T): (iterable: T[]) => T[];
|
|
1419
1402
|
|
|
1420
|
-
export function product(list: number[]): number;
|
|
1421
|
-
|
|
1422
1403
|
/**
|
|
1423
1404
|
* It returns the value of property `propToFind` in `obj`.
|
|
1424
1405
|
*
|
|
1425
1406
|
* If there is no such property, it returns `undefined`.
|
|
1426
1407
|
*/
|
|
1427
|
-
export function prop<
|
|
1428
|
-
export function prop<
|
|
1429
|
-
export function prop<_, P extends keyof never>(p: P): <T>(value: T) => Prop<T, P>;
|
|
1430
|
-
export function prop<V>(p: keyof never): (value: unknown) => V;
|
|
1408
|
+
export function prop<K extends PropertyKey>(prop: K): <U extends { [P in K]?: unknown }>(obj: U) => U[K];
|
|
1409
|
+
export function prop<K extends keyof U, U>(prop: K, obj: U): U[K];
|
|
1431
1410
|
|
|
1432
1411
|
/**
|
|
1433
1412
|
* It returns true if `obj` has property `propToFind` and its value is equal to `valueToMatch`.
|
|
1434
1413
|
*/
|
|
1435
|
-
export function propEq<
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
<K extends string | number>(propToFind: K, obj: Record<K, any>): boolean;
|
|
1439
|
-
<K extends string | number>(propToFind: K): (obj: Record<K, any>) => boolean;
|
|
1440
|
-
};
|
|
1441
|
-
|
|
1442
|
-
/**
|
|
1443
|
-
* It returns `true` if `property` of `obj` is from `target` type.
|
|
1444
|
-
*/
|
|
1445
|
-
export function propIs<C extends AnyFunction, K extends keyof any>(type: C, name: K, obj: any): obj is Record<K, ReturnType<C>>;
|
|
1446
|
-
export function propIs<C extends AnyConstructor, K extends keyof any>(type: C, name: K, obj: any): obj is Record<K, InstanceType<C>>;
|
|
1447
|
-
export function propIs<C extends AnyFunction, K extends keyof any>(type: C, name: K): (obj: any) => obj is Record<K, ReturnType<C>>;
|
|
1448
|
-
export function propIs<C extends AnyConstructor, K extends keyof any>(type: C, name: K): (obj: any) => obj is Record<K, InstanceType<C>>;
|
|
1449
|
-
export function propIs<C extends AnyFunction>(type: C): {
|
|
1450
|
-
<K extends keyof any>(name: K, obj: any): obj is Record<K, ReturnType<C>>;
|
|
1451
|
-
<K extends keyof any>(name: K): (obj: any) => obj is Record<K, ReturnType<C>>;
|
|
1414
|
+
export function propEq<T>(val: T): {
|
|
1415
|
+
<K extends PropertyKey>(name: K): (obj: Record<K, T>) => boolean;
|
|
1416
|
+
<K extends PropertyKey>(name: K, obj: Record<K, T>): boolean;
|
|
1452
1417
|
};
|
|
1418
|
+
export function propEq<T, K extends PropertyKey>(val: T, name: K): (obj: Record<K, T>) => boolean;
|
|
1419
|
+
export function propEq<K extends keyof U, U>(val: U[K], name: K, obj: U): boolean;
|
|
1453
1420
|
|
|
1454
|
-
|
|
1455
|
-
* It returns either `defaultValue` or the value of `property` in `obj`.
|
|
1456
|
-
*/
|
|
1457
|
-
export function propOr<T, P extends string>(defaultValue: T, property: P, obj: Partial<Record<P, T>> | undefined): T;
|
|
1458
|
-
export function propOr<T, P extends string>(defaultValue: T, property: P): (obj: Partial<Record<P, T>> | undefined) => T;
|
|
1459
|
-
export function propOr<T>(defaultValue: T): {
|
|
1460
|
-
<P extends string>(property: P, obj: Partial<Record<P, T>> | undefined): T;
|
|
1461
|
-
<P extends string>(property: P): (obj: Partial<Record<P, T>> | undefined) => T;
|
|
1462
|
-
}
|
|
1421
|
+
export function propOr<T, P extends string>(defaultValue: T, property: P): (obj: Partial<Record<P, T>>) => T;
|
|
1463
1422
|
|
|
1464
1423
|
/**
|
|
1465
1424
|
* It returns `true` if the object property satisfies a given predicate.
|
|
1466
1425
|
*/
|
|
1467
|
-
export function propSatisfies<T>(predicate:
|
|
1468
|
-
export function propSatisfies<T>(predicate: Predicate<T>, property: string): (obj: Record<string, T>) => boolean;
|
|
1469
|
-
|
|
1470
|
-
/**
|
|
1471
|
-
* It takes list with properties `propsToPick` and returns a list with property values in `obj`.
|
|
1472
|
-
*/
|
|
1473
|
-
export function props<P extends string, T>(propsToPick: P[], obj: Record<P, T>): T[];
|
|
1474
|
-
export function props<P extends string>(propsToPick: P[]): <T>(obj: Record<P, T>) => T[];
|
|
1475
|
-
export function props<P extends string, T>(propsToPick: P[]): (obj: Record<P, T>) => T[];
|
|
1426
|
+
export function propSatisfies<T>(predicate: (x: T) => boolean, property: string): (obj: Record<PropertyKey, T>) => boolean;
|
|
1476
1427
|
|
|
1477
1428
|
/**
|
|
1478
1429
|
* It returns list of numbers between `startInclusive` to `endExclusive` markers.
|
|
1479
1430
|
*/
|
|
1480
|
-
export function range(startInclusive: number, endExclusive: number): number[];
|
|
1481
1431
|
export function range(startInclusive: number): (endExclusive: number) => number[];
|
|
1482
1432
|
|
|
1483
|
-
export function reduce<T, TResult>(reducer: (prev: TResult, current: T, i: number) => TResult, initialValue: TResult, list: T[]): TResult;
|
|
1484
|
-
export function reduce<T, TResult>(reducer: (prev: TResult, current: T) => TResult, initialValue: TResult, list: T[]): TResult;
|
|
1485
|
-
export function reduce<T, TResult>(reducer: (prev: TResult, current: T, i: number) => TResult): (initialValue: TResult, list: T[]) => TResult;
|
|
1486
1433
|
export function reduce<T, TResult>(reducer: (prev: TResult, current: T, i: number) => TResult, initialValue: TResult): (list: T[]) => TResult;
|
|
1487
1434
|
|
|
1488
|
-
export function reduceBy<T, TResult>(
|
|
1489
|
-
valueFn: (acc: TResult, elem: T) => TResult,
|
|
1490
|
-
): (a: TResult, b: (elem: T) => string, c: T[]) => { [index: string]: TResult }
|
|
1491
|
-
export function reduceBy<T, TResult>(
|
|
1492
|
-
valueFn: (acc: TResult, elem: T) => TResult,
|
|
1493
|
-
acc: TResult,
|
|
1494
|
-
): (a: (elem: T) => string, b: T[]) => { [index: string]: TResult }
|
|
1495
|
-
export function reduceBy<T, TResult>(
|
|
1496
|
-
valueFn: (acc: TResult, elem: T) => TResult,
|
|
1497
|
-
acc: TResult,
|
|
1498
|
-
keyFn: (elem: T) => string,
|
|
1499
|
-
): (list: T[]) => { [index: string]: TResult };
|
|
1500
|
-
export function reduceBy<T, TResult>(
|
|
1501
|
-
valueFn: (acc: TResult, elem: T) => TResult,
|
|
1502
|
-
acc: TResult,
|
|
1503
|
-
keyFn: (elem: T) => string,
|
|
1504
|
-
list: T[],
|
|
1505
|
-
): { [index: string]: TResult };
|
|
1506
|
-
|
|
1507
1435
|
/**
|
|
1508
1436
|
* It has the opposite effect of `R.filter`.
|
|
1509
1437
|
*/
|
|
1510
|
-
export function reject<T>(
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1438
|
+
export function reject<T>(
|
|
1439
|
+
predicate: (value: T) => boolean,
|
|
1440
|
+
list: T[],
|
|
1441
|
+
): T[];
|
|
1442
|
+
export function reject<T>(
|
|
1443
|
+
predicate: BooleanConstructor,
|
|
1444
|
+
): (list: readonly T[]) => ("" | null | undefined | false | 0)[];
|
|
1445
|
+
export function reject<T>(
|
|
1446
|
+
predicate: BooleanConstructor,
|
|
1447
|
+
): (list: T[]) => ("" | null | undefined | false | 0)[];
|
|
1448
|
+
export function reject<T>(
|
|
1449
|
+
predicate: (value: T) => boolean,
|
|
1450
|
+
): (list: T[]) => T[];
|
|
1514
1451
|
|
|
1515
1452
|
/**
|
|
1516
|
-
*
|
|
1453
|
+
* Same as `R.filterObject` but it returns the object with properties that do not satisfy the predicate function.
|
|
1517
1454
|
*/
|
|
1518
|
-
export function
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1455
|
+
export function rejectObject<T extends object>(
|
|
1456
|
+
valueMapper: (
|
|
1457
|
+
value: EnumerableStringKeyedValueOf<T>,
|
|
1458
|
+
key: EnumerableStringKeyOf<T>,
|
|
1459
|
+
data: T,
|
|
1460
|
+
) => boolean,
|
|
1461
|
+
): <U extends T>(data: T) => U;
|
|
1523
1462
|
|
|
1524
1463
|
/**
|
|
1525
1464
|
* It replaces `strOrRegex` found in `str` with `replacer`.
|
|
1526
1465
|
*/
|
|
1527
|
-
export function replace(strOrRegex: RegExp | string, replacer:
|
|
1528
|
-
export function replace(strOrRegex: RegExp | string, replacer: RegExpReplacer): (str: string) => string;
|
|
1529
|
-
export function replace(strOrRegex: RegExp | string): (replacer: RegExpReplacer) => (str: string) => string;
|
|
1466
|
+
export function replace(strOrRegex: RegExp | string, replacer: RegExp | string): (str: string) => string;
|
|
1530
1467
|
|
|
1531
1468
|
/**
|
|
1532
|
-
* It
|
|
1469
|
+
* It replaces `index` in array `list` with the result of `replaceFn(list[i])`.
|
|
1533
1470
|
*/
|
|
1534
|
-
export function
|
|
1535
|
-
export function reverse(input: string): string;
|
|
1536
|
-
|
|
1537
|
-
/**
|
|
1538
|
-
* It returns a copied **Object** or **Array** with modified `lens` focus set to `replacer` value.
|
|
1539
|
-
*/
|
|
1540
|
-
export function set<S, A>(lens: Lens<S, A>): {
|
|
1541
|
-
(a: A): (obj: S) => S
|
|
1542
|
-
(a: A, obj: S): S
|
|
1543
|
-
};
|
|
1544
|
-
export function set<S, A>(lens: Lens<S, A>, a: A): (obj: S) => S;
|
|
1545
|
-
export function set<S, A>(lens: Lens<S, A>, a: A, obj: S): S;
|
|
1546
|
-
|
|
1547
|
-
export function slice(from: number, to: number, input: string): string;
|
|
1548
|
-
export function slice<T>(from: number, to: number, input: T[]): T[];
|
|
1549
|
-
export function slice(from: number, to: number): {
|
|
1550
|
-
(input: string): string;
|
|
1551
|
-
<T>(input: T[]): T[];
|
|
1552
|
-
};
|
|
1553
|
-
export function slice(from: number): {
|
|
1554
|
-
(to: number, input: string): string;
|
|
1555
|
-
<T>(to: number, input: T[]): T[];
|
|
1556
|
-
};
|
|
1471
|
+
export function replaceItemAtIndex<T>(index: number, replaceFn: (x: T) => T): (list: T[]) => T[];
|
|
1557
1472
|
|
|
1558
1473
|
/**
|
|
1559
1474
|
* It returns copy of `list` sorted by `sortFn` function, where `sortFn` needs to return only `-1`, `0` or `1`.
|
|
@@ -1564,55 +1479,17 @@ export function sort<T>(sortFn: (a: T, b: T) => number): (list: T[]) => T[];
|
|
|
1564
1479
|
/**
|
|
1565
1480
|
* It returns copy of `list` sorted by `sortFn` function, where `sortFn` function returns a value to compare, i.e. it doesn't need to return only `-1`, `0` or `1`.
|
|
1566
1481
|
*/
|
|
1567
|
-
export function sortBy<T>(sortFn: (a: T) => Ord, list: T[]): T[];
|
|
1568
1482
|
export function sortBy<T>(sortFn: (a: T) => Ord): (list: T[]) => T[];
|
|
1569
1483
|
export function sortBy(sortFn: (a: any) => Ord): <T>(list: T[]) => T[];
|
|
1570
1484
|
|
|
1571
1485
|
export function sortWith<T>(fns: Array<(a: T, b: T) => number>): (list: T[]) => T[];
|
|
1572
|
-
export function sortWith<T>(fns: Array<(a: T, b: T) => number>, list: T[]): T[];
|
|
1573
1486
|
|
|
1574
|
-
/**
|
|
1575
|
-
* Curried version of `String.prototype.split`
|
|
1576
|
-
*/
|
|
1577
1487
|
export function split(separator: string | RegExp): (str: string) => string[];
|
|
1578
|
-
export function split(separator: string | RegExp, str: string): string[];
|
|
1579
|
-
|
|
1580
|
-
/**
|
|
1581
|
-
* It splits string or array at a given index.
|
|
1582
|
-
*/
|
|
1583
|
-
export function splitAt<T>(index: number, input: T[]): [T[], T[]];
|
|
1584
|
-
export function splitAt(index: number, input: string): [string, string];
|
|
1585
|
-
export function splitAt(index: number): {
|
|
1586
|
-
<T>(input: T[]): [T[], T[]];
|
|
1587
|
-
(input: string): [string, string];
|
|
1588
|
-
};
|
|
1589
1488
|
|
|
1590
1489
|
/**
|
|
1591
1490
|
* It splits `input` into slices of `sliceLength`.
|
|
1592
1491
|
*/
|
|
1593
|
-
export function splitEvery<T>(sliceLength: number
|
|
1594
|
-
export function splitEvery(sliceLength: number, input: string): string[];
|
|
1595
|
-
export function splitEvery(sliceLength: number): {
|
|
1596
|
-
(input: string): string[];
|
|
1597
|
-
<T>(input: T[]): (T[])[];
|
|
1598
|
-
};
|
|
1599
|
-
|
|
1600
|
-
/**
|
|
1601
|
-
* It splits `list` to two arrays according to a `predicate` function.
|
|
1602
|
-
*
|
|
1603
|
-
* The first array contains all members of `list` before `predicate` returns `true`.
|
|
1604
|
-
*/
|
|
1605
|
-
export function splitWhen<T, U>(predicate: Predicate<T>, list: U[]): (U[])[];
|
|
1606
|
-
export function splitWhen<T>(predicate: Predicate<T>): <U>(list: U[]) => (U[])[];
|
|
1607
|
-
|
|
1608
|
-
/**
|
|
1609
|
-
* When iterable is a string, then it behaves as `String.prototype.startsWith`.
|
|
1610
|
-
* When iterable is a list, then it uses R.equals to determine if the target list starts in the same way as the given target.
|
|
1611
|
-
*/
|
|
1612
|
-
export function startsWith<T extends string>(question: T, input: string): boolean;
|
|
1613
|
-
export function startsWith<T extends string>(question: T): (input: string) => boolean;
|
|
1614
|
-
export function startsWith<T>(question: T[], input: T[]): boolean;
|
|
1615
|
-
export function startsWith<T>(question: T[]): (input: T[]) => boolean;
|
|
1492
|
+
export function splitEvery<T>(sliceLength: number): (input: T[]) => (T[])[];
|
|
1616
1493
|
|
|
1617
1494
|
/**
|
|
1618
1495
|
* Curried version of `x - y`
|
|
@@ -1622,15 +1499,11 @@ export function subtract(x: number): (y: number) => number;
|
|
|
1622
1499
|
|
|
1623
1500
|
export function sum(list: number[]): number;
|
|
1624
1501
|
|
|
1625
|
-
export function swap(indexA: number, indexB: number): <T>(list: T[]) => T[];
|
|
1626
|
-
export function swap<T>(indexA: number, indexB: number, list: T[]): T[];
|
|
1627
|
-
|
|
1628
1502
|
/**
|
|
1629
1503
|
* It returns a merged list of `x` and `y` with all equal elements removed.
|
|
1630
1504
|
*
|
|
1631
1505
|
* `R.equals` is used to determine equality.
|
|
1632
1506
|
*/
|
|
1633
|
-
export function symmetricDifference<T>(x: T[], y: T[]): T[];
|
|
1634
1507
|
export function symmetricDifference<T>(x: T[]): <T>(y: T[]) => T[];
|
|
1635
1508
|
|
|
1636
1509
|
/**
|
|
@@ -1642,29 +1515,31 @@ export function tail(input: string): string;
|
|
|
1642
1515
|
/**
|
|
1643
1516
|
* It returns the first `howMany` elements of `input`.
|
|
1644
1517
|
*/
|
|
1645
|
-
export function take<T>(howMany: number
|
|
1646
|
-
|
|
1518
|
+
export function take<T>(howMany: number): {
|
|
1519
|
+
(input: string): string;
|
|
1520
|
+
(input: T[]): T[];
|
|
1521
|
+
(input: readonly T[]): T[];
|
|
1522
|
+
};
|
|
1647
1523
|
|
|
1648
1524
|
/**
|
|
1649
1525
|
* It returns the last `howMany` elements of `input`.
|
|
1650
1526
|
*/
|
|
1651
|
-
export function takeLast<T>(howMany: number
|
|
1652
|
-
|
|
1527
|
+
export function takeLast<T>(howMany: number): {
|
|
1528
|
+
(input: string): string;
|
|
1529
|
+
(input: T[]): T[];
|
|
1530
|
+
(input: readonly T[]): T[];
|
|
1531
|
+
};
|
|
1653
1532
|
|
|
1654
|
-
export function takeLastWhile(predicate: (x:
|
|
1655
|
-
export function takeLastWhile(predicate: (x:
|
|
1656
|
-
export function takeLastWhile<T>(predicate: (x: T) => boolean, input: T[]): T[];
|
|
1657
|
-
export function takeLastWhile<T>(predicate: (x: T) => boolean): <T>(input: T[]) => T[];
|
|
1533
|
+
export function takeLastWhile<T>(predicate: (x: T) => boolean): (input: T[]) => T[];
|
|
1534
|
+
export function takeLastWhile<T>(predicate: (x: T, index: number) => boolean): (list: T[]) => T[];
|
|
1658
1535
|
|
|
1659
|
-
export function takeWhile(
|
|
1660
|
-
export function takeWhile(
|
|
1661
|
-
export function takeWhile<T>(fn: Predicate<T>, iterable: T[]): T[];
|
|
1662
|
-
export function takeWhile<T>(fn: Predicate<T>): (iterable: T[]) => T[];
|
|
1536
|
+
export function takeWhile<T>(predicate: (x: T, index: number) => boolean): (list: T[]) => T[];
|
|
1537
|
+
export function takeWhile<T>(predicate: (x: T) => boolean): (input: T[]) => T[];
|
|
1663
1538
|
|
|
1664
1539
|
/**
|
|
1665
1540
|
* It applies function `fn` to input `x` and returns `x`.
|
|
1666
1541
|
*
|
|
1667
|
-
* One use case is debugging in the middle of `R.
|
|
1542
|
+
* One use case is debugging in the middle of `R.pipe` chain.
|
|
1668
1543
|
*/
|
|
1669
1544
|
export function tap<T>(fn: (x: T) => void, input: T): T;
|
|
1670
1545
|
export function tap<T>(fn: (x: T) => void): (input: T) => T;
|
|
@@ -1683,24 +1558,6 @@ export function test(regExpression: RegExp, str: string): boolean;
|
|
|
1683
1558
|
export function times<T>(fn: (i: number) => T, howMany: number): T[];
|
|
1684
1559
|
export function times<T>(fn: (i: number) => T): (howMany: number) => T[];
|
|
1685
1560
|
|
|
1686
|
-
export function toLower<S extends string>(str: S): Lowercase<S>;
|
|
1687
|
-
export function toLower(str: string): string;
|
|
1688
|
-
|
|
1689
|
-
/**
|
|
1690
|
-
* It transforms an object to a list.
|
|
1691
|
-
*/
|
|
1692
|
-
export function toPairs<O extends object, K extends Extract<keyof O, string | number>>(obj: O): Array<{ [key in K]: [`${key}`, O[key]] }[K]>;
|
|
1693
|
-
export function toPairs<S>(obj: Record<string | number, S>): Array<[string, S]>;
|
|
1694
|
-
|
|
1695
|
-
export function toString(x: unknown): string;
|
|
1696
|
-
|
|
1697
|
-
export function toUpper<S extends string>(str: S): Uppercase<S>;
|
|
1698
|
-
export function toUpper(str: string): string;
|
|
1699
|
-
|
|
1700
|
-
export function transpose<T>(list: (T[])[]): (T[])[];
|
|
1701
|
-
|
|
1702
|
-
export function trim(str: string): string;
|
|
1703
|
-
|
|
1704
1561
|
/**
|
|
1705
1562
|
* It returns function that runs `fn` in `try/catch` block. If there was an error, then `fallback` is used to return the result. Note that `fn` can be value or asynchronous/synchronous function(unlike `Ramda` where fallback can only be a synchronous function).
|
|
1706
1563
|
*/
|
|
@@ -1708,37 +1565,17 @@ export function tryCatch<T, U>(
|
|
|
1708
1565
|
fn: (input: T) => U,
|
|
1709
1566
|
fallback: U
|
|
1710
1567
|
): (input: T) => U;
|
|
1711
|
-
export function tryCatch<T, U>(
|
|
1712
|
-
fn: (input: T) => U,
|
|
1713
|
-
fallback: (input: T) => U
|
|
1714
|
-
): (input: T) => U;
|
|
1715
|
-
export function tryCatch<T>(
|
|
1716
|
-
fn: (input: any) => Promise<any>,
|
|
1717
|
-
fallback: T
|
|
1718
|
-
): (input: any) => Promise<T>;
|
|
1719
|
-
export function tryCatch<T>(
|
|
1720
|
-
fn: (input: any) => Promise<any>,
|
|
1721
|
-
fallback: (input: any) => Promise<any>,
|
|
1722
|
-
): (input: any) => Promise<T>;
|
|
1723
1568
|
|
|
1724
1569
|
/**
|
|
1725
1570
|
* It accepts any input and it returns its type.
|
|
1726
1571
|
*/
|
|
1727
1572
|
export function type(x: any): RambdaTypes;
|
|
1728
1573
|
|
|
1729
|
-
/**
|
|
1730
|
-
* It calls a function `fn` with the list of values of the returned function.
|
|
1731
|
-
*
|
|
1732
|
-
* `R.unapply` is the opposite of `R.apply` method.
|
|
1733
|
-
*/
|
|
1734
|
-
export function unapply<T = any>(fn: (args: any[]) => T): (...args: any[]) => T;
|
|
1735
|
-
|
|
1736
1574
|
/**
|
|
1737
1575
|
* It takes two lists and return a new list containing a merger of both list with removed duplicates.
|
|
1738
1576
|
*
|
|
1739
1577
|
* `R.equals` is used to compare for duplication.
|
|
1740
1578
|
*/
|
|
1741
|
-
export function union<T>(x: T[], y: T[]): T[];
|
|
1742
1579
|
export function union<T>(x: T[]): (y: T[]) => T[];
|
|
1743
1580
|
|
|
1744
1581
|
/**
|
|
@@ -1753,7 +1590,6 @@ export function uniq<T>(list: T[]): T[];
|
|
|
1753
1590
|
*
|
|
1754
1591
|
* `R.equals` is used to determine equality.
|
|
1755
1592
|
*/
|
|
1756
|
-
export function uniqBy<T, U>(fn: (a: T) => U, list: T[]): T[];
|
|
1757
1593
|
export function uniqBy<T, U>(fn: (a: T) => U): (list: T[]) => T[];
|
|
1758
1594
|
|
|
1759
1595
|
/**
|
|
@@ -1761,7 +1597,6 @@ export function uniqBy<T, U>(fn: (a: T) => U): (list: T[]) => T[];
|
|
|
1761
1597
|
*
|
|
1762
1598
|
* This predicate should return true, if two elements are equal.
|
|
1763
1599
|
*/
|
|
1764
|
-
export function uniqWith<T, U>(predicate: (x: T, y: T) => boolean, list: T[]): T[];
|
|
1765
1600
|
export function uniqWith<T, U>(predicate: (x: T, y: T) => boolean): (list: T[]) => T[];
|
|
1766
1601
|
|
|
1767
1602
|
/**
|
|
@@ -1771,96 +1606,34 @@ export function uniqWith<T, U>(predicate: (x: T, y: T) => boolean): (list: T[])
|
|
|
1771
1606
|
*
|
|
1772
1607
|
* In the other case, the final output will be the `input` itself.
|
|
1773
1608
|
*/
|
|
1774
|
-
export function unless<T, U>(predicate: (x: T) => boolean, whenFalseFn: (x: T) => U, x: T): T | U;
|
|
1775
1609
|
export function unless<T, U>(predicate: (x: T) => boolean, whenFalseFn: (x: T) => U): (x: T) => T | U;
|
|
1776
|
-
export function unless<T>(predicate: (x: T) => boolean, whenFalseFn: (x: T) => T, x: T): T;
|
|
1777
1610
|
export function unless<T>(predicate: (x: T) => boolean, whenFalseFn: (x: T) => T): (x: T) => T;
|
|
1778
1611
|
|
|
1779
|
-
export function unnest(list: unknown[]): unknown[];
|
|
1780
|
-
export function unnest<T>(list: unknown[]): T;
|
|
1781
|
-
|
|
1782
|
-
export function unwind<T, U>(prop: keyof T, obj: T): U[];
|
|
1783
|
-
export function unwind<T, U>(prop: keyof T): (obj: T) => U[];
|
|
1784
|
-
|
|
1785
|
-
/**
|
|
1786
|
-
* It returns a copy of `list` with updated element at `index` with `newValue`.
|
|
1787
|
-
*/
|
|
1788
|
-
export function update<T>(index: number, newValue: T, list: T[]): T[];
|
|
1789
|
-
export function update<T>(index: number, newValue: T): (list: T[]) => T[];
|
|
1790
|
-
|
|
1791
1612
|
/**
|
|
1792
|
-
*
|
|
1613
|
+
* It takes an object and a property name. The method will return a list of objects, where each object is a shallow copy of the input object, but with the property array unwound.
|
|
1793
1614
|
*/
|
|
1794
|
-
export function
|
|
1615
|
+
export function unwind<S extends string>(prop: S): <T>(obj: T) => Omit<T, S> & { [K in S]: T[S][number] };
|
|
1795
1616
|
|
|
1796
1617
|
/**
|
|
1797
|
-
* It returns
|
|
1618
|
+
* It returns a copy of `list` with updated element at `index` with `newValue`.
|
|
1798
1619
|
*/
|
|
1799
|
-
export function
|
|
1800
|
-
export function view<S, A>(lens: Lens<S, A>, obj: S): A;
|
|
1620
|
+
export function update<T>(index: number, newValue: T): (list: T[]) => T[];
|
|
1801
1621
|
|
|
1802
1622
|
/**
|
|
1803
1623
|
* It pass `input` to `predicate` function and if the result is `true`, it will return the result of `whenTrueFn(input)`.
|
|
1804
1624
|
* If the `predicate` returns `false`, then it will simply return `input`.
|
|
1805
1625
|
*/
|
|
1806
|
-
export function when<T
|
|
1626
|
+
export function when<T>(predicate: (x: T) => boolean, whenTrueFn: (a: T) => T): (input: T) => T;
|
|
1807
1627
|
export function when<T, U>(predicate: (x: T) => boolean, whenTrueFn: (a: T) => U): (input: T) => T | U;
|
|
1808
|
-
export function when<T, U>(predicate: (x: T) => boolean): ((whenTrueFn: (a: T) => U) => (input: T) => T | U);
|
|
1809
|
-
|
|
1810
|
-
/**
|
|
1811
|
-
* It returns `true` if all each property in `conditions` returns `true` when applied to corresponding property in `input` object.
|
|
1812
|
-
*/
|
|
1813
|
-
export function where<T, U>(conditions: T, input: U): boolean;
|
|
1814
|
-
export function where<T>(conditions: T): <U>(input: U) => boolean;
|
|
1815
|
-
export function where<ObjFunc2, U>(conditions: ObjFunc2, input: U): boolean;
|
|
1816
|
-
export function where<ObjFunc2>(conditions: ObjFunc2): <U>(input: U) => boolean;
|
|
1817
|
-
|
|
1818
|
-
/**
|
|
1819
|
-
* Same as `R.where`, but it will return `true` if at least one condition check returns `true`.
|
|
1820
|
-
*/
|
|
1821
|
-
export function whereAny<T, U>(conditions: T, input: U): boolean;
|
|
1822
|
-
export function whereAny<T>(conditions: T): <U>(input: U) => boolean;
|
|
1823
|
-
export function whereAny<ObjFunc2, U>(conditions: ObjFunc2, input: U): boolean;
|
|
1824
|
-
export function whereAny<ObjFunc2>(conditions: ObjFunc2): <U>(input: U) => boolean;
|
|
1825
|
-
|
|
1826
|
-
/**
|
|
1827
|
-
* It will return `true` if all of `input` object fully or partially include `rule` object.
|
|
1828
|
-
*
|
|
1829
|
-
* `R.equals` is used to determine equality.
|
|
1830
|
-
*/
|
|
1831
|
-
export function whereEq<T, U>(condition: T, input: U): boolean;
|
|
1832
|
-
export function whereEq<T>(condition: T): <U>(input: U) => boolean;
|
|
1833
|
-
|
|
1834
|
-
/**
|
|
1835
|
-
* It will return a new array, based on all members of `source` list that are not part of `matchAgainst` list.
|
|
1836
|
-
*
|
|
1837
|
-
* `R.equals` is used to determine equality.
|
|
1838
|
-
*/
|
|
1839
|
-
export function without<T>(matchAgainst: T[], source: T[]): T[];
|
|
1840
|
-
export function without<T>(matchAgainst: T[]): (source: T[]) => T[];
|
|
1841
|
-
|
|
1842
|
-
/**
|
|
1843
|
-
* Logical XOR
|
|
1844
|
-
*/
|
|
1845
|
-
export function xor(x: boolean, y: boolean): boolean;
|
|
1846
|
-
export function xor(y: boolean): (y: boolean) => boolean;
|
|
1847
1628
|
|
|
1848
1629
|
/**
|
|
1849
1630
|
* It will return a new array containing tuples of equally positions items from both `x` and `y` lists.
|
|
1850
1631
|
*
|
|
1851
1632
|
* The returned list will be truncated to match the length of the shortest supplied list.
|
|
1852
1633
|
*/
|
|
1853
|
-
export function zip<K, V>(x: K[], y: V[]): KeyValuePair<K, V>[];
|
|
1854
1634
|
export function zip<K>(x: K[]): <V>(y: V[]) => KeyValuePair<K, V>[];
|
|
1855
1635
|
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
export function zipObj<K extends string>(keys: K[]): <T>(values: T[]) => { [P in K]: T };
|
|
1861
|
-
export function zipObj<T, K extends number>(keys: K[], values: T[]): { [P in K]: T };
|
|
1862
|
-
export function zipObj<K extends number>(keys: K[]): <T>(values: T[]) => { [P in K]: T };
|
|
1863
|
-
|
|
1864
|
-
export function zipWith<T, U, TResult>(fn: (x: T, y: U) => TResult, list1: T[], list2: U[]): TResult[];
|
|
1865
|
-
export function zipWith<T, U, TResult>(fn: (x: T, y: U) => TResult, list1: T[]): (list2: U[]) => TResult[];
|
|
1866
|
-
export function zipWith<T, U, TResult>(fn: (x: T, y: U) => TResult): (list1: T[], list2: U[]) => TResult[];
|
|
1636
|
+
export function zipWith<T, U, TResult>(
|
|
1637
|
+
fn: (x: T, y: U) => TResult,
|
|
1638
|
+
list1: readonly T[],
|
|
1639
|
+
): (list2: readonly U[]) => TResult[];
|