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