Socket
Socket
Sign inDemoInstall

rambda

Package Overview
Dependencies
Maintainers
1
Versions
202
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rambda - npm Package Compare versions

Comparing version 6.2.0 to 6.3.0

_ts-toolbelt/src/Any/PromiseType.ts

8

_ts-toolbelt/src/Any/_api.ts

@@ -15,11 +15,5 @@ /** @ignore *//** */

export type {Promise} from './Promise'
export type {PromiseOf} from './PromiseOf'
export type {PromiseType} from './PromiseType'
export type {Try} from './Try'
export type {Type} from './Type'
export type {x} from './x'
// LEGACY
export type {Omit} from './Omit'
export type {Pick} from './Pick'
export type {Contains as Implements} from './Contains'

@@ -9,6 +9,4 @@ import {_NumberOf} from '../Number/NumberOf'

* * `extends->` : X extends Y ([[Extends]]<X, Y>)
* * `implements->`: X implements Y ([[Implements]]<X, Y>)
* * `<-contains` : Y contains X ([[Contains]]<Y, X>)
* * `<-extends` : Y extends X ([[Extends]]<Y, X>)
* * `<-implements`: Y implements X ([[Implements]]<Y, X>)
* * `equals` : X equals Y (([[Equals]]<X, Y>))

@@ -19,6 +17,4 @@ */

| 'extends->'
| 'implements->'
| '<-contains'
| '<-extends'
| '<-implements'
| 'equals'

@@ -25,0 +21,0 @@

/**
* Ask TS to re-check that **`A1`** extends **`A2`**.
* And if it fails, **`A2`** will be enforced anyway.
* Ask TS to re-check that `A1` extends `A2`.
* And if it fails, `A2` will be enforced anyway.
* Can also be used to add constraints on parameters.
* @param A1 to check against
* @param A2 to cast **`A1`** to
* @returns **`A1`** or **`A2`**
* @param A2 to cast to
* @returns `A1 | A2`
* @example

@@ -9,0 +9,0 @@ * ```ts

@@ -20,3 +20,3 @@ import {_Omit} from '../Object/Omit'

/**
* Sometimes, we can end up with mixed up **`objects`** that do not make sense
* Sometimes, we can end up with mixed up `objects` that do not make sense
* visually (or that could at least be simplified for the end user). This will

@@ -23,0 +23,0 @@ * turn anything that is passed to it into a cleaned up [[Object]].

@@ -27,9 +27,7 @@ import {Depth} from '../Object/_Internal'

*/
export type ComputeDeep<A extends any, Seen extends any = A> =
export type ComputeDeep<A extends any> =
A extends BuiltInObject
? A
: {
[K in keyof A]: A[K] extends Seen // `Seen` handles circular type refs
? A[K] // we've seen this type, don't compute
: ComputeDeep<A[K], A[K] | Seen> // 1st time seeing this, save & compute
[K in keyof A]: ComputeDeep<A[K]>
} & {}

@@ -41,3 +39,3 @@

* @param A to compute
* @returns **`A`**
* @returns `A`
* @example

@@ -44,0 +42,0 @@ * ```ts

import {Extends} from './Extends'
/**
* Check whether **`A1`** is part of **`A2`** or not. It works like
* Check whether `A1` is part of `A2` or not. It works like
* [[Extends]] but [[Boolean]] results are narrowed to [[False]].

@@ -6,0 +6,0 @@ * @param A1

/**
* Check whether **`A1`** is equal to **`A2`** or not.
* Check whether `A1` is equal to `A2` or not.
* @param A1

@@ -4,0 +4,0 @@ * @param A2

/**
* Check whether **`A1`** is part of **`A2`** or not. The difference with
* Check whether `A1` is part of `A2` or not. The difference with
* `extends` is that it forces a [[Boolean]] return.

@@ -4,0 +4,0 @@ * @param A1

@@ -7,5 +7,4 @@ import {Match} from './_Internal'

/**
* Check whether **`A`** is similar to **`A1`** or not. In other words, it is a
* compact type that bundles [[Equals]], [[Extends]], [[Contains]], and
* [[Implements]] comparison types.
* Check whether `A` is similar to `A1` or not. In other words, it is a compact
* type that bundles [[Equals]], [[Extends]], [[Contains]], comparison types.
* @param A to be compared

@@ -25,7 +24,7 @@ * @param A1 to compare to

*
* type test4 = A.Is<'a', 'a' | 'b', 'implements->'> // True
* type test5 = A.Is<'a' | 'b', 'a', 'implements->'> // False
* type test4 = A.Is<'a', 'a' | 'b', 'contains->'> // True
* type test5 = A.Is<'a' | 'b', 'a', 'contains->'> // False
*
* type test6 = A.Is<'a', 'a' | 'b', '<-implements'> // False
* type test7 = A.Is<'a' | 'b', 'a', '<-implements'> // True
* type test6 = A.Is<'a', 'a' | 'b', '<-contains'> // False
* type test7 = A.Is<'a' | 'b', 'a', '<-contains'> // True
*

@@ -40,7 +39,5 @@ * type test8 = A.Is<'a', 'a' | 'b', 'equals'> // False

'extends->' : Extends<A, A1>
'implements->': Contains<A, A1>
'<-contains' : Contains<A1, A>
'<-extends' : Extends<A1, A>
'<-implements': Contains<A1, A>
'equals' : Equals<A1, A>
}[match]

@@ -31,3 +31,3 @@ import {And} from '../Boolean/And'

/**
* Determine whether **`A`** is literal or not
* Determine whether `A` is literal or not
* @param A to be checked

@@ -34,0 +34,0 @@ * @param kind (?=`'string' | 'number'`) to restrict

@@ -19,3 +19,3 @@ import {Extends} from './Extends'

* @param A
* @returns **`'string' | 'number' | 'function' | 'array' | 'object' | 'boolean' | 'unknown'`**
* @returns `'string' | 'number' | 'function' | 'array' | 'object' | 'boolean' | 'unknown'`
* @example

@@ -22,0 +22,0 @@ * ```ts

import {Promise} from '../Any/Promise'
/**
* A way to say that you can handle **`Promises`** and non-**`Promises`**. This
* A way to say that you can handle `Promises` and non-`Promises`. This
* is often the case if you're a heavy user of `await` and `async`.
* @param A **`A`** A type
* @returns **`A | Promise<A>`**
* @param A Any type
* @returns `A | Promise<A>`
* @example

@@ -9,0 +9,0 @@ */

/**
* Similar to [[Cast]] but with a custom fallback **`Catch`**. If it fails,
* it will enforce **`Catch`** instead of **`A2`**.
* Similar to [[Cast]] but with a custom fallback `Catch`. If it fails,
* it will enforce `Catch` instead of `A2`.
* @param A1 to check against
* @param A2 to try **`A1`** with
* @param Catch to fallback (fail)
* @returns **`A1`** or **`Catch`**
* @param A2 to try/test with
* @param Catch to fallback to if the test failed
* @returns `A1 | Catch`
* @example

@@ -9,0 +9,0 @@ * ```ts

import {Key} from './Key'
declare const id: unique symbol
/**
* Create your own opaque sub-type from a type **`A`**
* Create your own opaque sub-type from a type `A`
* @param A to be personalized
* @param Id to name the sub-type
* @returns A new type **`Type<A, Id>`**
* @returns A new type `Type<A, Id>`
* @example

@@ -12,4 +14,4 @@ * ```ts

*
* type EUR = Type<number, 'eur'>
* type USD = Type<number, 'usd'>
* type EUR = A.Type<number, 'eur'>
* type USD = A.Type<number, 'usd'>
*

@@ -22,3 +24,4 @@ * let eurWallet = 10 as EUR

*/
export type Type<A extends any, Id extends Key> =
A & {__type__: Id}
export type Type<A extends any, Id extends Key> = {
[id]: Id
} & A
/**
Describes compatible type formats
* `b`: **`boolean`**
* `n`: **`number`**
* `s`: **`string`**
* `b`: `boolean`
* `n`: `number`
* `s`: `string`
*/
export type Formats = 'b' | 'n' | 's'
import {Boolean} from './Boolean'
/**
Logical **`&&`** operator (behaves like the JS one)
Logical `&&` operator (behaves like the JS one)
@param B1 Left-hand side

@@ -6,0 +6,0 @@ @param B2 Right-hand side

/**
Transform a **`boolean`** into a [[Boolean]]
Transform a `boolean` into a [[Boolean]]
@param B to transform

@@ -4,0 +4,0 @@ @returns [[Boolean]]

@@ -7,3 +7,3 @@ import {Boolean} from './Boolean'

@param B to transform
@returns **`string | number | boolean`**
@returns `string | number | boolean`
@example

@@ -10,0 +10,0 @@ ```ts

import {Boolean} from './Boolean'
/**
Logical **`!`** operator (behaves like the JS one)
Logical `!` operator (behaves like the JS one)
@param B to negate

@@ -6,0 +6,0 @@ @returns [[Boolean]]

import {Boolean} from './Boolean'
/**
Logical **`||`** operator (behaves like the JS one)
Logical `||` operator (behaves like the JS one)
@param B1 Left-hand side

@@ -6,0 +6,0 @@ @param B2 Right-hand side

import {Boolean} from './Boolean'
/**
Logical **`^`** operator (behaves like the JS one)
Logical `^` operator (behaves like the JS one)
@param B1 Left-hand side

@@ -6,0 +6,0 @@ @param B2 Right-hand side

@@ -6,5 +6,1 @@ /** @ignore *//** */

export type {Parameters} from './Parameters'
// LEGACY
export type {PromiseOf} from '../Any/PromiseOf'
import {List} from '../List/List'
/**
Alias to create/describe a [[Class]]
@param P its constructor parameters
@param R the object it constructs
*/
export type Class<P extends List = any, R extends object = any> =
new (...args: P) => R
* Alias to create/describe a `class`
* @param P its constructor parameters
* @param R the object it constructs
* @returns `class`
*/
export type Class<P extends List = any[], R extends object = object> = {
new (...args: P): R
}
import {Class} from './Class'
/**
Get the instance type of a **`class`** from a class object
@param C **typeof** **`class`**
@returns **`class`**
@example
```ts
import {C} from 'ts-toolbelt'
/// `create` takes an instance constructor and creates an instance of it
declare function create<C extends (new (...args: any[]) => any)>(c: C): C.InstanceOf<C>
class A {}
class B {}
let a = create(A) // A
let b = create(B) // B
```
*/
* Get the instance type of a `class` from a class object
* @param C **typeof** class
* @returns [[Object]]
* @example
* ```ts
* import {C} from 'ts-toolbelt'
*
* /// `create` takes an instance constructor and creates an instance of it
* declare function create<C extends (new (...args: any[]) => any)>(c: C): C.InstanceOf<C>
*
* class A {}
* class B {}
*
* let a = create(A) // A
* let b = create(B) // B
* ```
*/
export type InstanceOf<C extends Class> =
C extends new (...args: any[]) => infer R
C extends Class<any[], infer R>
? R
: any

@@ -5,3 +5,3 @@ import {Class} from './Class'

Get the parameters of a class constructor
@param C **typeof** **`class`**
@param C **typeof** class
@returns [[List]]

@@ -8,0 +8,0 @@ @example

@@ -10,2 +10,4 @@ import {Match} from '../Any/_Internal'

import {Is} from '../Any/Is'
import {Boolean} from '../Boolean/Boolean'
import {Cast} from '../Any/Cast'

@@ -15,3 +17,3 @@ /**

*/
type _IncludesDeep<O, M extends any, match extends Match = 'default', limit extends Number = '10', I extends Iteration = IterationOf<'0'>> = {
type _IncludesDeep<O, M extends any, match extends Match, limit extends Number, I extends Iteration = IterationOf<'0'>> = {
0: _IncludesDeep<O extends object ? UnionOf<O> : O, M, match, limit, Next<I>>

@@ -27,4 +29,4 @@ 1: 1

/**
* Check whether **`O`**, or its sub-objects have fields that match **`M`**
* where the maximum allowed depth is set with **`limit`**.
* Check whether `O`, or its sub-objects have fields that match `M`
* where the maximum allowed depth is set with `limit`.
*

@@ -42,2 +44,4 @@ * @param O to be inspected

export type IncludesDeep<O extends object, M extends any, match extends Match = 'default', limit extends Number = '10'> =
_IncludesDeep<O, M, match, limit>
_IncludesDeep<O, M, match, limit> extends infer X
? Cast<X, Boolean>
: never

@@ -12,2 +12,2 @@ /** @ignore *//** */

export type {Return} from './Return'
// export type {UnCurry} from './UnCurry'
export type {UnCurry} from './UnCurry'

@@ -17,3 +17,3 @@ import {Mode, Input} from './_Internal'

import {Parameters} from './Parameters'
import {PromiseOf} from '../Any/PromiseOf'
import {PromiseType} from '../Any/PromiseType'
import {Or} from '../Boolean/Or'

@@ -42,5 +42,5 @@ import {Extends} from '../Any/Extends'

Length<Tail<Fns>> extends Format<K & string, 'n'>
? PromiseOf<Fns[K]> // If mapped type reached the end
? PromiseType<Fns[K]> // If mapped type reached the end
: Function<[ // handling unknown generics, waiting for proposal
PromiseOf<Return<Fns[Pos<Next<IterationOf<K & string>>>]>> extends infer X
PromiseType<Return<Fns[Pos<Next<IterationOf<K & string>>>]>> extends infer X
? {1: any, 0: X}[Or<Extends<unknown, X>, Extends<unknown[], X>>]

@@ -93,3 +93,3 @@ : never

'sync' : (...args: Parameters<Last<Fns>>) => Return<Head<Fns>>
'async': (...args: Parameters<Last<Fns>>) => Promise<PromiseOf<Return<Head<Fns>>>>
'async': (...args: Parameters<Last<Fns>>) => Promise<PromiseType<Return<Head<Fns>>>>
}[mode]

@@ -96,0 +96,0 @@

/** @ignore *//** */
import {Function} from '../../Function'
import {PromiseOf} from '../../../Any/PromiseOf'
import {PromiseType} from '../../../Any/PromiseType'

@@ -15,3 +15,3 @@ /**

Function<P, R0>,
]): Function<P, Promise<PromiseOf<R0>>>
]): Function<P, Promise<PromiseType<R0>>>

@@ -23,5 +23,5 @@ <

>(fns: [
Function<[PromiseOf<R0>], R1>,
Function<[PromiseType<R0>], R1>,
Function<P, R0>,
]): Function<P, Promise<PromiseOf<R1>>>
]): Function<P, Promise<PromiseType<R1>>>

@@ -34,6 +34,6 @@ <

>(fns: [
Function<[PromiseOf<R1>], R2>,
Function<[PromiseOf<R0>], R1>,
Function<[PromiseType<R1>], R2>,
Function<[PromiseType<R0>], R1>,
Function<P, R0>,
]): Function<P, Promise<PromiseOf<R2>>>
]): Function<P, Promise<PromiseType<R2>>>

@@ -47,7 +47,7 @@ <

>(fns: [
Function<[PromiseOf<R2>], R3>,
Function<[PromiseOf<R1>], R2>,
Function<[PromiseOf<R0>], R1>,
Function<[PromiseType<R2>], R3>,
Function<[PromiseType<R1>], R2>,
Function<[PromiseType<R0>], R1>,
Function<P, R0>,
]): Function<P, Promise<PromiseOf<R3>>>
]): Function<P, Promise<PromiseType<R3>>>

@@ -62,8 +62,8 @@ <

>(fns: [
Function<[PromiseOf<R3>], R4>,
Function<[PromiseOf<R2>], R3>,
Function<[PromiseOf<R1>], R2>,
Function<[PromiseOf<R0>], R1>,
Function<[PromiseType<R3>], R4>,
Function<[PromiseType<R2>], R3>,
Function<[PromiseType<R1>], R2>,
Function<[PromiseType<R0>], R1>,
Function<P, R0>,
]): Function<P, Promise<PromiseOf<R4>>>
]): Function<P, Promise<PromiseType<R4>>>

@@ -79,9 +79,9 @@ <

>(fns: [
Function<[PromiseOf<R4>], R5>,
Function<[PromiseOf<R3>], R4>,
Function<[PromiseOf<R2>], R3>,
Function<[PromiseOf<R1>], R2>,
Function<[PromiseOf<R0>], R1>,
Function<[PromiseType<R4>], R5>,
Function<[PromiseType<R3>], R4>,
Function<[PromiseType<R2>], R3>,
Function<[PromiseType<R1>], R2>,
Function<[PromiseType<R0>], R1>,
Function<P, R0>,
]): Function<P, Promise<PromiseOf<R5>>>
]): Function<P, Promise<PromiseType<R5>>>

@@ -98,10 +98,10 @@ <

>(fns: [
Function<[PromiseOf<R5>], R6>,
Function<[PromiseOf<R4>], R5>,
Function<[PromiseOf<R3>], R4>,
Function<[PromiseOf<R2>], R3>,
Function<[PromiseOf<R1>], R2>,
Function<[PromiseOf<R0>], R1>,
Function<[PromiseType<R5>], R6>,
Function<[PromiseType<R4>], R5>,
Function<[PromiseType<R3>], R4>,
Function<[PromiseType<R2>], R3>,
Function<[PromiseType<R1>], R2>,
Function<[PromiseType<R0>], R1>,
Function<P, R0>,
]): Function<P, Promise<PromiseOf<R6>>>
]): Function<P, Promise<PromiseType<R6>>>

@@ -119,11 +119,11 @@ <

>(fns: [
Function<[PromiseOf<R6>], R7>,
Function<[PromiseOf<R5>], R6>,
Function<[PromiseOf<R4>], R5>,
Function<[PromiseOf<R3>], R4>,
Function<[PromiseOf<R2>], R3>,
Function<[PromiseOf<R1>], R2>,
Function<[PromiseOf<R0>], R1>,
Function<[PromiseType<R6>], R7>,
Function<[PromiseType<R5>], R6>,
Function<[PromiseType<R4>], R5>,
Function<[PromiseType<R3>], R4>,
Function<[PromiseType<R2>], R3>,
Function<[PromiseType<R1>], R2>,
Function<[PromiseType<R0>], R1>,
Function<P, R0>,
]): Function<P, Promise<PromiseOf<R7>>>
]): Function<P, Promise<PromiseType<R7>>>

@@ -142,12 +142,12 @@ <

>(fns: [
Function<[PromiseOf<R7>], R8>,
Function<[PromiseOf<R6>], R7>,
Function<[PromiseOf<R5>], R6>,
Function<[PromiseOf<R4>], R5>,
Function<[PromiseOf<R3>], R4>,
Function<[PromiseOf<R2>], R3>,
Function<[PromiseOf<R1>], R2>,
Function<[PromiseOf<R0>], R1>,
Function<[PromiseType<R7>], R8>,
Function<[PromiseType<R6>], R7>,
Function<[PromiseType<R5>], R6>,
Function<[PromiseType<R4>], R5>,
Function<[PromiseType<R3>], R4>,
Function<[PromiseType<R2>], R3>,
Function<[PromiseType<R1>], R2>,
Function<[PromiseType<R0>], R1>,
Function<P, R0>,
]): Function<P, Promise<PromiseOf<R8>>>
]): Function<P, Promise<PromiseType<R8>>>

@@ -167,13 +167,13 @@ <

>(fns: [
Function<[PromiseOf<R8>], R9>,
Function<[PromiseOf<R7>], R8>,
Function<[PromiseOf<R6>], R7>,
Function<[PromiseOf<R5>], R6>,
Function<[PromiseOf<R4>], R5>,
Function<[PromiseOf<R3>], R4>,
Function<[PromiseOf<R2>], R3>,
Function<[PromiseOf<R1>], R2>,
Function<[PromiseOf<R0>], R1>,
Function<[PromiseType<R8>], R9>,
Function<[PromiseType<R7>], R8>,
Function<[PromiseType<R6>], R7>,
Function<[PromiseType<R5>], R6>,
Function<[PromiseType<R4>], R5>,
Function<[PromiseType<R3>], R4>,
Function<[PromiseType<R2>], R3>,
Function<[PromiseType<R1>], R2>,
Function<[PromiseType<R0>], R1>,
Function<P, R0>,
]): Function<P, Promise<PromiseOf<R9>>>
]): Function<P, Promise<PromiseType<R9>>>
}
/** @ignore *//** */
import {Function} from '../../Function'
import {PromiseOf} from '../../../Any/PromiseOf'
import {PromiseType} from '../../../Any/PromiseType'

@@ -15,3 +15,3 @@ /**

Function<P, R0>,
]): Function<P, Promise<PromiseOf<R0>>>
]): Function<P, Promise<PromiseType<R0>>>

@@ -23,5 +23,5 @@ <

>(...fns: [
Function<[PromiseOf<R0>], R1>,
Function<[PromiseType<R0>], R1>,
Function<P, R0>,
]): Function<P, Promise<PromiseOf<R1>>>
]): Function<P, Promise<PromiseType<R1>>>

@@ -34,6 +34,6 @@ <

>(...fns: [
Function<[PromiseOf<R1>], R2>,
Function<[PromiseOf<R0>], R1>,
Function<[PromiseType<R1>], R2>,
Function<[PromiseType<R0>], R1>,
Function<P, R0>,
]): Function<P, Promise<PromiseOf<R2>>>
]): Function<P, Promise<PromiseType<R2>>>

@@ -47,7 +47,7 @@ <

>(...fns: [
Function<[PromiseOf<R2>], R3>,
Function<[PromiseOf<R1>], R2>,
Function<[PromiseOf<R0>], R1>,
Function<[PromiseType<R2>], R3>,
Function<[PromiseType<R1>], R2>,
Function<[PromiseType<R0>], R1>,
Function<P, R0>,
]): Function<P, Promise<PromiseOf<R3>>>
]): Function<P, Promise<PromiseType<R3>>>

@@ -62,8 +62,8 @@ <

>(...fns: [
Function<[PromiseOf<R3>], R4>,
Function<[PromiseOf<R2>], R3>,
Function<[PromiseOf<R1>], R2>,
Function<[PromiseOf<R0>], R1>,
Function<[PromiseType<R3>], R4>,
Function<[PromiseType<R2>], R3>,
Function<[PromiseType<R1>], R2>,
Function<[PromiseType<R0>], R1>,
Function<P, R0>,
]): Function<P, Promise<PromiseOf<R4>>>
]): Function<P, Promise<PromiseType<R4>>>

@@ -79,9 +79,9 @@ <

>(...fns: [
Function<[PromiseOf<R4>], R5>,
Function<[PromiseOf<R3>], R4>,
Function<[PromiseOf<R2>], R3>,
Function<[PromiseOf<R1>], R2>,
Function<[PromiseOf<R0>], R1>,
Function<[PromiseType<R4>], R5>,
Function<[PromiseType<R3>], R4>,
Function<[PromiseType<R2>], R3>,
Function<[PromiseType<R1>], R2>,
Function<[PromiseType<R0>], R1>,
Function<P, R0>,
]): Function<P, Promise<PromiseOf<R5>>>
]): Function<P, Promise<PromiseType<R5>>>

@@ -98,10 +98,10 @@ <

>(...fns: [
Function<[PromiseOf<R5>], R6>,
Function<[PromiseOf<R4>], R5>,
Function<[PromiseOf<R3>], R4>,
Function<[PromiseOf<R2>], R3>,
Function<[PromiseOf<R1>], R2>,
Function<[PromiseOf<R0>], R1>,
Function<[PromiseType<R5>], R6>,
Function<[PromiseType<R4>], R5>,
Function<[PromiseType<R3>], R4>,
Function<[PromiseType<R2>], R3>,
Function<[PromiseType<R1>], R2>,
Function<[PromiseType<R0>], R1>,
Function<P, R0>,
]): Function<P, Promise<PromiseOf<R6>>>
]): Function<P, Promise<PromiseType<R6>>>

@@ -119,11 +119,11 @@ <

>(...fns: [
Function<[PromiseOf<R6>], R7>,
Function<[PromiseOf<R5>], R6>,
Function<[PromiseOf<R4>], R5>,
Function<[PromiseOf<R3>], R4>,
Function<[PromiseOf<R2>], R3>,
Function<[PromiseOf<R1>], R2>,
Function<[PromiseOf<R0>], R1>,
Function<[PromiseType<R6>], R7>,
Function<[PromiseType<R5>], R6>,
Function<[PromiseType<R4>], R5>,
Function<[PromiseType<R3>], R4>,
Function<[PromiseType<R2>], R3>,
Function<[PromiseType<R1>], R2>,
Function<[PromiseType<R0>], R1>,
Function<P, R0>,
]): Function<P, Promise<PromiseOf<R7>>>
]): Function<P, Promise<PromiseType<R7>>>

@@ -142,12 +142,12 @@ <

>(...fns: [
Function<[PromiseOf<R7>], R8>,
Function<[PromiseOf<R6>], R7>,
Function<[PromiseOf<R5>], R6>,
Function<[PromiseOf<R4>], R5>,
Function<[PromiseOf<R3>], R4>,
Function<[PromiseOf<R2>], R3>,
Function<[PromiseOf<R1>], R2>,
Function<[PromiseOf<R0>], R1>,
Function<[PromiseType<R7>], R8>,
Function<[PromiseType<R6>], R7>,
Function<[PromiseType<R5>], R6>,
Function<[PromiseType<R4>], R5>,
Function<[PromiseType<R3>], R4>,
Function<[PromiseType<R2>], R3>,
Function<[PromiseType<R1>], R2>,
Function<[PromiseType<R0>], R1>,
Function<P, R0>,
]): Function<P, Promise<PromiseOf<R8>>>
]): Function<P, Promise<PromiseType<R8>>>

@@ -167,13 +167,13 @@ <

>(...fns: [
Function<[PromiseOf<R8>], R9>,
Function<[PromiseOf<R7>], R8>,
Function<[PromiseOf<R6>], R7>,
Function<[PromiseOf<R5>], R6>,
Function<[PromiseOf<R4>], R5>,
Function<[PromiseOf<R3>], R4>,
Function<[PromiseOf<R2>], R3>,
Function<[PromiseOf<R1>], R2>,
Function<[PromiseOf<R0>], R1>,
Function<[PromiseType<R8>], R9>,
Function<[PromiseType<R7>], R8>,
Function<[PromiseType<R6>], R7>,
Function<[PromiseType<R5>], R6>,
Function<[PromiseType<R4>], R5>,
Function<[PromiseType<R3>], R4>,
Function<[PromiseType<R2>], R3>,
Function<[PromiseType<R1>], R2>,
Function<[PromiseType<R0>], R1>,
Function<P, R0>,
]): Function<P, Promise<PromiseOf<R9>>>
]): Function<P, Promise<PromiseType<R9>>>
}
import {Pos} from '../Iteration/Pos'
import {Append} from '../List/Append'
import {_Concat} from '../List/Concat'
import {Concat} from '../List/Concat'
import {Length} from '../List/Length'

@@ -11,3 +11,3 @@ import {Next} from '../Iteration/Next'

import {Iteration} from '../Iteration/Iteration'
import {NonNullable} from '../List/NonNullable'
import {NonNullableFlat} from '../Object/NonNullable'
import {x} from '../Any/x'

@@ -22,3 +22,3 @@ import {List} from '../List/List'

*/
type GapOf<L1 extends List, L2 extends List, LN extends List, I extends Iteration = IterationOf<'0'>> =
type GapOf<L1 extends List, L2 extends List, LN extends List, I extends Iteration> =
L1[Pos<I>] extends x

@@ -34,3 +34,3 @@ ? Append<LN, L2[Pos<I>]>

0: _GapsOf<L1, L2, GapOf<L1, L2, LN, I>, Tail<L2D>, Next<I>>
1: _Concat<LN, L2D>
1: Concat<LN, L2D>
}[Extends<Pos<I>, Length<L1>>]

@@ -41,5 +41,13 @@

*/
type Gaps<L extends List> = NonNullable<{
type GapsOf<L1 extends List, L2 extends List> =
_GapsOf<L1, L2> extends infer X
? Cast<X, List>
: never
/**
@hidden
*/
type Gaps<L extends List> = Cast<NonNullableFlat<{
[K in keyof L]?: L[K] | x
}>
}>, List>

@@ -60,11 +68,11 @@ /**

export type Curry<F extends Function> =
<L extends List>(...args: Cast<L, Gaps<Parameters<F>>>) =>
_GapsOf<L, Parameters<F>> extends infer G
? Length<Cast<G, List>> extends infer L
? L extends 0 ? Return<F> : L extends 1
// it means that it can continue being curried & can be called as terminating function
? Curry<(...args: Cast<G, List>) => Return<F>> & ((...args: Cast<G, List>) => Return<F>)
// so it allows to continue currying (useless) & call the function (the last parameter)
: Curry<(...args: Cast<G, List>) => Return<F>>
: never
: never
<
L extends List,
G extends List = GapsOf<L, Parameters<F>>,
R extends any = Return<F>
>(...args: Cast<L, Gaps<Parameters<F>>>) =>
Length<G> extends 0 ? R : Length<G> extends 1
// it means that it can continue being curried & can be called as terminating function
// so it allows to continue currying (useless) & call the function (the last parameter)
? Curry<(...args: G) => R> & ((...args: G) => R)
: Curry<(...args: G) => R>

@@ -10,3 +10,3 @@ import {Function} from './Function'

@param fmt (?=`'n'`) output
@returns [[String]] or **`number`**
@returns [[String]] or `number`
@example

@@ -13,0 +13,0 @@ ```ts

/**
Explain to TS which function parameter has priority for generic inference
@param A to de-prioritize
@returns **`A`**
@returns `A`
@example

@@ -6,0 +6,0 @@ ```ts

@@ -14,3 +14,3 @@ import {Mode, Input} from './_Internal'

import {Parameters} from './Parameters'
import {PromiseOf} from '../Any/PromiseOf'
import {PromiseType} from '../Any/PromiseType'
import {Or} from '../Boolean/Or'

@@ -39,5 +39,5 @@ import {Extends} from '../Any/Extends'

K extends '0'
? PromiseOf<Fns[K]> // If first item, do nothing to it. Otherwise, pipe them:
? PromiseType<Fns[K]> // If first item, do nothing to it. Otherwise, pipe them:
: Function<[ // handling unknown generics, waiting for proposal
PromiseOf<Return<Fns[Pos<Prev<IterationOf<K & string>>>]>> extends infer X
PromiseType<Return<Fns[Pos<Prev<IterationOf<K & string>>>]>> extends infer X
? {1: any, 0: X}[Or<Extends<unknown, X>, Extends<unknown[], X>>]

@@ -92,3 +92,3 @@ : never

'sync' : (...args: Parameters<Head<Fns>>) => Return<Last<Fns>>
'async': (...args: Parameters<Head<Fns>>) => Promise<PromiseOf<Return<Last<Fns>>>>
'async': (...args: Parameters<Head<Fns>>) => Promise<PromiseType<Return<Last<Fns>>>>
}[mode]

@@ -95,0 +95,0 @@

/** @ignore *//** */
import {Function} from '../../Function'
import {PromiseOf} from '../../../Any/PromiseOf'
import {PromiseType} from '../../../Any/PromiseType'

@@ -14,3 +14,3 @@ /**

Function<P, R0>,
]): Function<P, Promise<PromiseOf<R0>>>
]): Function<P, Promise<PromiseType<R0>>>

@@ -23,4 +23,4 @@ <

Function<P, R0>,
Function<[PromiseOf<R0>], R1>,
]): Function<P, Promise<PromiseOf<R1>>>
Function<[PromiseType<R0>], R1>,
]): Function<P, Promise<PromiseType<R1>>>

@@ -34,5 +34,5 @@ <

Function<P, R0>,
Function<[PromiseOf<R0>], R1>,
Function<[PromiseOf<R1>], R2>,
]): Function<P, Promise<PromiseOf<R2>>>
Function<[PromiseType<R0>], R1>,
Function<[PromiseType<R1>], R2>,
]): Function<P, Promise<PromiseType<R2>>>

@@ -47,6 +47,6 @@ <

Function<P, R0>,
Function<[PromiseOf<R0>], R1>,
Function<[PromiseOf<R1>], R2>,
Function<[PromiseOf<R2>], R3>,
]): Function<P, Promise<PromiseOf<R3>>>
Function<[PromiseType<R0>], R1>,
Function<[PromiseType<R1>], R2>,
Function<[PromiseType<R2>], R3>,
]): Function<P, Promise<PromiseType<R3>>>

@@ -62,7 +62,7 @@ <

Function<P, R0>,
Function<[PromiseOf<R0>], R1>,
Function<[PromiseOf<R1>], R2>,
Function<[PromiseOf<R2>], R3>,
Function<[PromiseOf<R3>], R4>,
]): Function<P, Promise<PromiseOf<R4>>>
Function<[PromiseType<R0>], R1>,
Function<[PromiseType<R1>], R2>,
Function<[PromiseType<R2>], R3>,
Function<[PromiseType<R3>], R4>,
]): Function<P, Promise<PromiseType<R4>>>

@@ -79,8 +79,8 @@ <

Function<P, R0>,
Function<[PromiseOf<R0>], R1>,
Function<[PromiseOf<R1>], R2>,
Function<[PromiseOf<R2>], R3>,
Function<[PromiseOf<R3>], R4>,
Function<[PromiseOf<R4>], R5>,
]): Function<P, Promise<PromiseOf<R5>>>
Function<[PromiseType<R0>], R1>,
Function<[PromiseType<R1>], R2>,
Function<[PromiseType<R2>], R3>,
Function<[PromiseType<R3>], R4>,
Function<[PromiseType<R4>], R5>,
]): Function<P, Promise<PromiseType<R5>>>

@@ -98,9 +98,9 @@ <

Function<P, R0>,
Function<[PromiseOf<R0>], R1>,
Function<[PromiseOf<R1>], R2>,
Function<[PromiseOf<R2>], R3>,
Function<[PromiseOf<R3>], R4>,
Function<[PromiseOf<R4>], R5>,
Function<[PromiseOf<R5>], R6>,
]): Function<P, Promise<PromiseOf<R6>>>
Function<[PromiseType<R0>], R1>,
Function<[PromiseType<R1>], R2>,
Function<[PromiseType<R2>], R3>,
Function<[PromiseType<R3>], R4>,
Function<[PromiseType<R4>], R5>,
Function<[PromiseType<R5>], R6>,
]): Function<P, Promise<PromiseType<R6>>>

@@ -119,10 +119,10 @@ <

Function<P, R0>,
Function<[PromiseOf<R0>], R1>,
Function<[PromiseOf<R1>], R2>,
Function<[PromiseOf<R2>], R3>,
Function<[PromiseOf<R3>], R4>,
Function<[PromiseOf<R4>], R5>,
Function<[PromiseOf<R5>], R6>,
Function<[PromiseOf<R6>], R7>,
]): Function<P, Promise<PromiseOf<R7>>>
Function<[PromiseType<R0>], R1>,
Function<[PromiseType<R1>], R2>,
Function<[PromiseType<R2>], R3>,
Function<[PromiseType<R3>], R4>,
Function<[PromiseType<R4>], R5>,
Function<[PromiseType<R5>], R6>,
Function<[PromiseType<R6>], R7>,
]): Function<P, Promise<PromiseType<R7>>>

@@ -142,11 +142,11 @@ <

Function<P, R0>,
Function<[PromiseOf<R0>], R1>,
Function<[PromiseOf<R1>], R2>,
Function<[PromiseOf<R2>], R3>,
Function<[PromiseOf<R3>], R4>,
Function<[PromiseOf<R4>], R5>,
Function<[PromiseOf<R5>], R6>,
Function<[PromiseOf<R6>], R7>,
Function<[PromiseOf<R7>], R8>,
]): Function<P, Promise<PromiseOf<R8>>>
Function<[PromiseType<R0>], R1>,
Function<[PromiseType<R1>], R2>,
Function<[PromiseType<R2>], R3>,
Function<[PromiseType<R3>], R4>,
Function<[PromiseType<R4>], R5>,
Function<[PromiseType<R5>], R6>,
Function<[PromiseType<R6>], R7>,
Function<[PromiseType<R7>], R8>,
]): Function<P, Promise<PromiseType<R8>>>

@@ -167,12 +167,12 @@ <

Function<P, R0>,
Function<[PromiseOf<R0>], R1>,
Function<[PromiseOf<R1>], R2>,
Function<[PromiseOf<R2>], R3>,
Function<[PromiseOf<R3>], R4>,
Function<[PromiseOf<R4>], R5>,
Function<[PromiseOf<R5>], R6>,
Function<[PromiseOf<R6>], R7>,
Function<[PromiseOf<R7>], R8>,
Function<[PromiseOf<R8>], R9>,
]): Function<P, Promise<PromiseOf<R9>>>
Function<[PromiseType<R0>], R1>,
Function<[PromiseType<R1>], R2>,
Function<[PromiseType<R2>], R3>,
Function<[PromiseType<R3>], R4>,
Function<[PromiseType<R4>], R5>,
Function<[PromiseType<R5>], R6>,
Function<[PromiseType<R6>], R7>,
Function<[PromiseType<R7>], R8>,
Function<[PromiseType<R8>], R9>,
]): Function<P, Promise<PromiseType<R9>>>
}
/** @ignore *//** */
import {Function} from '../../Function'
import {PromiseOf} from '../../../Any/PromiseOf'
import {PromiseType} from '../../../Any/PromiseType'

@@ -15,3 +15,3 @@ /**

Function<P, R0>,
]): Function<P, Promise<PromiseOf<R0>>>
]): Function<P, Promise<PromiseType<R0>>>

@@ -24,4 +24,4 @@ <

Function<P, R0>,
Function<[PromiseOf<R0>], R1>,
]): Function<P, Promise<PromiseOf<R1>>>
Function<[PromiseType<R0>], R1>,
]): Function<P, Promise<PromiseType<R1>>>

@@ -35,5 +35,5 @@ <

Function<P, R0>,
Function<[PromiseOf<R0>], R1>,
Function<[PromiseOf<R1>], R2>,
]): Function<P, Promise<PromiseOf<R2>>>
Function<[PromiseType<R0>], R1>,
Function<[PromiseType<R1>], R2>,
]): Function<P, Promise<PromiseType<R2>>>

@@ -48,6 +48,6 @@ <

Function<P, R0>,
Function<[PromiseOf<R0>], R1>,
Function<[PromiseOf<R1>], R2>,
Function<[PromiseOf<R2>], R3>,
]): Function<P, Promise<PromiseOf<R3>>>
Function<[PromiseType<R0>], R1>,
Function<[PromiseType<R1>], R2>,
Function<[PromiseType<R2>], R3>,
]): Function<P, Promise<PromiseType<R3>>>

@@ -63,7 +63,7 @@ <

Function<P, R0>,
Function<[PromiseOf<R0>], R1>,
Function<[PromiseOf<R1>], R2>,
Function<[PromiseOf<R2>], R3>,
Function<[PromiseOf<R3>], R4>,
]): Function<P, Promise<PromiseOf<R4>>>
Function<[PromiseType<R0>], R1>,
Function<[PromiseType<R1>], R2>,
Function<[PromiseType<R2>], R3>,
Function<[PromiseType<R3>], R4>,
]): Function<P, Promise<PromiseType<R4>>>

@@ -80,8 +80,8 @@ <

Function<P, R0>,
Function<[PromiseOf<R0>], R1>,
Function<[PromiseOf<R1>], R2>,
Function<[PromiseOf<R2>], R3>,
Function<[PromiseOf<R3>], R4>,
Function<[PromiseOf<R4>], R5>,
]): Function<P, Promise<PromiseOf<R5>>>
Function<[PromiseType<R0>], R1>,
Function<[PromiseType<R1>], R2>,
Function<[PromiseType<R2>], R3>,
Function<[PromiseType<R3>], R4>,
Function<[PromiseType<R4>], R5>,
]): Function<P, Promise<PromiseType<R5>>>

@@ -99,9 +99,9 @@ <

Function<P, R0>,
Function<[PromiseOf<R0>], R1>,
Function<[PromiseOf<R1>], R2>,
Function<[PromiseOf<R2>], R3>,
Function<[PromiseOf<R3>], R4>,
Function<[PromiseOf<R4>], R5>,
Function<[PromiseOf<R5>], R6>,
]): Function<P, Promise<PromiseOf<R6>>>
Function<[PromiseType<R0>], R1>,
Function<[PromiseType<R1>], R2>,
Function<[PromiseType<R2>], R3>,
Function<[PromiseType<R3>], R4>,
Function<[PromiseType<R4>], R5>,
Function<[PromiseType<R5>], R6>,
]): Function<P, Promise<PromiseType<R6>>>

@@ -120,10 +120,10 @@ <

Function<P, R0>,
Function<[PromiseOf<R0>], R1>,
Function<[PromiseOf<R1>], R2>,
Function<[PromiseOf<R2>], R3>,
Function<[PromiseOf<R3>], R4>,
Function<[PromiseOf<R4>], R5>,
Function<[PromiseOf<R5>], R6>,
Function<[PromiseOf<R6>], R7>,
]): Function<P, Promise<PromiseOf<R7>>>
Function<[PromiseType<R0>], R1>,
Function<[PromiseType<R1>], R2>,
Function<[PromiseType<R2>], R3>,
Function<[PromiseType<R3>], R4>,
Function<[PromiseType<R4>], R5>,
Function<[PromiseType<R5>], R6>,
Function<[PromiseType<R6>], R7>,
]): Function<P, Promise<PromiseType<R7>>>

@@ -143,11 +143,11 @@ <

Function<P, R0>,
Function<[PromiseOf<R0>], R1>,
Function<[PromiseOf<R1>], R2>,
Function<[PromiseOf<R2>], R3>,
Function<[PromiseOf<R3>], R4>,
Function<[PromiseOf<R4>], R5>,
Function<[PromiseOf<R5>], R6>,
Function<[PromiseOf<R6>], R7>,
Function<[PromiseOf<R7>], R8>,
]): Function<P, Promise<PromiseOf<R8>>>
Function<[PromiseType<R0>], R1>,
Function<[PromiseType<R1>], R2>,
Function<[PromiseType<R2>], R3>,
Function<[PromiseType<R3>], R4>,
Function<[PromiseType<R4>], R5>,
Function<[PromiseType<R5>], R6>,
Function<[PromiseType<R6>], R7>,
Function<[PromiseType<R7>], R8>,
]): Function<P, Promise<PromiseType<R8>>>

@@ -168,12 +168,12 @@ <

Function<P, R0>,
Function<[PromiseOf<R0>], R1>,
Function<[PromiseOf<R1>], R2>,
Function<[PromiseOf<R2>], R3>,
Function<[PromiseOf<R3>], R4>,
Function<[PromiseOf<R4>], R5>,
Function<[PromiseOf<R5>], R6>,
Function<[PromiseOf<R6>], R7>,
Function<[PromiseOf<R7>], R8>,
Function<[PromiseOf<R8>], R9>,
]): Function<P, Promise<PromiseOf<R9>>>
Function<[PromiseType<R0>], R1>,
Function<[PromiseType<R1>], R2>,
Function<[PromiseType<R2>], R3>,
Function<[PromiseType<R3>], R4>,
Function<[PromiseType<R4>], R5>,
Function<[PromiseType<R5>], R6>,
Function<[PromiseType<R6>], R7>,
Function<[PromiseType<R7>], R8>,
Function<[PromiseType<R8>], R9>,
]): Function<P, Promise<PromiseType<R9>>>
}

@@ -7,3 +7,3 @@ import {Function} from './Function'

/**
Creates a promisified version of a **`Function`** **`F`**
Creates a promisified version of a `Function` `F`
@param F to promisify

@@ -10,0 +10,0 @@ @returns async F

import {Function} from './Function'
import {List} from '../List/List'

@@ -6,3 +7,3 @@ /**

@param F to extract from
@returns **`any`**
@returns [[Any]]
@example

@@ -20,4 +21,4 @@ ```ts

export type Return<F extends Function> =
F extends ((...args: any[]) => infer R)
F extends ((...args: List) => infer R)
? R
: never
/** @ignore *//** */
export * as Maps from './Maps/_api'
import * as Maps from './Maps/_api'
export type {Maps}
export type {Format} from './Format'

@@ -5,0 +7,0 @@ export type {Iteration} from './Iteration'

/**
Describes compatible type formats
* `s`: **`string`**
* `n`: **`number`**
* `s`: `string`
* `n`: `number`
*/

@@ -6,0 +6,0 @@ export type Formats = 'n' | 's'

@@ -8,3 +8,3 @@ import {Iteration} from './Iteration'

@param fmt output format
@returns **`string | number`**
@returns `string | number`
@example

@@ -11,0 +11,0 @@ ```ts

/**
An entry of **`IterationMap`**
An entry of `IterationMap`
* `[0]`: Prev (<-)
* `[1]`: Next (->)
* `[2]`: Current **`string`**
* `[3]`: Current **`number`**
* `[4]`: Current Negative **`string`**
* `[5]`: Cumulated Previous **`keys`** (for `Min` & `Max`)
* `[2]`: Current `string`
* `[3]`: Current `number`
* `[4]`: Current Negative `string`
* `[5]`: Cumulated Previous `keys` (for `Min` & `Max`)
* `[6]`: Sign (- / 0 / +)

@@ -10,0 +10,0 @@ */

@@ -5,3 +5,3 @@ import {Iteration} from './Iteration'

/**
Get the position of **`I`** (**string**)
Get the position of `I` (**string**)
@param I to query

@@ -8,0 +8,0 @@ @returns [[String]]

import {Iteration} from './Iteration'
import {Patch} from '../Object/Patch'

@@ -43,3 +42,3 @@ /**

K,
Patch<RM, BoundMap>
RM & BoundMap
]

@@ -6,3 +6,3 @@ import {Map} from '../Iteration/Map'

/**
Move **`I`**'s position forward
Move `I`'s position forward
@param I to move

@@ -9,0 +9,0 @@ @param IMap to operate with another set of numbers

@@ -5,6 +5,6 @@ import {Iteration} from './Iteration'

/**
Get the position of **`I`** (**number**)
Get the position of `I` (**number**)
@param I to query
@param IMap to operate with another set of numbers
@returns **`number`**
@returns `number`
@example

@@ -11,0 +11,0 @@ ```ts

@@ -6,3 +6,3 @@ import {Map} from '../Iteration/Map'

/**
Move **`I`**'s position backwards
Move `I`'s position backwards
@param I to move

@@ -9,0 +9,0 @@ @param IMap to operate with another set of numbers

@@ -33,3 +33,3 @@ /** @ignore *//** */

export type {Longest} from './Longest'
export type {Patch as Merge} from './Patch' // LEGACY
export type {Merge} from './Merge'
export type {MergeAll} from './MergeAll'

@@ -78,8 +78,1 @@ export type {Modify} from './Modify'

export type {ZipObj} from './ZipObj'
// LEGACY
export type {Merge as MergeUp} from './Merge'
export type {Assign as AssignUp} from './Assign'
export type {PatchAll as Compact} from './PatchAll'
export type {MergeAll as CompactUp} from './MergeAll'

@@ -1,12 +0,5 @@

import {_Concat} from './Concat'
import {List} from './List'
/**
@hidden
*/
export type _Append<L extends List, A extends any> =
_Concat<L, [A]>
/**
Add an element **`A`** at the end of **`L`**
Add an element `A` at the end of `L`
@param L to append to

@@ -20,6 +13,2 @@ @param A to be added to

export type Append<L extends List, A extends any> =
L extends unknown
? A extends unknown
? _Append<L, A>
: never
: never
[...L, A]

@@ -8,3 +8,3 @@ import {Assign as OAssign} from '../Object/Assign'

/**
Assign a list of [[List]] into **`L`** with [[Merge]]. Merges from left to
Assign a list of [[List]] into `L` with [[Merge]]. Merges from left to
right, first items get overridden by the next ones (last-in overrides).

@@ -11,0 +11,0 @@ @param L to assign to

@@ -7,7 +7,7 @@ import {At as OAt} from '../Object/At'

/**
Get in **`L`** the type of an entry of key **`K`**
Get in `L` the type of an entry of key `K`
@param L to extract from
@param K to extract at
@param strict (?=`1`) `0` to work with unions
@returns **`any`**
@returns [[Any]]
@example

@@ -14,0 +14,0 @@ */

@@ -10,3 +10,3 @@ import {Key} from '../Any/Key'

/**
Make that at least one of the keys **`K`** are required in **`L`** at a time.
Make that at least one of the keys `K` are required in `L` at a time.
@param L to make required

@@ -13,0 +13,0 @@ @param K (?=`keyof L`) to choose fields

import {Depth} from '../Object/_Internal'
import {Compulsory as OCompulsory} from '../Object/Compulsory'
import {Cast} from '../Any/Cast'
import {CompulsoryPart} from '../Object/Compulsory'
import {List} from './List'
import {Key} from '../Any/Key'
import {_Pick} from '../Object/Pick'
/**
Make that **`L`**'s fields cannot be [[Nullable]] or [[Optional]] (it's like
Make that `L`'s fields cannot be [[Nullable]] or [[Optional]] (it's like
[[Required]] & [[NonNullable]] at once).

@@ -18,2 +17,2 @@ @param L to make compulsory

export type Compulsory<L extends List, depth extends Depth = 'flat'> =
Cast<OCompulsory<L, Key, depth>, List>
CompulsoryPart<L, depth>

@@ -6,3 +6,3 @@ import {Compulsory as OCompulsory} from '../Object/Compulsory'

/**
Get the keys of **`L`** that are [[Compulsory]]
Get the keys of `L` that are [[Compulsory]]

@@ -9,0 +9,0 @@ (⚠️ needs `--strictNullChecks` enabled)

@@ -1,12 +0,5 @@

import {_Reverse} from './Reverse'
import {List} from './List'
/**
@hidden
*/
export type _Concat<L extends List, L1 extends List> =
_Reverse<_Reverse<L>, L1>
/**
Attach **`L1`** at the end of **`L`**
Attach `L1` at the end of `L`
@param L to concat with

@@ -20,6 +13,2 @@ @param L1 to be attached

export type Concat<L extends List, L1 extends List> =
L extends unknown
? L1 extends unknown
? _Concat<L, L1>
: never
: never
[...L, ...L1]

@@ -8,4 +8,4 @@ import {Diff as ODiff} from '../Object/Diff'

/**
Get a [[List]] that is the difference between **`L`** & **`L1`**
(**`L`**'s differences have priority over **`L1`**'s if entries overlap)
Get a [[List]] that is the difference between `L` & `L1`
(`L`'s differences have priority over `L1`'s if entries overlap)
(If `match = 'default'`, no type checks are done)

@@ -12,0 +12,0 @@ @param L to check differences with

@@ -33,3 +33,3 @@ import {Tail} from './Tail'

*/
type __Drop<L extends List, N extends Iteration, way extends Way = '->'> = {
type __Drop<L extends List, N extends Iteration, way extends Way> = {
'->': DropForth<L, N>

@@ -48,3 +48,3 @@ '<-': DropBack<L, N>

/**
Remove **`N`** entries out of **`L`**
Remove `N` entries out of `L`
@param L to remove from

@@ -51,0 +51,0 @@ @param N to remove out

@@ -10,3 +10,3 @@ import {Key} from '../Any/Key'

/**
Split **`L`** into a [[Union]] with **`K`** keys in such a way that none of
Split `L` into a [[Union]] with `K` keys in such a way that none of
the keys are ever present with one another within the different unions.

@@ -13,0 +13,0 @@ @param L to split

@@ -8,3 +8,3 @@ import {Match} from '../Any/_Internal'

/**
Exclude the entries of **`L1`** out of **`L`**
Exclude the entries of `L1` out of `L`
(If `match = 'default'`, no type checks are done)

@@ -11,0 +11,0 @@ @param L to remove from

@@ -7,3 +7,3 @@ import {ExcludeKeys as OExcludeKeys} from '../Object/ExcludeKeys'

/**
Exclude the keys of **`L1`** out of the keys of **`L`**
Exclude the keys of `L1` out of the keys of `L`
(If `match = 'default'`, no type checks are done)

@@ -10,0 +10,0 @@ @param L to remove the keys from

@@ -7,3 +7,3 @@ import {KeySet} from './KeySet'

/**
Pick a range of entries (portion) from **`L`**
Pick a range of entries (portion) from `L`
@param L to pick from

@@ -10,0 +10,0 @@ @param From to start with

@@ -8,3 +8,3 @@ import {Filter as OFilter} from '../Object/Filter'

/**
Filter out of **`L`** the entries that match **`M`**
Filter out of `L` the entries that match `M`
@param L to remove from

@@ -11,0 +11,0 @@ @param M to select entries

@@ -7,3 +7,3 @@ import {FilterKeys as OFilterKeys} from '../Object/FilterKeys'

/**
Filter out the keys of **`L`** which entries match **`M`**
Filter out the keys of `L` which entries match `M`
@param L to remove from

@@ -10,0 +10,0 @@ @param M to select entries

@@ -30,3 +30,3 @@ import {List} from './List'

/**
Remove all dimensions of **`L`** (10 max)
Remove all dimensions of `L` (10 max)
@param L to un-nest

@@ -33,0 +33,0 @@ @param strict (?=`1`) `0` to not preserve tuples

@@ -5,6 +5,5 @@ import {Number} from '../Number/Number'

import {Cast} from '../Any/Cast'
import {Prepend} from './Prepend'
import {_Reverse} from './Reverse'
import {Append} from './Append'
import {List} from './List'
import {Extends} from '../Any/_api'
import {Extends} from '../Any/Extends'

@@ -15,4 +14,4 @@ /**

type __Group<L extends List, N extends Number, LN extends List = []> = {
0: __Group<_Drop<L, N>, N, Prepend<LN, _Take<L, N>>>
1: _Reverse<LN>
0: __Group<_Drop<L, N>, N, Append<LN, _Take<L, N>>>
1: LN
}[Extends<L, List<never>>]

@@ -29,3 +28,3 @@

/**
Split **`L`** into sub-[[List]]s every **`N`**
Split `L` into sub-[[List]]s every `N`
@param L to group

@@ -32,0 +31,0 @@ @param N to split at

@@ -8,3 +8,3 @@ import {Match, NumberOf} from '../Any/_Internal'

/**
Check whether **`L`** has a entry of key **`K`** that matches **`M`**
Check whether `L` has a entry of key `K` that matches `M`
@param L to be inspected

@@ -11,0 +11,0 @@ @param K to choose entry

@@ -8,3 +8,3 @@ import {HasPath as OHasPath} from '../Object/HasPath'

/**
Check whether **`L`** has nested entries that match **`M`**
Check whether `L` has nested entries that match `M`
@param L to be inspected

@@ -11,0 +11,0 @@ @param Path to be followed

@@ -5,5 +5,5 @@ import {Length} from './Length'

/**
Get the first entry of **`L`**
Get the first entry of `L`
@param L to extract from
@returns **`any`**
@returns [[Any]]
@example

@@ -10,0 +10,0 @@ ```ts

@@ -7,3 +7,3 @@ import {Match} from '../Any/_Internal'

/**
Check whether **`L`** has entries that match **`M`**
Check whether `L` has entries that match `M`
@param L to be inspected

@@ -10,0 +10,0 @@ @param M to check entry type

@@ -8,3 +8,3 @@ import {Intersect as OIntersect} from '../Object/Intersect'

/**
Get the intersecting entries of **`L`** & **`L1`**
Get the intersecting entries of `L` & `L1`
(If `match = 'default'`, no type checks are done)

@@ -11,0 +11,0 @@ @param L to check similarities with

@@ -7,3 +7,3 @@ import {Match} from '../Any/_Internal'

/**
Get the intersecting entries of **`L`** & **`L1`**
Get the intersecting entries of `L` & `L1`
(If `match = 'default'`, no type checks are done)

@@ -10,0 +10,0 @@ @param L to check similarities with

@@ -6,5 +6,5 @@ import {Tail} from './Tail'

/**
Get the last entry of **`L`**
Get the last entry of `L`
@param L to extract from
@returns **`any`**
@returns [[Any]]
@example

@@ -11,0 +11,0 @@ ```ts

@@ -7,6 +7,6 @@ import {Length} from './Length'

/**
Get the last index of **`L`**
Get the last index of `L`
@param L to get from
@param fmt (?=`'n'`) output format
@returns [[String]] or **`number`**
@returns [[String]] or `number`
@example

@@ -13,0 +13,0 @@ ```ts

@@ -6,6 +6,6 @@ import {NumberOf} from '../Number/NumberOf'

/**
Get the length of **`L`**
Get the length of `L`
@param L to get length
@param fmt (?=`'n'`) output format
@returns [[String]] or **`number`**
@returns [[String]] or `number`
@example

@@ -12,0 +12,0 @@ ```ts

@@ -6,7 +6,7 @@ import {Exclude} from '../Union/Exclude'

/**
Get the longest [[List]] of **`L`** & **`L1`**
(**`L`** has priority if both lengths are equal)
Get the longest [[List]] of `L` & `L1`
(`L` has priority if both lengths are equal)
@param L to compare length
@param L1 to compare length
@returns **`L`** or **`L1`**
@returns `L | L1`
@example

@@ -13,0 +13,0 @@ ```ts

import {Merge as OMerge} from '../Object/Merge'
import {List} from './List'
import {Depth} from '../Object/_Internal'
import {BuiltInObject} from '../Misc/BuiltInObject'
/**
Accurately merge the fields of **`L`** with the ones of **`L1`**. It is
Accurately merge the fields of `L` with the ones of `L1`. It is
equivalent to the spread operator in JavaScript. [[Union]]s and [[Optional]]

@@ -14,2 +15,3 @@ fields will be handled gracefully.

@param depth (?=`'flat'`) to do it deeply
@param ignore (?=`BuiltinObject`) types not to merge
@returns [[Object]]

@@ -20,3 +22,3 @@ @example

*/
export type Merge<L extends List, L1 extends List, depth extends Depth = 'flat'> =
OMerge<L, L1, depth, 0>
export type Merge<L extends List, L1 extends List, depth extends Depth = 'flat', ignore extends any = BuiltInObject> =
OMerge<L, L1, depth, 0, ignore>

@@ -6,3 +6,3 @@ import {MergeAll as OMergeAll} from '../Object/MergeAll'

/**
[[Merge]] a list of [[List]]s into **`L`**. Merges from left to right, first
[[Merge]] a list of [[List]]s into `L`. Merges from left to right, first
items get completed by the next ones (last-in completes).

@@ -9,0 +9,0 @@ @param O to start with

@@ -7,3 +7,3 @@ import {At} from './At'

/**
Modify **`L`** with **`LMod`** & the [[x]] placeholder
Modify `L` with `LMod` & the [[x]] placeholder
@param L to copy from

@@ -10,0 +10,0 @@ @param LMod to copy to

@@ -0,14 +1,41 @@

import {_Pick} from '../Object/Pick'
import {Key} from '../Any/Key'
import {NonNullable as UNonNullable} from '../Union/NonNullable'
import {Depth} from '../Object/_Internal'
import {NonNullable as ONonNullable} from '../Object/NonNullable'
import {ListOf} from '../Object/ListOf'
import {Cast} from '../Any/Cast'
import {Key} from '../Any/Key'
import {ObjectOf} from './ObjectOf'
import {Contains} from '../Any/Contains'
import {Keys} from './Keys'
import {List} from './List'
import {NumberOf} from '../Any/_Internal'
import {BuiltInObject} from '../Misc/BuiltInObject'
/**
Make some entries of **`L`** not nullable (deeply or not)
* @hidden
*/
export type NonNullableFlat<O, K extends Key = Key> = {
[P in keyof O]: P extends K
? UNonNullable<O[P]>
: O[P]
} & {}
/**
* @hidden
*/
type _NonNullableDeep<O> = {
[K in keyof O]: O[K] extends BuiltInObject
? O[K]
: NonNullableDeep<O[K], Key>
}
/**
* @hidden
*/
export type NonNullableDeep<O, K extends Key = Key> =
_NonNullableDeep<NonNullableFlat<O, K>>
/**
* @hidden
*/
export type NonNullablePart<O extends object, K extends Key, depth extends Depth> = {
'flat': NonNullableFlat<O, K>
'deep': NonNullableDeep<O, K>
}[depth]
/**
Make some entries of `L` not nullable (deeply or not)
@param L to make non nullable

@@ -22,5 +49,3 @@ @param K (?=`Key`) to choose fields

*/
export type NonNullable<L extends List, K extends Key = Key, depth extends Depth = 'flat'> = {
1: Cast<ONonNullable<L, Key, depth>, List>
0: ListOf<ONonNullable<ObjectOf<L>, NumberOf<K>, depth>>
}[Contains<Keys<L>, K>] & {}
export type NonNullable<O extends object, K extends Key = Key, depth extends Depth = 'flat'> =
NonNullablePart<O, K, depth>

@@ -6,3 +6,3 @@ import {NonNullableKeys as ONonNullableKeys} from '../Object/NonNullableKeys'

/**
Get the keys of **`L`** that are non-nullable
Get the keys of `L` that are non-nullable
@param L

@@ -9,0 +9,0 @@ @returns [[Key]]

import {Key} from '../Any/Key'
import {Cast} from '../Any/Cast'
import {Contains} from '../Any/Contains'
import {Depth} from '../Object/_Internal'
import {Nullable as ONullable} from '../Object/Nullable'
import {ListOf} from '../Object/ListOf'
import {ObjectOf} from './ObjectOf'
import {List} from './List'
import {Keys} from './Keys'
import {NumberOf} from '../Any/_Internal'
import {Update} from '../Object/Update'
import {x} from '../Any/x'
/**
Make some entries of **`L`** nullable (deeply or not)
Make some entries of `L` nullable (deeply or not)
@param L to make nullable

@@ -22,5 +17,3 @@ @param K (?=`Key`) to choose fields

*/
export type Nullable<L extends List, K extends Key = Key, depth extends Depth = 'flat'> = {
1: Cast<ONullable<L, Key, depth>, List>
0: ListOf<ONullable<ObjectOf<L>, NumberOf<K>, depth>>
}[Contains<Keys<L>, K>] & {}
export type Nullable<L extends List, K extends Key = Key, depth extends Depth = 'flat'> =
Update<L, K, x | null | undefined, depth>

@@ -6,3 +6,3 @@ import {NullableKeys as ONullableKeys} from '../Object/NullableKeys'

/**
Get the keys of **`L`** that are nullable
Get the keys of `L` that are nullable
@param L

@@ -9,0 +9,0 @@ @returns [[Key]]

import {_Omit} from '../Object/Omit'
import {Has} from '../Union/Has'
import {At} from '../Object/At'
import {_Pick} from '../Object/Pick'
import {List} from './List'
import {Exclude} from '../Union/Exclude'
/**
@hidden
*/
export type _ObjectOf<L extends object> =
Has<keyof L, keyof List> extends 1 // check that is is an array // todo rm
? number extends At<L, 'length'> // ^^^ handles mixed up objs
? _Omit<L, Exclude<keyof any[], number>> // preserves arrays
: _Omit<L, keyof any[]> // transforms tuples
: L // todo rm
/**
Transform a [[List]] into an [[Object]] equivalent

@@ -25,7 +13,7 @@ @param L to transform

*/
export type ObjectOf<L extends object> =
L extends unknown
? _ObjectOf<L>
: never
// todo simplify on the v7, must take Lists only
export type ObjectOf<O extends object> =
O extends List
? number extends O['length'] // detect arrays
? _Pick<O, number> // preserves arrays
: _Omit<O, keyof any[]> // transforms tuples
: O

@@ -5,3 +5,3 @@ import {_Omit as _OOmit} from '../Object/Omit'

import {List} from './List'
import {_ObjectOf} from './ObjectOf'
import {ObjectOf} from './ObjectOf'
import {NumberOf} from '../Any/_Internal'

@@ -13,6 +13,6 @@

export type _Omit<L extends List, K extends Key> =
_ListOf<_OOmit<_ObjectOf<L>, NumberOf<K>>>
_ListOf<_OOmit<ObjectOf<L>, NumberOf<K>>>
/**
Remove out of **`L`** the entries of key **`K`**
Remove out of `L` the entries of key `K`
@param L to remove from

@@ -19,0 +19,0 @@ @param K to chose entries

@@ -1,9 +0,7 @@

import {Optional as OOptional} from '../Object/Optional'
import {OptionalPart} from '../Object/Optional'
import {Depth} from '../Object/_Internal'
import {Cast} from '../Any/Cast'
import {List} from './List'
import {Key} from '../Any/Key'
/**
Make **`L`** optional (deeply or not)
Make `L` optional (deeply or not)
@param L to make optional

@@ -17,2 +15,2 @@ @param depth (?=`'flat'`) to do it deeply

export type Optional<L extends List, depth extends Depth = 'flat'> =
Cast<OOptional<L, Key, depth>, List>
OptionalPart<L, depth>

@@ -6,3 +6,3 @@ import {OptionalKeys as OOptionalKeys} from '../Object/OptionalKeys'

/**
Get the keys of **`L`** that are optional
Get the keys of `L` that are optional
@param L

@@ -9,0 +9,0 @@ @returns [[Key]]

@@ -6,3 +6,3 @@ import {Overwrite as OOverwrite} from '../Object/Overwrite'

/**
Update the entries of **`L`** with the ones of **`L1`**
Update the entries of `L` with the ones of `L1`
@param L to update

@@ -9,0 +9,0 @@ @param L1 to update with

@@ -7,3 +7,3 @@ import {Partial as OPartial} from '../Object/Partial'

/**
Make all fields of **`O`** optional (deeply or not)
Make all fields of `O` optional (deeply or not)
@param L to make optional

@@ -10,0 +10,0 @@ @param depth (?=`'flat'`) to do it deeply

import {Patch as OPatch} from '../Object/Patch'
import {List} from './List'
import {Depth} from '../Object/_Internal'
import {BuiltInObject} from '../Misc/BuiltInObject'
/**
Complete the fields of **`L`** with the ones of **`L1`**. This is a version of
Complete the fields of `L` with the ones of `L1`. This is a version of
[[Merge]] that does NOT handle optional fields, it only completes fields of `O`

@@ -15,2 +16,3 @@ with the ones of `O1` if they don't exist.

@param style (?=`1`) 0 = lodash, 1 = ramda
@param ignore (?=`BuiltinObject`) types not to merge
@returns [[List]]

@@ -21,3 +23,3 @@ @example

*/
export type Patch<L extends List, L1 extends List, depth extends Depth = 'flat'> =
OPatch<L, L1, depth, 0>
export type Patch<L extends List, L1 extends List, depth extends Depth = 'flat', ignore extends any = BuiltInObject> =
OPatch<L, L1, depth, 0, ignore>
import {PatchAll as OPatchAll} from '../Object/PatchAll'
import {List} from '../List/List'
import {Depth} from '../Object/_Internal'
import {BuiltInObject} from '../Misc/BuiltInObject'
/**
[[Patch]] a list of [[List]]s into **`L`**. Patches from left to right, first
[[Patch]] a list of [[List]]s into `L`. Patches from left to right, first
items get completed by the next ones (last-in completes).

@@ -11,2 +12,3 @@ @param O to start with

@param depth (?=`'flat'`) to do it deeply
@param ignore (?=`BuiltinObject`) types not to merge
@returns [[List]]

@@ -17,3 +19,3 @@ @example

*/
export type PatchAll<O extends List, Ls extends List<List>, depth extends Depth = 'flat'> =
OPatchAll<O, Ls, depth, 0>
export type PatchAll<O extends List, Ls extends List<List>, depth extends Depth = 'flat', ignore extends any = BuiltInObject> =
OPatchAll<O, Ls, depth, 0, ignore>

@@ -6,6 +6,6 @@ import {Path as OPath} from '../Object/Path'

/**
Get in **`L`** the type of nested properties
Get in `L` the type of nested properties
@param L to be inspected
@param Path to be followed
@returns **`any`**
@returns [[Any]]
@example

@@ -12,0 +12,0 @@ ```ts

@@ -6,6 +6,6 @@ import {Paths as OPaths} from '../Object/Paths'

/**
Get all the possible paths of **`L`**
Get all the possible paths of `L`
(⚠️ this won't work with circular-refs)
@param L to be inspected
@returns **`string[]`**
@returns [[String]][]
@example

@@ -12,0 +12,0 @@ ```ts

@@ -9,3 +9,3 @@ import {PathValid as OPathValid} from '../Object/PathValid'

@param Path to be validated
@returns **`Index[]`**
@returns [[Index]][]
@example

@@ -12,0 +12,0 @@ ```ts

import {_Pick as _OPick} from '../Object/Pick'
import {_ListOf} from '../Object/ListOf'
import {Key} from '../Any/Key'
import {_ObjectOf} from './ObjectOf'
import {ObjectOf} from './ObjectOf'
import {List} from './List'

@@ -12,6 +12,6 @@ import {NumberOf} from '../Any/_Internal'

export type _Pick<L extends List, K extends Key> =
_ListOf<_OPick<_ObjectOf<L>, NumberOf<K>>>
_ListOf<_OPick<ObjectOf<L>, NumberOf<K>>>
/**
Extract out of **`L`** the entries of key **`K`**
Extract out of `L` the entries of key `K`
@param L to extract from

@@ -18,0 +18,0 @@ @param K to chose entries

import {_Omit} from './Omit'
import {List} from './List'
import {LastIndex} from './LastIndex'
import {Naked} from './_Internal'
/**
@hidden
*/
export type _Pop<L extends List> =
_Omit<L, LastIndex<Naked<L>, 's'>>
/**
Remove the last element out of **`L`**
Remove the last element out of `L`
@param L to remove from

@@ -21,4 +13,4 @@ @returns [[List]]

export type Pop<L extends List> =
L extends unknown
? _Pop<L>
: never
L extends (readonly [...infer LBody, any] | readonly [...infer LBody, any?])
? LBody
: L
import {List} from './List'
/**
Add an element **`A`** at the beginning of **`L`**
Add an element `A` at the beginning of `L`
@param L to append to

@@ -13,4 +13,2 @@ @param A to be added to

export type Prepend<L extends List, A extends any> =
((head: A, ...args: L) => any) extends ((...args: infer U) => any)
? U
: L
[A, ...L]
import {Depth} from '../Object/_Internal'
import {Readonly as OReadonly} from '../Object/Readonly'
import {Cast} from '../Any/Cast'
import {ReadonlyPart} from '../Object/Readonly'
import {List} from './List'
import {Key} from '../Any/Key'
/**
Make **`L`** readonly (deeply or not)
Make `L` readonly (deeply or not)
@param L to make readonly

@@ -17,2 +15,2 @@ @param depth (?=`'flat'`) to do it deeply

export type Readonly<L extends List, depth extends Depth = 'flat'> =
Cast<OReadonly<L, Key, depth>, List>
ReadonlyPart<L, depth>

@@ -6,3 +6,3 @@ import {ReadonlyKeys as OReadonlyKeys} from '../Object/ReadonlyKeys'

/**
Get the keys of **`L`** that are readonly
Get the keys of `L` that are readonly
@param L

@@ -9,0 +9,0 @@ @returns [[Key]]

@@ -7,3 +7,3 @@ import {Number} from '../Number/Number'

/**
Remove out of **`L`** a range of entries
Remove out of `L` a range of entries
@param L to remove from

@@ -10,0 +10,0 @@ @param From to start from

@@ -28,3 +28,3 @@ import {Next} from '../Iteration/Next'

/**
Fill a [[List]] with **`N`** times **`A`**
Fill a [[List]] with `N` times `A`
@param A to fill with

@@ -31,0 +31,0 @@ @param N to repeat it

@@ -7,3 +7,3 @@ import {Replace as OReplace} from '../Object/Replace'

/**
Update with **`A`** the entries of **`L`** that match **`M`**
Update with `A` the entries of `L` that match `M`
@param O to update

@@ -10,0 +10,0 @@ @param M to select fields

import {Depth} from '../Object/_Internal'
import {Required as ORequired} from '../Object/Required'
import {Cast} from '../Any/Cast'
import {RequiredPart} from '../Object/Required'
import {List} from './List'
import {Key} from '../Any/Key'
/**
Make **`L`** required (deeply or not)
Make `L` required (deeply or not)
@param L to make required

@@ -17,2 +15,2 @@ @param depth (?=`'flat'`) to do it deeply

export type Required<L extends List, depth extends Depth = 'flat'> =
Cast<ORequired<L, Key, depth>, List>
RequiredPart<L, depth>

@@ -6,3 +6,3 @@ import {RequiredKeys as ORequiredKeys} from '../Object/RequiredKeys'

/**
Get the keys of **`L`** that are readonly
Get the keys of `L` that are readonly
@param L

@@ -9,0 +9,0 @@ @returns [[Key]]

@@ -37,7 +37,5 @@ import {Prepend} from './Prepend'

*/
export type Reverse<L extends List, LO extends List = []> =
export type Reverse<L extends List> =
L extends unknown
? LO extends unknown
? _Reverse<L, LO>
: never
? _Reverse<L>
: never

@@ -8,3 +8,3 @@ import {Match} from '../Any/_Internal'

/**
Extract the entries of **`L`** that match **`M`**
Extract the entries of `L` that match `M`
@param L to extract from

@@ -11,0 +11,0 @@ @param M to select entries

@@ -7,3 +7,3 @@ import {Match} from '../Any/_Internal'

/**
Get the keys of **`L`** which entries match **`M`**
Get the keys of `L` which entries match `M`
@param L to extract from

@@ -10,0 +10,0 @@ @param M to select entries

@@ -6,7 +6,7 @@ import {Exclude} from '../Union/Exclude'

/**
Get the shortest [[List]] of **`L`** & **`L1`**
(**`L`** has priority if both lengths are equal)
Get the shortest [[List]] of `L` & `L1`
(`L` has priority if both lengths are equal)
@param L to compare length
@param L1 to compare length
@returns **`L`** or **`L1`**
@returns `L | L1`
@example

@@ -13,0 +13,0 @@ ```ts

@@ -12,4 +12,4 @@ import {List} from './List'

export type Tail<L extends List> =
((...t: L) => any) extends ((head: any, ...tail: infer LTail) => any)
L extends readonly [any, ...infer LTail]
? LTail
: never
: L

@@ -48,3 +48,3 @@ import {Number} from '../Number/Number'

/**
Extract **`N`** entries out of **`L`**
Extract `N` entries out of `L`
@param L to extract from

@@ -51,0 +51,0 @@ @param N to extract out

@@ -0,14 +1,9 @@

import {Key} from '../Any/Key'
import {Depth} from '../Object/_Internal'
import {Undefinable as OUndefinable} from '../Object/Undefinable'
import {ListOf} from '../Object/ListOf'
import {Cast} from '../Any/Cast'
import {Key} from '../Any/Key'
import {ObjectOf} from './ObjectOf'
import {Contains} from '../Any/Contains'
import {Keys} from './Keys'
import {List} from './List'
import {NumberOf} from '../Any/_Internal'
import {Update} from '../Object/Update'
import {x} from '../Any/x'
/**
Make some entries of **`L`** not **`undefined`** (deeply or not)
Make some entries of `L` not `undefined` (deeply or not)
@param L to make non nullable

@@ -22,5 +17,3 @@ @param K (?=`Key`) to choose fields

*/
export type Undefinable<L extends List, K extends Key = Key, depth extends Depth = 'flat'> = {
1: Cast<OUndefinable<L, Key, depth>, List>
0: ListOf<OUndefinable<ObjectOf<L>, NumberOf<K>, depth>>
}[Contains<Keys<L>, K>] & {}
export type Undefinable<L extends List, K extends Key = Key, depth extends Depth = 'flat'> =
Update<L, K, x | undefined, depth>

@@ -6,3 +6,3 @@ import {UndefinableKeys as OUndefinableKeys} from '../Object/UndefinableKeys'

/**
Get the keys of **`L`** that are **`undefined`**
Get the keys of `L` that are `undefined`
@param L

@@ -9,0 +9,0 @@ @returns [[Key]]

@@ -7,3 +7,3 @@ import {Key} from '../Any/Key'

/**
Make the fields of **`L`** union the ones of **`L1`**
Make the fields of `L` union the ones of `L1`
@param L to union from

@@ -10,0 +10,0 @@ @param L1 to union with

@@ -6,3 +6,3 @@ import {List} from './List'

@param L to transform
@returns **`any`**
@returns [[Any]]
@example

@@ -9,0 +9,0 @@ ```ts

@@ -1,3 +0,3 @@

import {_Concat} from './Concat'
import {_Append} from './Append'
import {Concat} from './Concat'
import {Append} from './Append'
import {Cast} from '../Any/Cast'

@@ -36,4 +36,4 @@ import {Length} from './Length'

? LP extends List
? _Concat<LN, L[Pos<I>]> // if it's a list
: _Append<LN, L[Pos<I>]> // if it's an item
? Concat<LN, L[Pos<I>]> // if it's a list
: Append<LN, L[Pos<I>]> // if it's an item
: never

@@ -66,3 +66,3 @@

/**
Remove a dimension of **`L`**
Remove a dimension of `L`
@param L to un-nest

@@ -69,0 +69,0 @@ @param strict (?=`1`) `0` to not preserve tuples

import {Key} from '../Any/Key'
import {List} from './List'
import {Update as OUpdate} from '../Object/Update'
import {Depth} from '../Object/_Internal'
/**
Update in **`L`** the entries of key **`K`** with **`A`**.
Update in `L` the entries of key `K` with `A`.
Use the [[x]] placeholder to get the current field type.

@@ -16,3 +17,3 @@ @param L to update

*/
export type Update<L extends List, K extends Key, A extends any> =
OUpdate<L, K, A>
export type Update<L extends List, K extends Key, A extends any, depth extends Depth = 'flat'> =
OUpdate<L, K, A, depth>
import {Depth} from '../Object/_Internal'
import {Writable as OWritable} from '../Object/Writable'
import {Cast} from '../Any/Cast'
import {WritablePart} from '../Object/Writable'
import {List} from './List'
import {Key} from '../Any/Key'
/**
Make **`L`** writable (deeply or not)
Make `L` writable (deeply or not)
@param L to make writable

@@ -17,2 +15,2 @@ @param depth (?=`'flat'`) to do it deeply

export type Writable<L extends List, depth extends Depth = 'flat'> =
Cast<OWritable<L, Key, depth>, List>
WritablePart<L, depth>

@@ -6,3 +6,3 @@ import {WritableKeys as OWritableKeys} from '../Object/WritableKeys'

/**
Get the keys of **`L`** that are writable
Get the keys of `L` that are writable
@param L

@@ -9,0 +9,0 @@ @returns [[Key]]

import {IterationOf} from '../Iteration/IterationOf'
import {Iteration} from '../Iteration/Iteration'
import {Prepend} from './Prepend'
import {Next} from '../Iteration/Next'
import {Length} from './Length'
import {Pos} from '../Iteration/Pos'
import {_Reverse} from './Reverse'
import {Cast} from '../Any/Cast'

@@ -12,2 +10,3 @@ import {List} from './List'

import {Extends} from '../Any/Extends'
import {Append} from './Append'

@@ -18,4 +17,4 @@ /**

type __Zip<L extends List, L1 extends List, LN extends List = [], I extends Iteration = IterationOf<'0'>> = {
0: __Zip<L, L1, Prepend<LN, [L[Pos<I>], L1[Pos<I>]]>, Next<I>>
1: _Reverse<LN>
0: __Zip<L, L1, Append<LN, [L[Pos<I>], L1[Pos<I>]]>, Next<I>>
1: LN
}[Extends<Pos<I>, Length<L>>]

@@ -32,3 +31,3 @@

/**
Pair up the entries of **`L`** with **`L1`**
Pair up the entries of `L` with `L1`
@param L to pair up

@@ -35,0 +34,0 @@ @param L1 to pair up with

@@ -18,3 +18,3 @@ import {Length} from './Length'

type __ZipObj<LKeys extends List<Key>, LFields extends List, O extends object = {}, I extends Iteration = IterationOf<'0'>> = {
0: __ZipObj<LKeys, LFields, PatchFlat<O, Record<LKeys[Pos<I>], LFields[Pos<I>]>, 1>, Next<I>>
0: __ZipObj<LKeys, LFields, PatchFlat<O, Record<LKeys[Pos<I>], LFields[Pos<I>]>>, Next<I>>
1: O

@@ -21,0 +21,0 @@ }[Extends<Pos<I>, Length<LKeys>>]

/** @ignore *//** */
export * as JSON from './JSON/_api'
import * as JSON from './JSON/_api'
export type {JSON}
export type {BuiltInObject} from './BuiltInObject'
export type {Primitive} from './Primitive'
// LEGACY
export type {Promisable} from '../Any/Promisable'
export * as Iteration from '../Iteration/Maps/_api'

@@ -17,3 +17,3 @@ /**

type Numeric =
| Number
// | Number
// | BigInt // not needed

@@ -27,3 +27,3 @@ // | Math

type Textual =
| String
// | String
| RegExp

@@ -53,5 +53,5 @@

type Maps =
| Map<unknown, unknown>
// | Map<unknown, unknown>
// | Set<unknown>
| ReadonlyMap<unknown, unknown>
| Set<unknown>
| ReadonlySet<unknown>

@@ -78,3 +78,3 @@ | WeakMap<object, unknown>

| Generator
| GeneratorFunction
// | GeneratorFunction

@@ -81,0 +81,0 @@ /**

@@ -7,5 +7,5 @@ import {Format} from '../Iteration/Format'

Describes compatible type formats
* `b`: **`boolean`**
* `n`: **`number`**
* `s`: **`string`**
* `b`: `boolean`
* `n`: `number`
* `s`: `string`
*/

@@ -12,0 +12,0 @@ export type Formats = 'b' | 'n' | 's'

@@ -24,3 +24,3 @@ import {_Negate} from './Negate'

@param IMap to operate with another set of numbers
@returns **`string | number | boolean`**
@returns `string | number | boolean`
@example

@@ -27,0 +27,0 @@ ```ts

@@ -15,3 +15,3 @@ import {Formats} from './_Internal'

@param IMap to operate with another set of numbers
@returns **`string | number | boolean`**
@returns `string | number | boolean`
@example

@@ -18,0 +18,0 @@ ```ts

@@ -36,3 +36,3 @@ import {IterationOf} from '../Iteration/IterationOf'

@param IMap to operate with another set of numbers
@returns **`string | number | boolean`**
@returns `string | number | boolean`
@example

@@ -39,0 +39,0 @@ ```ts

@@ -13,3 +13,3 @@ import {Number} from './Number'

@param IMap to operate with another set of numbers
@returns **`string | number | boolean`**
@returns `string | number | boolean`
@example

@@ -16,0 +16,0 @@ ```ts

@@ -17,3 +17,3 @@ import {IterationOf} from '../Iteration/IterationOf'

*/
type _MinusPositive<N1 extends Iteration, N2 extends Iteration, IMap extends Map = NumberMap> = {
type _MinusPositive<N1 extends Iteration, N2 extends Iteration, IMap extends Map> = {
0: _MinusPositive<Prev<N1, IMap>, Prev<N2, IMap>, IMap> // N1 = -/+, N2 = +

@@ -64,3 +64,3 @@ 1: N1

*/
export type _Minus<N1 extends Iteration, N2 extends Iteration, IMap extends Map = NumberMap> = {
export type _Minus<N1 extends Iteration, N2 extends Iteration, IMap extends Map> = {
0: MinusPositive<N1, N2, IMap>

@@ -73,3 +73,3 @@ 1: MinusNegative<N1, N2, IMap>

*/
export type __Minus<N1 extends Number, N2 extends Number, fmt extends Formats = 's', IMap extends Map = NumberMap> =
export type __Minus<N1 extends Number, N2 extends Number, fmt extends Formats, IMap extends Map> =
Format<_Minus<IterationOf<N1, IMap>, IterationOf<N2, IMap>, IMap>, fmt>

@@ -83,3 +83,3 @@

@param IMap to operate with another set of numbers
@returns **`string | number | boolean`**
@returns `string | number | boolean`
@example

@@ -86,0 +86,0 @@ ```ts

@@ -21,3 +21,3 @@ import {_Minus} from './Minus'

@param IMap to operate with another set of numbers
@returns **`string | number | boolean`**
@returns `string | number | boolean`
@example

@@ -24,0 +24,0 @@ ```ts

@@ -17,3 +17,3 @@ import {Key} from '../Iteration/Key'

/**
Transform a **`number`** into a [[Number]]
Transform a `number` into a [[Number]]
@param N to stringify

@@ -20,0 +20,0 @@ @param IMap to operate with another set of numbers

@@ -63,3 +63,3 @@ import {IterationOf} from '../Iteration/IterationOf'

*/
export type _Plus<N1 extends Iteration, N2 extends Iteration, IMap extends Map = NumberMap> = {
export type _Plus<N1 extends Iteration, N2 extends Iteration, IMap extends Map> = {
0: PlusPositive<N1, N2, IMap>

@@ -72,3 +72,3 @@ 1: PlusNegative<N1, N2, IMap>

*/
export type __Plus<N1 extends Number, N2 extends Number, fmt extends Formats = 's', IMap extends Map = NumberMap> =
export type __Plus<N1 extends Number, N2 extends Number, fmt extends Formats, IMap extends Map> =
Format<_Plus<IterationOf<N1, IMap>, IterationOf<N2, IMap>, IMap>, fmt>

@@ -82,3 +82,3 @@

@param IMap to operate with another set of numbers
@returns **`string | number | boolean`**
@returns `string | number | boolean`
@example

@@ -85,0 +85,0 @@ ```ts

@@ -43,3 +43,3 @@ import {IterationOf} from '../Iteration/IterationOf'

*/
export type _Range<From extends Number, To extends Number, way extends Way = '->', fmt extends Formats = 's', IMap extends Map = NumberMap> =
export type _Range<From extends Number, To extends Number, way extends Way, fmt extends Formats, IMap extends Map> =
__Range<IterationOf<From, IMap>, IterationOf<To, IMap>, way, fmt, IMap> extends infer X

@@ -56,3 +56,3 @@ ? Cast<X, (string | number)[]>

@param IMap to operate with another set of numbers
@returns **`string[] | number[] | boolean[]`**
@returns `string[] | number[] | boolean[]`
@example

@@ -59,0 +59,0 @@ ```ts

/** @ignore *//** */
export * as P from './P/_api'
import * as P from './P/_api'
export type {P}
export type {Assign} from './Assign'

@@ -23,3 +25,3 @@ export type {At} from './At'

export type {ListOf} from './ListOf'
export type {Patch as Merge} from './Patch' // LEGACY
export type {Merge} from './Merge'
export type {MergeAll} from './MergeAll'

@@ -58,8 +60,1 @@ export type {Modify} from './Modify'

export type {WritableKeys} from './WritableKeys'
// LEGACY
export type {Merge as MergeUp} from './Merge'
export type {Assign as AssignUp} from './Assign'
export type {PatchAll as Compact} from './PatchAll'
export type {MergeAll as CompactUp} from './MergeAll'

@@ -19,4 +19,6 @@ /**

* `1`: ramda style. Destroys lists, does not complete if undefined types
* `2`: lodash style. Lists are narrowed down, tuples are not preserved
* `3`: ramda style. Assumes that we are only working with lists
*/
export type MergeStyle = 0 | 1
export type MergeStyle = 0 | 1 | 2

@@ -29,2 +31,2 @@ /**

[K in keyof O]: any
}
} & {}

@@ -11,2 +11,3 @@ import {Iteration} from '../Iteration/Iteration'

import {Depth, MergeStyle} from './_Internal'
import {BuiltInObject} from '../Misc/BuiltInObject'

@@ -16,4 +17,4 @@ /**

*/
type __Assign<O extends object, Os extends List<object>, depth extends Depth, style extends MergeStyle, I extends Iteration = IterationOf<'0'>> = {
0: __Assign<Merge<Os[Pos<I>], O, depth, style>, Os, depth, style, Next<I>>
type __Assign<O extends object, Os extends List<object>, depth extends Depth, style extends MergeStyle, ignore extends any, I extends Iteration = IterationOf<'0'>> = {
0: __Assign<Merge<Os[Pos<I>], O, depth, style, ignore>, Os, depth, style, ignore, Next<I>>
1: O

@@ -25,4 +26,4 @@ }[Extends<Pos<I>, Length<Os>>]

*/
export type _Assign<O extends object, Os extends List<object>, depth extends Depth, style extends MergeStyle> =
__Assign<O, Os, depth, style> extends infer X
export type _Assign<O extends object, Os extends List<object>, depth extends Depth, style extends MergeStyle, ignore extends any> =
__Assign<O, Os, depth, style, ignore> extends infer X
? Cast<X, object>

@@ -32,3 +33,3 @@ : never

/**
Assign a list of [[Object]] into **`O`** with [[Merge]]. Merges from right to
Assign a list of [[Object]] into `O` with [[Merge]]. Merges from right to
left, first items get overridden by the next ones (last-in overrides).

@@ -39,2 +40,3 @@ @param O to assign to

@param style (?=`1`) 0 = lodash, 1 = ramda
@param ignore (?=`BuiltinObject`) types not to merge
@returns [[Object]]

@@ -45,7 +47,7 @@ @example

*/
export type Assign<O extends object, Os extends List<object>, depth extends Depth = 'flat', style extends MergeStyle = 1> =
export type Assign<O extends object, Os extends List<object>, depth extends Depth = 'flat', style extends MergeStyle = 2, ignore extends any = BuiltInObject> =
O extends unknown
? Os extends unknown
? _Assign<O, Os, depth, style>
? _Assign<O, Os, depth, style, ignore>
: never
: never

@@ -15,6 +15,4 @@ import {Key} from '../Any/Key'

*/
type AtStrict<O extends object, K extends Key> =
[K & keyof O] extends [never]
? never
: O[K & keyof O] // this is so that we can query `string | number`
export type AtStrict<O extends object, K extends Key> =
O[K & keyof O] // this is so that we can query `string | number`

@@ -24,3 +22,3 @@ /**

*/
type AtLoose<O extends object, K extends Key> =
export type AtLoose<O extends object, K extends Key> =
O extends unknown

@@ -31,7 +29,7 @@ ? AtStrict<O, K>

/**
Get in **`O`** the type of a field of key **`K`**
Get in `O` the type of a field of key `K`
@param O to extract from
@param K to extract at
@param strict (?=`1`) `0` to work with unions
@returns **`any`**
@returns [[Any]]
@example

@@ -38,0 +36,0 @@ ```ts

@@ -33,3 +33,3 @@ import {_Omit} from './Omit'

/**
Make that at least one of the keys **`K`** are required in **`O`** at a time.
Make that at least one of the keys `K` are required in `O` at a time.
@param O to make required

@@ -36,0 +36,0 @@ @param K (?=`keyof O`) to choose fields

@@ -1,8 +0,7 @@

import {Pick} from './Pick'
import {_Pick} from './Pick'
import {Depth} from './_Internal'
import {Key} from '../Any/Key'
import {Contains} from '../Any/Contains'
import {NonNullable} from '../Union/NonNullable'
import {Keys} from './Keys'
import {PatchFlat} from './Patch'
import {_PatchFlat} from './Patch'
import {BuiltInObject} from '../Misc/BuiltInObject'

@@ -20,3 +19,5 @@ /**

export type CompulsoryDeep<O> = {
[K in keyof O]-?: CompulsoryDeep<NonNullable<O[K]>>
[K in keyof O]-?: O[K] extends BuiltInObject
? O[K]
: CompulsoryDeep<NonNullable<O[K]>>
}

@@ -27,3 +28,3 @@

*/
type CompulsoryPart<O extends object, depth extends Depth> = {
export type CompulsoryPart<O extends object, depth extends Depth> = {
'flat': CompulsoryFlat<O>,

@@ -34,3 +35,9 @@ 'deep': CompulsoryDeep<O>,

/**
Make that **`L`**'s fields cannot be [[Nullable]] or [[Optional]] (it's like
* @hidden
*/
export type _Compulsory<O extends object, K extends Key, depth extends Depth> =
_PatchFlat<CompulsoryPart<_Pick<O, K>, depth>, O, 2>
/**
Make that `O`'s fields cannot be [[Nullable]] or [[Optional]] (it's like
[[Required]] & [[NonNullable]] at once).

@@ -45,6 +52,5 @@ @param O to make compulsory

*/
export type Compulsory<O extends object, K extends Key = Key, depth extends Depth = 'flat'> = {
1: CompulsoryPart<O, depth>
0: PatchFlat<CompulsoryPart<Pick<O, K>, depth>, O, 1>
// Pick a part of O (with K) -> nullable -> merge it with O
}[Contains<Keys<O>, K>] & {}
export type Compulsory<O extends object, K extends Key = Key, depth extends Depth = 'flat'> =
O extends unknown
? _Compulsory<O, K, depth>
: never

@@ -1,3 +0,1 @@

import {Key} from '../Any/Key'
/**

@@ -7,9 +5,9 @@ @hidden

export type _CompulsoryKeys<O extends object> = {
[K in keyof O]: [O[K] & (undefined | null)] extends [never]
? K
: never
[K in keyof O]-?: [O[K] & (undefined | null)] extends [never]
? K
: never
}[keyof O]
/**
Get the keys of **`O`** that are [[Compulsory]]
Get the keys of `O` that are [[Compulsory]]

@@ -24,6 +22,4 @@ (⚠️ needs `--strictNullChecks` enabled)

export type CompulsoryKeys<O extends object> =
(
O extends unknown
? _CompulsoryKeys<O>
: never
) & Key
O extends unknown
? _CompulsoryKeys<O>
: never

@@ -6,4 +6,4 @@ import {Exclude} from './Exclude'

/**
Get an [[Object]] that is the difference between **`O`** & **`O1`**
(**`O`**'s differences have priority over **`O1`**'s if fields overlap)
Get an [[Object]] that is the difference between `O` & `O1`
(`O`'s differences have priority over `O1`'s if fields overlap)
(If `match = 'default'`, no type checks are done)

@@ -36,2 +36,2 @@ @param O to check differences with

export type Diff<O extends object, O1 extends object, match extends Match = 'default'> =
PatchFlat<Exclude<O, O1, match>, Exclude<O1, O, match>, 1>
PatchFlat<Exclude<O, O1, match>, Exclude<O1, O, match>>

@@ -37,3 +37,3 @@ import {_Omit} from './Omit'

/**
Split **`O`** into a [[Union]] with **`K`** keys in such a way that none of
Split `O` into a [[Union]] with `K` keys in such a way that none of
the keys are ever present with one another within the different unions.

@@ -40,0 +40,0 @@ @param O to split

@@ -6,3 +6,3 @@ import {ExcludeKeys} from './ExcludeKeys'

/**
Exclude the fields of **`O1`** out of **`O`**
Exclude the fields of `O1` out of `O`
(If `match = 'default'`, no type checks are done)

@@ -9,0 +9,0 @@ @param O to remove from

@@ -6,3 +6,2 @@ import {Exclude} from '../Union/Exclude'

import {Keys} from './Keys'
import {Key} from '../Any/Key'

@@ -13,3 +12,3 @@ /**

export type _ExcludeMatch<O extends object, O1 extends object, match extends Match> = {
[K in keyof O]: {
[K in keyof O]-?: {
1: never

@@ -24,10 +23,8 @@ 0: K

type ExcludeMatch<O extends object, O1 extends object, match extends Match> =
(
O extends unknown
? _ExcludeMatch<O, O1, match>
: never
) & Key
O extends unknown
? _ExcludeMatch<O, O1, match>
: never
/**
Exclude the keys of **`O1`** out of the keys of **`O`**
Exclude the keys of `O1` out of the keys of `O`
(If `match = 'default'`, no type checks are done)

@@ -46,7 +43,5 @@ @param O to remove the keys from

'extends->' : ExcludeMatch<O, O1, 'extends->'>
'implements->': ExcludeMatch<O, O1, 'implements->'>
'<-contains' : ExcludeMatch<O, O1, '<-contains'>
'<-extends' : ExcludeMatch<O, O1, '<-extends'>
'<-implements': ExcludeMatch<O, O1, '<-implements'>
'equals' : ExcludeMatch<O, O1, 'equals'>
}[match]

@@ -6,3 +6,3 @@ import {FilterKeys} from './FilterKeys'

/**
Filter out of **`O`** the fields that match **`M`**
Filter out of `O` the fields that match `M`
@param O to remove from

@@ -9,0 +9,0 @@ @param M to select fields

import {Match} from '../Any/_Internal'
import {Is} from '../Any/Is'
import {Key} from '../Any/Key'

@@ -8,4 +7,4 @@ /**

*/
export type _FilterKeys<O extends object, M extends any, match extends Match = 'default'> = {
[K in keyof O]: {
export type _FilterKeys<O extends object, M extends any, match extends Match> = {
[K in keyof O]-?: {
1: never

@@ -17,3 +16,3 @@ 0: K

/**
Filter out the keys of **`O`** which fields match **`M`**
Filter out the keys of `O` which fields match `M`
@param O to remove from

@@ -28,6 +27,4 @@ @param M to select fields

export type FilterKeys<O extends object, M extends any, match extends Match = 'default'> =
(
O extends unknown
? _FilterKeys<O, M, match>
: never
) & Key
O extends unknown
? _FilterKeys<O, M, match>
: never

@@ -7,3 +7,3 @@ import {Match} from '../Any/_Internal'

/**
Check whether **`O`** has a field of key **`K`** that matches **`M`**
Check whether `O` has a field of key `K` that matches `M`
@param O to be inspected

@@ -10,0 +10,0 @@ @param K to choose field

@@ -8,3 +8,3 @@ import {Match} from '../Any/_Internal'

/**
Check whether **`O`** has nested properties that match **`M`**
Check whether `O` has nested properties that match `M`
@param O to be inspected

@@ -11,0 +11,0 @@ @param Path to be followed

@@ -5,3 +5,3 @@ import {SelectKeys} from './SelectKeys'

/**
Check whether **`O`** has fields that match **`M`**
Check whether `O` has fields that match `M`
@param O to be inspected

@@ -8,0 +8,0 @@ @param M to check field type

@@ -6,3 +6,3 @@ import {IntersectKeys} from './IntersectKeys'

/**
Get the intersecting fields of **`O`** & **`O1`**
Get the intersecting fields of `O` & `O1`
(If `match = 'default'`, no type checks are done)

@@ -9,0 +9,0 @@ @param O to check similarities with

@@ -6,3 +6,2 @@ import {Intersect} from '../Union/Intersect'

import {Keys} from './Keys'
import {Key} from '../Any/Key'

@@ -13,3 +12,3 @@ /**

export type _IntersectMatch<O extends object, O1 extends object, match extends Match> = {
[K in keyof O]: {
[K in keyof O]-?: {
1: K

@@ -24,10 +23,8 @@ 0: never

type IntersectMatch<O extends object, O1 extends object, match extends Match> =
(
O extends unknown
? _IntersectMatch<O, O1, match>
: never
) & Key
O extends unknown
? _IntersectMatch<O, O1, match>
: never
/**
Get the intersecting keys of **`O`** & **`O1`**
Get the intersecting keys of `O` & `O1`
(If `match = 'default'`, no type checks are done)

@@ -45,7 +42,5 @@ @param O to check similarities with

'extends->' : IntersectMatch<O, O1, 'extends->'>
'implements->': IntersectMatch<O, O1, 'implements->'>
'<-contains' : IntersectMatch<O, O1, '<-contains'>
'<-extends' : IntersectMatch<O, O1, '<-extends'>
'<-implements': IntersectMatch<O, O1, '<-implements'>
'equals' : IntersectMatch<O, O1, 'equals'>
}[match]
import {IterationOf} from '../Iteration/IterationOf'
import {Iteration} from '../Iteration/Iteration'
import {Cast} from '../Any/Cast'
import {Key} from '../Iteration/Key'
import {Next} from '../Iteration/Next'
import {_Append} from '../List/Append'
import {Append} from '../List/Append'
import {Exclude} from '../Union/Exclude'
import {List} from '../List/List'
import {Extends} from '../Any/_api'
import {Extends} from '../Any/Extends'
import {At} from './At'

@@ -16,3 +16,3 @@ /**

Key<I> extends keyof O
? _Append<LN, O[Cast<Key<I>, keyof O>]>
? Append<LN, O[Key<I> & keyof O]>
: LN

@@ -31,6 +31,10 @@

*/
export type __ListOf<O extends object> =
type __ListOf<O extends object> =
number extends keyof O
? O[never][]
: ___ListOf<O, keyof O>
? At<O, number>[]
: string extends keyof O
? At<O, string>[]
: symbol extends keyof O
? At<O, symbol>[]
: ___ListOf<O, keyof O>

@@ -41,5 +45,3 @@ /**

export type _ListOf<O extends object> =
__ListOf<O> extends infer X
? Cast<X, List>
: never
__ListOf<O>

@@ -46,0 +48,0 @@ /**

import {AtBasic} from './At'
import {OptionalKeys} from './OptionalKeys'
import {_OptionalKeys} from './OptionalKeys'
import {Key} from '../Any/Key'
import {Extends} from '../Any/Extends'
import {Or} from '../Boolean/Or'
import {ObjectOf} from '../List/ObjectOf'
import {ListOf} from './ListOf'
import {_ListOf} from './ListOf'
import {List} from '../List/List'
import {Depth, Anyfy, MergeStyle} from './_Internal'
import {NonNullable} from '../Union/NonNullable'
import {BuiltInObject} from '../Misc/BuiltInObject'
import {ObjectOf} from '../List/ObjectOf'
import {Compute} from '../Any/Compute'

@@ -16,10 +14,36 @@ /**

*/
type LibStyle<Merged, O, O1, style extends MergeStyle> = {
// for lodash, we preserve (restore) arrays like it does
// this (heavy) version is able to 100% preserve tuples
0: [O] extends [List]
? [O1] extends [List]
? _ListOf<Merged & {}>
: O
: Merged
// for ramda, there is nothing to do, lists are destroyed
// so here `NoList` did that job and we don't restore them
1: Merged
// this default behaves like lodash, it preserves arrays
// but its way lighter because it does not restore tuples
2: [O] extends [List]
? [O1] extends [List]
? Merged[keyof Merged][]
: O
: Merged
}[style]
/**
@hidden
*/
type MergeProp<OK, O1K, K extends Key, OOK extends Key, style extends MergeStyle> =
K extends OOK // if prop of `O` is optional
? NonNullable<OK> | O1K // merge it with prop of `O1`
? Exclude<OK, undefined> | O1K // merge it with prop of `O1`
: [OK] extends [never] // if it does not exist
? O1K // complete with prop of `O1`
: {
1: OK extends undefined ? OK : OK // ramda : keep undefined
0: OK extends undefined ? O1K : OK // lodash: fill undefined
1: OK // ramda : keep undefined
2: OK extends undefined ? O1K : OK // lodash: fill undefined
}[style]

@@ -30,6 +54,5 @@

*/
type NoList<A> =
A extends List
? ObjectOf<A>
: A
type __MergeFlat<O extends object, O1 extends object, style extends MergeStyle, OOK extends Key = _OptionalKeys<O>> = {
[K in keyof (Anyfy<O> & O1)]: MergeProp<AtBasic<O, K>, AtBasic<O1, K>, K, OOK, style>
} & {}

@@ -39,6 +62,4 @@ /**

*/
type __MergeFlat<O extends object, O1 extends object, style extends MergeStyle, OOK extends Key = OptionalKeys<O>> =
O extends unknown ? O1 extends unknown ? {
[K in keyof (Anyfy<O> & O1)]: MergeProp<AtBasic<O, K>, AtBasic<O1, K>, K, OOK, style>
} & {} : never : never
export type _MergeFlat<O extends object, O1 extends object, style extends MergeStyle> =
LibStyle<__MergeFlat<ObjectOf<O>, ObjectOf<O1>, style>, O, O1, style>

@@ -48,11 +69,8 @@ /**

*/
type _MergeFlat<O extends object, O1 extends object, style extends MergeStyle> =
// when we merge, we systematically remove inconvenient array methods
__MergeFlat<NoList<O>, NoList<O1>, style> extends infer X
? { // so that we can merge `object` and arrays in the very same way
1: X // ramda
0: Extends<O, List> extends 1 ? ListOf<X & {}> : X // lodash
}[style] // for lodash, we preserve (restore) arrays like it does
// arrays are broken with `NoArray`, restored by `ListOf`
: never
export type MergeFlat<O extends object, O1 extends object, style extends MergeStyle, ignore> =
O extends ignore
? O
: O1 extends ignore
? O
: _MergeFlat<O, O1, style>

@@ -62,4 +80,5 @@ /**

*/
export type MergeFlat<O extends object, O1 extends object, style extends MergeStyle> =
_MergeFlat<O, O1, style> & {}
type __MergeDeep<O extends object, O1 extends object, style extends MergeStyle, ignore, OOK extends Key = _OptionalKeys<O>> = {
[K in keyof (Anyfy<O> & O1)]: _MergeDeep<AtBasic<O, K>, AtBasic<O1, K>, K, OOK, style, ignore>
}

@@ -69,21 +88,12 @@ /**

*/
type ___MergeDeep<O extends object, O1 extends object, style extends MergeStyle, OOK extends Key = OptionalKeys<O>> = {
[K in keyof (Anyfy<O> & O1)]: _MergeDeep<AtBasic<O, K>, AtBasic<O1, K>, K, OOK, style>
} // ! do not distribute here as the step earlier is a distribution already
/**
@hidden
*/
type __MergeDeep<OK, O1K, K extends Key, OOK extends Key, style extends MergeStyle> =
Or<Extends<[OK], [never]>, Extends<[O1K], [never]>> extends 1 // filter fallthrough `never`
type ChooseMergeDeep<OK, O1K, K extends Key, OOK extends Key, style extends MergeStyle, ignore> =
OK extends ignore
? MergeProp<OK, O1K, K, OOK, style>
: OK extends BuiltInObject
: O1K extends ignore
? MergeProp<OK, O1K, K, OOK, style>
: O1K extends BuiltInObject
? MergeProp<OK, O1K, K, OOK, style>
: OK extends object
? O1K extends object
? ___MergeDeep<OK, O1K, style>
: MergeProp<OK, O1K, K, OOK, style>
: OK extends object
? O1K extends object
? __MergeDeep<ObjectOf<OK>, ObjectOf<O1K>, style, ignore>
: MergeProp<OK, O1K, K, OOK, style>
: MergeProp<OK, O1K, K, OOK, style>

@@ -93,11 +103,8 @@ /**

*/
type _MergeDeep<O, O1, K extends Key, OOK extends Key, style extends MergeStyle> =
// when we merge, we systematically remove inconvenient array methods
__MergeDeep<NoList<O>, NoList<O1>, K, OOK, style> extends infer X
? { // so that we can merge `object` and arrays in the very same way
1: X // ramda
0: Extends<O | O1, List> extends 1 ? ListOf<X & {}> : X // lodash
}[style] // for lodash, we preserve (restore) arrays like it does
// arrays are broken with `NoList`, restored by `ListOf`
: never
export type _MergeDeep<O, O1, K extends Key, OOK extends Key, style extends MergeStyle, ignore> =
[O] extends [never]
? MergeProp<O, O1, K, OOK, style>
: [O1] extends [never]
? MergeProp<O, O1, K, OOK, style>
: LibStyle<ChooseMergeDeep<O, O1, K, OOK, style, ignore>, O, O1, style>

@@ -107,7 +114,12 @@ /**

*/
export type MergeDeep<O extends object, O1 extends object, style extends MergeStyle> =
_MergeDeep<O, O1, never, never, style> & {}
export type MergeDeep<O, O1, style extends MergeStyle, ignore> =
O extends unknown
? O1 extends unknown
// give `K` and `OOK` dummy types `x` and `y`
? _MergeDeep<O, O1, 'x', 'y', style, ignore>
: never
: never
/**
Accurately merge the fields of **`O`** with the ones of **`O1`**. It is
Accurately merge the fields of `O` with the ones of `O1`. It is
equivalent to the spread operator in JavaScript. [[Union]]s and [[Optional]]

@@ -121,2 +133,3 @@ fields will be handled gracefully.

@param style (?=`1`) 0 = lodash, 1 = ramda
@param ignore (?=`BuiltinObject`) types not to merge
@returns [[Object]]

@@ -159,5 +172,5 @@ @example

*/
export type Merge<O extends object, O1 extends object, depth extends Depth = 'flat', style extends MergeStyle = 1> = {
'flat': MergeFlat<O, O1, style>
'deep': MergeDeep<O, O1, style>
export type Merge<O extends object, O1 extends object, depth extends Depth = 'flat', style extends MergeStyle = 2, ignore = BuiltInObject> = {
'flat': MergeFlat<O, O1, style, ignore>
'deep': Compute<MergeDeep<O, O1, style, ignore>>
}[depth]

@@ -11,2 +11,3 @@ import {Iteration} from '../Iteration/Iteration'

import {Depth, MergeStyle} from './_Internal'
import {BuiltInObject} from '../Misc/BuiltInObject'

@@ -16,4 +17,4 @@ /**

*/
type __MergeAll<O extends object, Os extends List<object>, depth extends Depth, style extends MergeStyle, I extends Iteration = IterationOf<'0'>> = {
0: __MergeAll<Merge<O, Os[Pos<I>], depth, style>, Os, depth, style, Next<I>>
type __MergeAll<O extends object, Os extends List<object>, depth extends Depth, style extends MergeStyle, ignore extends any, I extends Iteration = IterationOf<'0'>> = {
0: __MergeAll<Merge<O, Os[Pos<I>], depth, style, ignore>, Os, depth, style, ignore, Next<I>>
1: O

@@ -25,4 +26,4 @@ }[Extends<Pos<I>, Length<Os>>]

*/
export type _MergeAll<O extends object, Os extends List<object>, depth extends Depth, style extends MergeStyle> =
__MergeAll<O, Os, depth, style> extends infer X
export type _MergeAll<O extends object, Os extends List<object>, depth extends Depth, style extends MergeStyle, ignore extends any> =
__MergeAll<O, Os, depth, style, ignore> extends infer X
? Cast<X, object>

@@ -32,3 +33,3 @@ : never

/**
[[Merge]] a list of [[Object]]s into **`O`**. Merges from left to right, first
[[Merge]] a list of [[Object]]s into `O`. Merges from left to right, first
items get completed by the next ones (last-in completes).

@@ -39,2 +40,3 @@ @param O to start with

@param style (?=`1`) 0 = lodash, 1 = ramda
@param ignore (?=`BuiltinObject`) types not to merge
@returns [[Object]]

@@ -45,7 +47,7 @@ @example

*/
export type MergeAll<O extends object, Os extends List<object>, depth extends Depth = 'flat', style extends MergeStyle = 1> =
export type MergeAll<O extends object, Os extends List<object>, depth extends Depth = 'flat', style extends MergeStyle = 2, ignore extends any = BuiltInObject> =
O extends unknown
? Os extends unknown
? _MergeAll<O, Os, depth, style>
? _MergeAll<O, Os, depth, style, ignore>
: never
: never

@@ -7,3 +7,3 @@ import {At} from './At'

/**
Modify **`O`** with **`OMod`** & the [[x]] placeholder
Modify `O` with `OMod` & the [[x]] placeholder
@param O to copy from

@@ -10,0 +10,0 @@ @param OMod to copy to

import {NonNullable as UNonNullable} from '../Union/NonNullable'
import {Depth} from './_Internal'
import {Pick} from './Pick'
import {_Pick} from './Pick'
import {Key} from '../Any/Key'
import {Contains} from '../Any/Contains'
import {Keys} from './Keys'
import {PatchFlat} from './Patch'
import {_PatchFlat} from './Patch'
import {BuiltInObject} from '../Misc/BuiltInObject'

@@ -20,3 +19,5 @@ /**

export type NonNullableDeep<O> = {
[K in keyof O]: NonNullableDeep<UNonNullable<O[K]>>
[K in keyof O]: O[K] extends BuiltInObject
? O[K]
: NonNullableDeep<UNonNullable<O[K]>>
}

@@ -27,3 +28,3 @@

*/
type NonNullablePart<O extends object, depth extends Depth> = {
export type NonNullablePart<O extends object, depth extends Depth> = {
'flat': NonNullableFlat<O>,

@@ -34,4 +35,10 @@ 'deep': NonNullableDeep<O>,

/**
Make some fields of **`O`** not nullable (deeply or not)
(Optional fields will be left untouched & **`undefined`**)
* @hidden
*/
export type _NonNullable<O extends object, K extends Key, depth extends Depth> =
_PatchFlat<NonNullablePart<_Pick<O, K>, depth>, O, 2>
/**
Make some fields of `O` not nullable (deeply or not)
(Optional fields will be left untouched & `undefined`)
@param O to make non nullable

@@ -45,6 +52,5 @@ @param K (?=`Key`) to choose fields

*/
export type NonNullable<O extends object, K extends Key = Key, depth extends Depth = 'flat'> = {
1: NonNullablePart<O, depth>
0: PatchFlat<NonNullablePart<Pick<O, K>, depth>, O, 1>
// Pick a part of O (with K) -> non-nullable -> merge it with O
}[Contains<Keys<O>, K>] & {}
export type NonNullable<O extends object, K extends Key = Key, depth extends Depth = 'flat'> =
O extends unknown
? _NonNullable<O, K, depth>
: never

@@ -1,3 +0,1 @@

import {Key} from '../Any/Key'
/**

@@ -7,9 +5,9 @@ @hidden

export type _NonNullableKeys<O extends object> = {
[K in keyof O]: [O[K] & (undefined | null)] extends [never]
? K
: never
[K in keyof O]-?: [O[K] & (undefined | null)] extends [never]
? K
: never
}[keyof O]
/**
Get the keys of **`O`** that are non-nullable
Get the keys of `O` that are non-nullable

@@ -24,6 +22,4 @@ (⚠️ needs `--strictNullChecks` enabled)

export type NonNullableKeys<O extends object> =
(
O extends unknown
? _NonNullableKeys<O>
: never
) & Key
O extends unknown
? _NonNullableKeys<O>
: never
import {Nullable as UNullable} from '../Union/Nullable'
import {Depth} from './_Internal'
import {Pick} from './Pick'
import {_Pick} from './Pick'
import {Key} from '../Any/Key'
import {Contains} from '../Any/Contains'
import {Keys} from './Keys'
import {PatchFlat} from './Patch'
import {_PatchFlat} from './Patch'

@@ -32,3 +30,9 @@ /**

/**
Make some fields of **`O`** nullable (deeply or not)
* @hidden
*/
export type _Nullable<O extends object, K extends Key, depth extends Depth> =
_PatchFlat<NullablePart<_Pick<O, K>, depth>, O, 2>
/**
Make some fields of `O` nullable (deeply or not)
@param O to make nullable

@@ -42,6 +46,6 @@ @param K (?=`Key`) to choose fields

*/
export type Nullable<O extends object, K extends Key = Key, depth extends Depth = 'flat'> = {
1: NullablePart<O, depth>
0: PatchFlat<NullablePart<Pick<O, K>, depth>, O, 1>
// Pick a part of O (with K) -> nullable -> merge it with O
}[Contains<Keys<O>, K>] & {}
export type Nullable<O extends object, K extends Key = Key, depth extends Depth = 'flat'> =
O extends unknown
? _Nullable<O, K, depth>
: never

@@ -1,3 +0,1 @@

import {Key} from '../Any/Key'
/**

@@ -7,9 +5,9 @@ @hidden

export type _NullableKeys<O extends object> = {
[K in keyof O]: [O[K] & (undefined | null)] extends [never]
? never
: K
[K in keyof O]-?: [O[K] & (undefined | null)] extends [never]
? never
: K
}[keyof O]
/**
Get the keys of **`O`** that are nullable
Get the keys of `O` that are nullable

@@ -24,6 +22,4 @@ (⚠️ needs `--strictNullChecks` enabled)

export type NullableKeys<O extends object> =
(
O extends unknown
? _NullableKeys<O>
: never
) & Key
O extends unknown
? _NullableKeys<O>
: never
import {_Pick} from './Pick'
import {Exclude} from '../Union/Exclude'
import {Key} from '../Any/Key'
import {Keys} from './Keys'

@@ -10,6 +9,6 @@ /**

export type _Omit<O extends object, K extends Key> =
_Pick<O, Exclude<Keys<O>, K>>
_Pick<O, Exclude<keyof O, K>>
/**
Remove out of **`O`** the fields of key **`K`**
Remove out of `O` the fields of key `K`
@param O to remove from

@@ -16,0 +15,0 @@ @param K to chose fields

@@ -1,7 +0,6 @@

import {Pick} from './Pick'
import {_Pick} from './Pick'
import {Depth} from './_Internal'
import {Key} from '../Any/Key'
import {Contains} from '../Any/Contains'
import {Keys} from './Keys'
import {PatchFlat} from './Patch'
import {_PatchFlat} from './Patch'
import {BuiltInObject} from '../Misc/BuiltInObject'

@@ -19,3 +18,5 @@ /**

export type OptionalDeep<O> = {
[K in keyof O]?: OptionalDeep<O[K]>
[K in keyof O]?: O[K] extends BuiltInObject
? O[K]
: OptionalDeep<O[K]>
}

@@ -32,3 +33,9 @@

/**
Make some fields of **`O`** optional (deeply or not)
* @hidden
*/
export type _Optional<O extends object, K extends Key, depth extends Depth> =
_PatchFlat<OptionalPart<_Pick<O, K>, depth>, O, 2>
/**
Make some fields of `O` optional (deeply or not)
@param O to make optional

@@ -42,6 +49,5 @@ @param K (?=`Key`) to choose fields

*/
export type Optional<O extends object, K extends Key = Key, depth extends Depth = 'flat'> = {
1: OptionalPart<O, depth>
0: PatchFlat<OptionalPart<Pick<O, K>, depth>, O, 1>
// Pick a part of O (with K) -> nullable -> merge it with O
}[Contains<Keys<O>, K>] & {}
export type Optional<O extends object, K extends Key = Key, depth extends Depth = 'flat'> =
O extends unknown
? _Optional<O, K, depth>
: never

@@ -1,3 +0,1 @@

import {Key} from '../Any/Key'
/**

@@ -13,3 +11,3 @@ @hidden

/**
Get the keys of **`O`** that are optional
Get the keys of `O` that are optional
@param O

@@ -22,6 +20,4 @@ @returns [[Key]]

export type OptionalKeys<O extends object> =
(
O extends unknown
? _OptionalKeys<O>
: never
) & Key
O extends unknown
? _OptionalKeys<O>
: never
/**
Update the fields of **`O`** with the ones of **`O1`**
Update the fields of `O` with the ones of `O1`
(only the existing fields will be updated)

@@ -4,0 +4,0 @@ @param O to update

@@ -43,3 +43,3 @@ import {IterationOf} from '../../Iteration/IterationOf'

/**
Complete the fields of **`O`** at **`Path`** with the ones of **`O1`**
Complete the fields of `O` at `Path` with the ones of `O1`
@param O to complete

@@ -59,1 +59,3 @@ @param Path to be followed

}[list]
// TODO: deprecate list option and integrate noMerge

@@ -42,3 +42,3 @@ import {IterationOf} from '../../Iteration/IterationOf'

/**
Remove out of **`O`** the fields at **`Path`**
Remove out of `O` the fields at `Path`
@param O to remove from

@@ -45,0 +45,0 @@ @param Path to be followed

@@ -10,2 +10,3 @@ import {IterationOf} from '../../Iteration/IterationOf'

import {Boolean} from '../../Boolean/Boolean'
import {_ListOf} from '../ListOf'

@@ -15,5 +16,13 @@ /**

*/
type Action<O extends object, Path extends List<Key>, I extends Iteration = IterationOf<'0'>> =
O extends List
? _ListOf<_OPick<O, Path[Pos<I>]>>
: _OPick<O, Path[Pos<I>]>
/**
@hidden
*/
type PickObject<O, Path extends List<Key>, I extends Iteration = IterationOf<'0'>> =
O extends object // If it's an object
? _OPick<O, Path[Pos<I>]> extends infer Picked // Pick the current index
? Action<O, Path, I> extends infer Picked // Pick the current index
? Pos<I> extends LastIndex<Path> // If it's the last index

@@ -44,3 +53,3 @@ ? Picked // Return the picked object

/**
Extract out of **`O`** the fields at **`Path`**
Extract out of `O` the fields at `Path`
@param O to extract from

@@ -58,1 +67,3 @@ @param Path to be followed

}[list]
// todo propagate this new way of doing, remove mcpower version

@@ -43,3 +43,3 @@ import {IterationOf} from '../../Iteration/IterationOf'

/**
Make some fields of **`O`** readonly at **`Path`** (deeply or not)
Make some fields of `O` readonly at `Path` (deeply or not)
@param O to make readonly

@@ -46,0 +46,0 @@ @param Path to be followed

@@ -47,3 +47,3 @@ import {Modx} from '../_Internal'

/**
Create an object filled with **`A`** for the fields at the end of **`Path`**
Create an object filled with `A` for the fields at the end of `Path`
@param Path to choose fields

@@ -50,0 +50,0 @@ @param A to fill fields with

@@ -28,3 +28,3 @@ import {IterationOf} from '../../Iteration/IterationOf'

/**
Update in **`O`** the fields at **`Path`** with **`A`**
Update in `O` the fields at `Path` with `A`
@param O to update

@@ -31,0 +31,0 @@ @param Path to be followed

@@ -5,3 +5,3 @@ import {OptionalPart} from './Optional'

/**
Make all fields of **`O`** optional (deeply or not)
Make all fields of `O` optional (deeply or not)
@param O to make optional

@@ -8,0 +8,0 @@ @param depth (?=`'flat'`) to do it deeply

import {AtBasic} from './At'
import {Key} from '../Any/Key'
import {Extends} from '../Any/Extends'
import {ObjectOf} from '../List/ObjectOf'
import {ListOf} from './ListOf'
import {_ListOf} from './ListOf'
import {List} from '../List/List'
import {Depth, MergeStyle} from './_Internal'
import {BuiltInObject} from '../Misc/BuiltInObject'
import {Omit} from './Omit'
import {Keys} from './Keys'
import {_Omit} from './Omit'
import {ObjectOf} from '../List/ObjectOf'
import {Compute} from '../Any/Compute'

@@ -15,2 +14,27 @@ /**

*/
type LibStyle<Merged, O, O1, style extends MergeStyle> = {
// for lodash, we preserve (restore) arrays like it does
// this (heavy) version is able to 100% preserve tuples
0: [O] extends [List]
? [O1] extends [List]
? _ListOf<Merged & {}>
: O
: Merged
// for ramda, there is nothing to do, lists are destroyed
// so here `NoList` did that job and we don't restore them
1: Merged
// this default behaves like lodash, it preserves arrays
// but its way lighter because it does not restore tuples
2: [O] extends [List]
? [O1] extends [List]
? Merged[keyof Merged][]
: O
: Merged
}[style]
/**
@hidden
*/
type PatchProp<OK, O1K, K extends Key, OOK extends Key> =

@@ -24,6 +48,5 @@ K extends OOK // if prop of `O` is optional

*/
type NoList<A> =
A extends List
? ObjectOf<A>
: A
type __PatchFlat<O extends object, O1 extends object, OOK extends Key = keyof O> = {
[K in keyof (O & _Omit<O1, OOK>)]: PatchProp<AtBasic<O, K>, AtBasic<O1, K>, K, OOK>
} & {}

@@ -33,6 +56,4 @@ /**

*/
type __PatchFlat<O extends object, O1 extends object, OOK extends Key = Keys<O>> =
O extends unknown ? O1 extends unknown ? {
[K in keyof (O & Omit<O1, keyof O>)]: PatchProp<AtBasic<O, K>, AtBasic<O1, K>, K, OOK>
} & {} : never : never
export type _PatchFlat<O extends object, O1 extends object, style extends MergeStyle> =
LibStyle<__PatchFlat<ObjectOf<O>, ObjectOf<O1>>, O, O1, style>

@@ -42,11 +63,8 @@ /**

*/
type _PatchFlat<O extends object, O1 extends object, style extends MergeStyle> =
// when we merge, we systematically remove inconvenient array methods
__PatchFlat<NoList<O>, NoList<O1>> extends infer X
? { // so that we can merge `object` and arrays in the very same way
1: X // ramda
0: Extends<O, List> extends 1 ? ListOf<X & {}> : X // lodash
}[style] // for lodash, we preserve (restore) arrays like it does
// arrays are broken with `NoArray`, restored by `ListOf`
: never
export type PatchFlat<O extends object, O1 extends object, style extends MergeStyle = 2, ignore = BuiltInObject> =
O extends ignore
? O
: O1 extends ignore
? O
: _PatchFlat<O, O1, style>

@@ -56,4 +74,5 @@ /**

*/
export type PatchFlat<O extends object, O1 extends object, style extends MergeStyle> =
_PatchFlat<O, O1, style> & {}
type __PatchDeep<O extends object, O1 extends object, style extends MergeStyle, ignore, OOK extends Key = keyof O> = {
[K in keyof (O & _Omit<O1, OOK>)]: _PatchDeep<AtBasic<O, K>, AtBasic<O1, K>, K, OOK, style, ignore>
}

@@ -63,19 +82,12 @@ /**

*/
type ___PatchDeep<O extends object, O1 extends object, style extends MergeStyle, OOK extends Key = Keys<O>> = {
[K in keyof (O & Omit<O1, keyof O>)]: _PatchDeep<AtBasic<O, K>, AtBasic<O1, K>, K, OOK, style>
} // ! do not distribute here as the step earlier is a distribution already
/**
@hidden
*/
type __PatchDeep<OK, O1K, K extends Key, OOK extends Key, style extends MergeStyle> =
[OK] extends [BuiltInObject]
type ChoosePatchDeep<OK, O1K, K extends Key, OOK extends Key, style extends MergeStyle, ignore> =
OK extends ignore
? PatchProp<OK, O1K, K, OOK>
: O1K extends ignore
? PatchProp<OK, O1K, K, OOK>
: [O1K] extends [BuiltInObject]
? PatchProp<OK, O1K, K, OOK>
: [OK] extends [object]
? [O1K] extends [object]
? ___PatchDeep<OK, O1K, style>
: PatchProp<OK, O1K, K, OOK>
: OK extends object
? O1K extends object
? __PatchDeep<ObjectOf<OK>, ObjectOf<O1K>, style, ignore>
: PatchProp<OK, O1K, K, OOK>
: PatchProp<OK, O1K, K, OOK>

@@ -85,11 +97,8 @@ /**

*/
type _PatchDeep<O, O1, K extends Key, OOK extends Key, style extends MergeStyle> =
// when we merge, we systematically remove inconvenient array methods
__PatchDeep<NoList<O>, NoList<O1>, K, OOK, style> extends infer X
? { // so that we can merge `object` and arrays in the very same way
1: X // ramda
0: Extends<O | O1, List> extends 1 ? ListOf<X & {}> : X // lodash
}[style] // for lodash, we preserve (restore) arrays like it does
// arrays are broken with `NoList`, restored by `ListOf`
: never
export type _PatchDeep<O, O1, K extends Key, OOK extends Key, style extends MergeStyle, ignore> =
[O] extends [never]
? PatchProp<O, O1, K, OOK>
: [O1] extends [never]
? PatchProp<O, O1, K, OOK>
: LibStyle<ChoosePatchDeep<O, O1, K, OOK, style, ignore>, O, O1, style>

@@ -99,7 +108,12 @@ /**

*/
export type PatchDeep<O extends object, O1 extends object, style extends MergeStyle> =
_PatchDeep<O, O1, never, never, style> & {}
export type PatchDeep<O, O1, style extends MergeStyle, ignore> =
O extends unknown
? O1 extends unknown
// give `K` and `OOK` dummy types `x` and `y`
? _PatchDeep<O, O1, 'x', 'y', style, ignore>
: never
: never
/**
Complete the fields of **`O`** with the ones of **`O1`**. This is a version of
Complete the fields of `O` with the ones of `O1`. This is a version of
[[Merge]] that does NOT handle optional fields, it only completes fields of `O`

@@ -111,2 +125,3 @@ with the ones of `O1`.

@param style (?=`1`) 0 = lodash, 1 = ramda
@param ignore (?=`BuiltinObject`) types not to merge
@returns [[Object]]

@@ -149,6 +164,5 @@ @example

*/
export type Patch<O extends object, O1 extends object, depth extends Depth = 'flat', style extends MergeStyle = 1> = {
'flat': PatchFlat<O, O1, style>
'deep': PatchDeep<O, O1, style>
export type Patch<O extends object, O1 extends object, depth extends Depth = 'flat', style extends MergeStyle = 2, ignore = BuiltInObject> = {
'flat': PatchFlat<O, O1, style, ignore>
'deep': Compute<PatchDeep<O, O1, style, ignore>>
}[depth]

@@ -11,2 +11,3 @@ import {Iteration} from '../Iteration/Iteration'

import {Patch} from './Patch'
import {BuiltInObject} from '../Misc/BuiltInObject'

@@ -16,4 +17,4 @@ /**

*/
type __PatchAll<O extends object, Os extends List<object>, depth extends Depth, style extends MergeStyle, I extends Iteration = IterationOf<'0'>> = {
0: __PatchAll<Patch<O, Os[Pos<I>], depth, style>, Os, depth, style, Next<I>>
type __PatchAll<O extends object, Os extends List<object>, depth extends Depth, style extends MergeStyle, ignore extends any, I extends Iteration = IterationOf<'0'>> = {
0: __PatchAll<Patch<O, Os[Pos<I>], depth, style, ignore>, Os, depth, style, ignore, Next<I>>
1: O

@@ -25,4 +26,4 @@ }[Extends<Pos<I>, Length<Os>>]

*/
export type _PatchAll<O extends object, Os extends List<object>, depth extends Depth, style extends MergeStyle> =
__PatchAll<O, Os, depth, style> extends infer X
export type _PatchAll<O extends object, Os extends List<object>, depth extends Depth, style extends MergeStyle, ignore extends any> =
__PatchAll<O, Os, depth, style, ignore> extends infer X
? Cast<X, object>

@@ -32,3 +33,3 @@ : never

/**
[[Patch]] a list of [[Object]]s into **`O`**. Patches from left to right, first
[[Patch]] a list of [[Object]]s into `O`. Patches from left to right, first
items get completed by the next ones (last-in completes).

@@ -39,2 +40,3 @@ @param O to start with

@param style (?=`1`) 0 = lodash, 1 = ramda
@param ignore (?=`BuiltinObject`) types not to merge
@returns [[Object]]

@@ -45,7 +47,7 @@ @example

*/
export type PatchAll<O extends object, Os extends List<object>, depth extends Depth = 'flat', style extends MergeStyle = 1> =
export type PatchAll<O extends object, Os extends List<object>, depth extends Depth = 'flat', style extends MergeStyle = 2, ignore extends any = BuiltInObject> =
O extends unknown
? Os extends unknown
? _PatchAll<O, Os, depth, style>
? _PatchAll<O, Os, depth, style, ignore>
: never
: never

@@ -26,3 +26,3 @@ import {IterationOf} from '../Iteration/IterationOf'

*/
export type _Path<O extends object, Path extends List<Key>, strict extends Boolean = 1> =
export type _Path<O extends object, Path extends List<Key>, strict extends Boolean> =
__Path<O, Path, strict> extends infer X

@@ -33,8 +33,7 @@ ? Cast<X, any>

/**
Get in **`O`** the type of nested properties
For more advanced capabilities, see [[PathUp]]
Get in `O` the type of nested properties
@param O to be inspected
@param Path to be followed
@param strict (?=`1`) `0` to work with unions
@returns **`any`**
@returns [[Any]]
@example

@@ -41,0 +40,0 @@ ```ts

import {OptionalFlat} from '../Object/Optional'
import {Key} from '../Any/Key'
import {NonNullableFlat} from '../Object/NonNullable'
import {_Concat} from '../List/Concat'
import {Concat} from '../List/Concat'
import {Cast} from '../Any/Cast'
import {Equals} from '../Any/Equals'
import {List} from '../List/List'
import {_Append} from '../List/Append'
import {Append} from '../List/Append'

@@ -14,6 +14,6 @@ /**

type __Paths<O, Paths extends List<Key> = []> = {
0: {[K in keyof O]: __Paths<O[K], _Append<Paths, K>>}[keyof O]
0: {[K in keyof O]: __Paths<O[K], Append<Paths, K>>}[keyof O]
// It dives deep, and as it dives, it adds the paths to `Paths`
1: NonNullableFlat<OptionalFlat<Paths>>
2: NonNullableFlat<OptionalFlat<_Concat<Paths, Key[]>>>
2: NonNullableFlat<OptionalFlat<Concat<Paths, Key[]>>>
}[

@@ -38,6 +38,6 @@ Equals<O, any> extends 1 // Handle infinite recursion

/**
Get all the possible paths of **`O`**
Get all the possible paths of `O`
(⚠️ this won't work with circular-refs)
@param O to be inspected
@returns **`string[]`**
@returns [[String]][]
@example

@@ -44,0 +44,0 @@ ```ts

@@ -13,3 +13,3 @@ import {IterationOf} from '../Iteration/IterationOf'

import {Length} from '../List/Length'
import {Extends} from '../Any/_api'
import {Extends} from '../Any/Extends'

@@ -24,3 +24,3 @@ /**

[At<O & {}, Path[Pos<I>]>] extends [never]
? never
? keyof O
: Path[Pos<I>]

@@ -49,3 +49,3 @@ >

* @param Path to be validated
* @returns **`Index[]`**
* @returns [[Index]][]
* @example

@@ -52,0 +52,0 @@ * ```ts

@@ -17,3 +17,3 @@ import {Key} from '../Any/Key'

/**
Extract out of **`O`** the fields of key **`K`**
Extract out of `O` the fields of key `K`
@param O to extract from

@@ -28,3 +28,3 @@ @param K to chose fields

O extends unknown
? _Pick<O, K & keyof O>
? _Pick<O, K>
: never

@@ -1,7 +0,6 @@

import {Pick} from './Pick'
import {_Pick} from './Pick'
import {Depth} from './_Internal'
import {Key} from '../Any/Key'
import {Contains} from '../Any/Contains'
import {Keys} from '../Union/Keys'
import {PatchFlat} from './Patch'
import {_PatchFlat} from './Patch'
import {BuiltInObject} from '../Misc/BuiltInObject'

@@ -19,3 +18,5 @@ /**

export type ReadonlyDeep<O> = {
+readonly [K in keyof O]: ReadonlyDeep<O[K]>
+readonly [K in keyof O]: O[K] extends BuiltInObject
? O[K]
: ReadonlyDeep<O[K]>
}

@@ -26,3 +27,3 @@

*/
type ReadonlyPart<O extends object, depth extends Depth> = {
export type ReadonlyPart<O extends object, depth extends Depth> = {
'flat': ReadonlyFlat<O>,

@@ -33,3 +34,9 @@ 'deep': ReadonlyDeep<O>,

/**
Make some fields of **`O`** readonly (deeply or not)
* @hidden
*/
export type _Readonly<O extends object, K extends Key, depth extends Depth> =
_PatchFlat<ReadonlyPart<_Pick<O, K>, depth>, O, 2>
/**
Make some fields of `O` readonly (deeply or not)
@param O to make readonly

@@ -43,6 +50,5 @@ @param K (?=`Key`) to choose fields

*/
export type Readonly<O extends object, K extends Key = Key, depth extends Depth = 'flat'> = {
1: ReadonlyPart<O, depth>
0: PatchFlat<ReadonlyPart<Pick<O, K>, depth>, O, 1>
// Pick a part of O (with K) -> nullable -> merge it with O
}[Contains<Keys<O>, K>] & {}
export type Readonly<O extends object, K extends Key = Key, depth extends Depth = 'flat'> =
O extends unknown
? _Readonly<O, K, depth>
: never
import {Equals} from '../Any/Equals'
import {Key} from '../Any/Key'

@@ -18,3 +17,3 @@ // Credit https://stackoverflow.com/a/52473108/3570903

/**
Get the keys of **`O`** that are readonly
Get the keys of `O` that are readonly
@param O

@@ -27,6 +26,4 @@ @returns [[Key]]

export type ReadonlyKeys<O extends object> =
(
O extends unknown
? _ReadonlyKeys<O>
: never
) & Key
O extends unknown
? _ReadonlyKeys<O>
: never

@@ -5,3 +5,3 @@ import {Modx} from './_Internal'

/**
Create an object filled with **`A`** for the fields **`K`**
Create an object filled with `A` for the fields `K`
@param K to choose fields

@@ -8,0 +8,0 @@ @param A to fill fields with

@@ -7,3 +7,3 @@ import {Match} from '../Any/_Internal'

*/
export type _Replace<O extends object, M extends any, A extends any, match extends Match = 'default'> = {
export type _Replace<O extends object, M extends any, A extends any, match extends Match> = {
[K in keyof O]: {

@@ -16,3 +16,3 @@ 1: A

/**
Update with **`A`** the fields of **`O`** that match **`M`**
Update with `A` the fields of `O` that match `M`
@param O to update

@@ -19,0 +19,0 @@ @param M to select fields

@@ -1,7 +0,6 @@

import {Pick} from './Pick'
import {_Pick} from './Pick'
import {Depth} from './_Internal'
import {Key} from '../Any/Key'
import {Contains} from '../Any/Contains'
import {Keys} from './Keys'
import {PatchFlat} from './Patch'
import {_PatchFlat} from './Patch'
import {BuiltInObject} from '../Misc/BuiltInObject'

@@ -19,3 +18,5 @@ /**

export type RequiredDeep<O> = {
[K in keyof O]-?: RequiredDeep<O[K]>
[K in keyof O]-?: O[K] extends BuiltInObject
? O[K]
: RequiredDeep<O[K]>
}

@@ -26,3 +27,3 @@

*/
type RequiredPart<O extends object, depth extends Depth> = {
export type RequiredPart<O extends object, depth extends Depth> = {
'flat': RequiredFlat<O>,

@@ -33,3 +34,9 @@ 'deep': RequiredDeep<O>,

/**
Make some fields of **`O`** required (deeply or not)
* @hidden
*/
export type _Required<O extends object, K extends Key, depth extends Depth> =
_PatchFlat<RequiredPart<_Pick<O, K>, depth>, O, 2>
/**
Make some fields of `O` required (deeply or not)
@param O to make required

@@ -43,6 +50,5 @@ @param K (?=`Key`) to choose fields

*/
export type Required<O extends object, K extends Key = Key, depth extends Depth = 'flat'> = {
1: RequiredPart<O, depth>
0: PatchFlat<RequiredPart<Pick<O, K>, depth>, O, 1>
// Pick a part of O (with K) -> nullable -> merge it with O
}[Contains<Keys<O>, K>] & {}
export type Required<O extends object, K extends Key = Key, depth extends Depth = 'flat'> =
O extends unknown
? _Required<O, K, depth>
: never

@@ -1,2 +0,1 @@

import {Key} from '../Any/Key'

@@ -11,3 +10,3 @@ /**

/**
Get the keys of **`O`** that are required
Get the keys of `O` that are required
@param O

@@ -20,6 +19,4 @@ @returns [[Key]]

export type RequiredKeys<O extends object> =
(
O extends unknown
? _RequiredKeys<O>
: never
) & Key
O extends unknown
? _RequiredKeys<O>
: never

@@ -6,3 +6,3 @@ import {SelectKeys} from './SelectKeys'

/**
Extract the fields of **`O`** that match **`M`**
Extract the fields of `O` that match `M`
@param O to extract from

@@ -9,0 +9,0 @@ @param M to select fields

import {Match} from '../Any/_Internal'
import {Is} from '../Any/Is'
import {Key} from '../Any/Key'

@@ -8,4 +7,4 @@ /**

*/
export type _SelectKeys<O extends object, M extends any, match extends Match = 'default'> = {
[K in keyof O]: {
export type _SelectKeys<O extends object, M extends any, match extends Match> = {
[K in keyof O]-?: {
1: K

@@ -17,3 +16,3 @@ 0: never

/**
Get the keys of **`O`** which fields match **`M`**
Get the keys of `O` which fields match `M`
@param O to extract from

@@ -28,6 +27,4 @@ @param M to select fields

export type SelectKeys<O extends object, M extends any, match extends Match = 'default'> =
(
O extends unknown
? _SelectKeys<O, M, match>
: never
) & Key
O extends unknown
? _SelectKeys<O, M, match>
: never
import {Depth} from './_Internal'
import {Pick} from './Pick'
import {_Pick} from './Pick'
import {Key} from '../Any/Key'
import {Contains} from '../Any/Contains'
import {Keys} from './Keys'
import {PatchFlat} from './Patch'
import {_PatchFlat} from './Patch'
import {BuiltInObject} from '../Misc/BuiltInObject'

@@ -19,3 +18,5 @@ /**

export type UndefinableDeep<O> = {
[K in keyof O]: UndefinableDeep<O[K] | undefined>
[K in keyof O]: O[K] extends BuiltInObject
? O[K]
: UndefinableDeep<O[K] | undefined>
}

@@ -32,3 +33,9 @@

/**
Make some fields of **`O`** **`undefined`** (deeply or not)
* @hidden
*/
export type _Undefinable<O extends object, K extends Key, depth extends Depth> =
_PatchFlat<UndefinablePart<_Pick<O, K>, depth>, O, 2>
/**
Make some fields of `O` `undefined` (deeply or not)
@param O to make undefinable

@@ -42,6 +49,5 @@ @param K (?=`Key`) to choose fields

*/
export type Undefinable<O extends object, K extends Key = Key, depth extends Depth = 'flat'> = {
1: UndefinablePart<O, depth>
0: PatchFlat<UndefinablePart<Pick<O, K>, depth>, O, 1>
// Pick a part of O (with K) -> Undefinable -> merge it with O
}[Contains<Keys<O>, K>] & {}
export type Undefinable<O extends object, K extends Key = Key, depth extends Depth = 'flat'> =
O extends unknown
? _Undefinable<O, K, depth>
: never

@@ -1,3 +0,1 @@

import {Key} from '../Any/Key'
/**

@@ -7,9 +5,9 @@ @hidden

export type _UndefinableKeys<O extends object> = {
[K in keyof O]: [O[K] & (undefined)] extends [never]
? never
: K
[K in keyof O]-?: [O[K] & (undefined)] extends [never]
? never
: K
}[keyof O]
/**
Get the keys of **`O`** that are **`undefined`**
Get the keys of `O` that are `undefined`
(⚠️ needs `--strictNullChecks` enabled)

@@ -23,6 +21,4 @@ @param O

export type UndefinableKeys<O extends object> =
(
O extends unknown
? _UndefinableKeys<O>
: never
) & Key
O extends unknown
? _UndefinableKeys<O>
: never

@@ -5,3 +5,3 @@ import {At} from './At'

/**
Make the fields of **`O`** union the ones of **`O1`**
Make the fields of `O` union the ones of `O1`
@param O to union from

@@ -8,0 +8,0 @@ @param O1 to union with

@@ -1,8 +0,13 @@

import {Keys} from './Keys'
import {At} from './At'
/**
* @hidden
*/
export type _UnionOf<O extends object> =
At<O, keyof O>
/**
Transform an [[Object]] into an [[Union]]
@param O to transform
@returns **`any`**
@returns [[Any]]
@example

@@ -13,2 +18,4 @@ ```ts

export type UnionOf<O extends object> =
At<O, Keys<O>>
O extends unknown
? _UnionOf<O>
: never
import {Key} from '../Any/Key'
import {x} from '../Any/x'
import {Replace} from '../Union/Replace'
import {Depth} from './_Internal'
/**
Update in **`O`** the fields of key **`K`** with **`A`**.
* @hidden
*/
type UpdateFlat<O extends object, K extends Key, A extends any> = {
[P in keyof O]: P extends K
? Replace<A, x, O[P]>
: O[P]
} & {}
/**
* @hidden
*/
type __UpdateDeep<O, A extends any> = {
[K in keyof O]: Replace<A, x, O[K]> extends infer X
? X extends object
? __UpdateDeep<X, A>
: X
: never
}
/**
* @hidden
*/
type _UpdateDeep<O extends object, K extends Key, A extends any, OU = Update<O, K, x | A>> = {
[K in keyof OU]: __UpdateDeep<OU[K], A>
} & {}
/**
* @hidden
*/
export type UpdateDeep<O extends object, K extends Key, A extends any> =
_UpdateDeep<O, K, A>
/**
Update in `O` the fields of key `K` with `A`.
Use the [[x]] placeholder to get the current field type.

@@ -36,6 +70,5 @@ @param O to update

*/
export type Update<O extends object, K extends Key, A extends any> = {
[P in keyof O]: P extends K
? Replace<A, x, O[P]>
: O[P]
}
export type Update<O extends object, K extends Key, A extends any, depth extends Depth = 'flat'> = {
'flat': UpdateFlat<O, K, A>
'deep': UpdateDeep<O, K, A>
}[depth]

@@ -1,7 +0,6 @@

import {Pick} from './Pick'
import {_Pick} from './Pick'
import {Depth} from './_Internal'
import {Key} from '../Any/Key'
import {Contains} from '../Any/Contains'
import {Keys} from './Keys'
import {PatchFlat} from './Patch'
import {_PatchFlat} from './Patch'
import {BuiltInObject} from '../Misc/BuiltInObject'

@@ -19,3 +18,5 @@ /**

export type WritableDeep<O> = {
-readonly [K in keyof O]: WritableDeep<O[K]>
-readonly [K in keyof O]: O[K] extends BuiltInObject
? O[K]
: WritableDeep<O[K]>
}

@@ -26,3 +27,3 @@

*/
type WritablePart<O extends object, depth extends Depth> = {
export type WritablePart<O extends object, depth extends Depth> = {
'flat': WritableFlat<O>,

@@ -33,3 +34,9 @@ 'deep': WritableDeep<O>,

/**
Make some fields of **`O`** writable (deeply or not)
@hidden
*/
export type _Writable<O extends object, K extends Key, depth extends Depth> =
_PatchFlat<WritablePart<_Pick<O, K>, depth>, O, 2>
/**
Make some fields of `O` writable (deeply or not)
@param O to make writable

@@ -43,6 +50,5 @@ @param K (?=`Key`) to choose fields

*/
export type Writable<O extends object, K extends Key = Key, depth extends Depth = 'flat'> = {
1: WritablePart<O, depth>
0: PatchFlat<WritablePart<Pick<O, K>, depth>, O, 1>
// Pick a part of O (with K) -> nullable -> merge it with O
}[Contains<Keys<O>, K>] & {}
export type Writable<O extends object, K extends Key = Key, depth extends Depth = 'flat'> =
O extends unknown
? _Writable<O, K, depth>
: never
import {Equals} from '../Any/Equals'
import {Key} from '../Any/Key'

@@ -17,3 +16,3 @@ // Credit https://stackoverflow.com/a/52473108/3570903

/**
Get the keys of **`O`** that are writable
Get the keys of `O` that are writable
@param O

@@ -26,6 +25,4 @@ @returns [[Key]]

export type WritableKeys<O extends object> =
(
O extends unknown
? _WritableKeys<O>
: never
) & Key
O extends unknown
? _WritableKeys<O>
: never
/**
Describes compatible type formats
* `b`: **`boolean`**
* `s`: **`string`**
* `n`: **`number`**
* `b`: `boolean`
* `s`: `string`
* `n`: `number`
*/
export type Formats = 'b' | 'n' | 's'

@@ -7,5 +7,5 @@ import {Formats} from './_Internal'

/**
Change the format of a **`string`**
Change the format of a `string`
@param S to transform
@returns **`string | number | boolean`**
@returns `string | number | boolean`
@example

@@ -12,0 +12,0 @@ ```ts

/** @ignore *//** */
export * as Test from './Test'
export * as A from './Any/_api'
export * as B from './Boolean/_api'
export * as C from './Class/_api'
export * as Community from './Community/_api'
export * as F from './Function/_api'
export * as I from './Iteration/_api'
export * as M from './Misc/_api'
export * as N from './Number/_api'
export * as O from './Object/_api'
export * as S from './String/_api'
export * as T from './List/_api'
export * as L from './List/_api'
export * as U from './Union/_api'
export * as Any from './Any/_api'
export * as Boolean from './Boolean/_api'
export * as Class from './Class/_api'
export * as Function from './Function/_api'
export * as Iteration from './Iteration/_api'
export * as Misc from './Misc/_api'
export * as Number from './Number/_api'
export * as Object from './Object/_api'
export * as String from './String/_api'
export * as Tuple from './List/_api'
export * as List from './List/_api'
export * as Union from './Union/_api'
import * as Test from './Test'
import * as A from './Any/_api'
import * as B from './Boolean/_api'
import * as C from './Class/_api'
import * as Community from './Community/_api'
import * as F from './Function/_api'
import * as I from './Iteration/_api'
import * as M from './Misc/_api'
import * as N from './Number/_api'
import * as O from './Object/_api'
import * as S from './String/_api'
import * as T from './List/_api'
import * as L from './List/_api'
import * as U from './Union/_api'
import * as Any from './Any/_api'
import * as Boolean from './Boolean/_api'
import * as Class from './Class/_api'
import * as Function from './Function/_api'
import * as Iteration from './Iteration/_api'
import * as Misc from './Misc/_api'
import * as Number from './Number/_api'
import * as Object from './Object/_api'
import * as String from './String/_api'
import * as Tuple from './List/_api'
import * as List from './List/_api'
import * as Union from './Union/_api'
export {
Test,
A,
Any,
B,
Boolean,
C,
Class,
Community,
F,
Function,
I,
Iteration,
L,
List,
M,
Misc,
N,
Number,
O,
Object,
S,
String,
T,
Tuple,
U,
Union,
}
// ///////////////////////////////////////////////////////////////////////////////////////

@@ -45,2 +74,3 @@ // NOTES /////////////////////////////////////////////////////////////////////////////////

// ! this happens only when a type is nested within itself => infinite recursion
// This technique also lowers the memory consumption and the RAM that is needed

@@ -77,3 +107,3 @@ // ---------------------------------------------------------------------------------------

// (Usually, the first step `_` takes care of parameters. But you can also find 2 steps `__` (eg. recursive))
// -> Perf tip: When building utilities, always check if a type has an exported `_` version & decide if needed
// => !\ Perf: Always check if a type has an EXPORTED `_` version, decide if needed
// -> Remember:

@@ -94,2 +124,5 @@ // - ALL EXPORTED `_` types are/must be NON-distributed types

// -> This will avoid `<type> extends unknown`-hell loops (and re-looping)
//
// => Avoiding unnecessary intersections on large unions will compute time
// => This is also valid for `extends`, for distributing over large unions

@@ -114,2 +147,15 @@ // ---------------------------------------------------------------------------------------

// ---------------------------------------------------------------------------------------
// 6. Distribution
//
// => An easy way to test if distribution is happening correctly is to test the
// type with `never`, then it should yield `never`. However, this might differ
// or not be true for a few utilities.
//
// => Perf: Always check if a type has an EXPORTED `_` version, decide if needed
//
// => !\ Excessive type distribution is known to cause type metadata loss
// TypeScript's inference stops following if too much distribution is done
// ALWAYS build a type version with `_` utilities, then distribute the type
// ///////////////////////////////////////////////////////////////////////////////////////

@@ -120,29 +166,30 @@ // TODO //////////////////////////////////////////////////////////////////////////////////

// type O<V> = {
// a: number[]
// b: {a: V}[]
// c: O<V>
// type Oo<V> = {
// e: [V]
// f: [[V]]
// g: [[[V]]]
// h: [[[[V]]]]
// i: [[[[[V]]]]]
// j: [[[[[[V]]]]]]
// k: [[[[[[[V]]]]]]]
// l: [[[[[[[[V]]]]]]]]
// }
// type t1 = O.MergeAll<{}, [
// O<[0]>,
// O<[1, 2]>,
// O<[1, 2, 3]>,
// O<[1, 2, 3, 4]>,
// O<[1, 2, 3, 4, 5]>,
// O<[1, 2, 3, 4, 5, 6]>,
// O<[1, 2, 3, 4, 5, 6, 7]>,
// O<[1, 2, 3, 4, 5, 6, 7, 8]>,
// O<[1, 2, 3, 4, 5, 6, 7, 8, 9]>,
// O<[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]>,
// O<[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]>,
// O<[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]>,
// O<[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]>,
// O<[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]>,
// O<[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]>,
// O<[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]>,
// O<[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]>,
// O<[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18]>,
// O<[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 20]>,
// ], 'deep', 0>
// type t1 = O.PatchAll<{}, [
// Oo<[1, 2, 3, 4]>,
// Oo<[1, 2, 3, 4, 5]>,
// Oo<[1, 2, 3, 4, 5, 6]>,
// Oo<[1, 2, 3, 4, 5, 6, 7]>,
// Oo<[1, 2, 3, 4, 5, 6, 7, 8]>,
// Oo<[1, 2, 3, 4, 5, 6, 7, 8, 9]>,
// Oo<[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]>,
// Oo<[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]>,
// Oo<[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]>,
// Oo<[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]>,
// Oo<[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]>,
// Oo<[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]>,
// Oo<[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]>,
// // Oo<[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]>,
// // Oo<[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18]>,
// // Oo<[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 19, 20]>,
// ], 'deep', 2>['l'][0][0][0][0][0][0][0][0]

@@ -5,3 +5,3 @@ import {Exclude} from './Exclude'

/**
Get an [[Union]] that is the difference between **`U1`** & **`U2`**
Get an [[Union]] that is the difference between `U1` & `U2`
@param U1 to check differences with

@@ -8,0 +8,0 @@ @param U2 to check differences against

import {Union} from './Union'
/**
Remove **`M`** out of **`U`**
Remove `M` out of `U`
@param U to remove from

@@ -6,0 +6,0 @@ @param M to remove out

@@ -6,3 +6,3 @@ import {Union} from './Union'

/**
Remove **`M`** out of **`U`**
Remove `M` out of `U`
@param U to remove from

@@ -9,0 +9,0 @@ @param M to remove out

@@ -6,3 +6,3 @@ import {Union} from './Union'

/**
Check whether **`U`** contains **`U1`**
Check whether `U` contains `U1`
@param U to be inspected

@@ -9,0 +9,0 @@ @param U1 to check within

import {Union} from './Union'
/**
Get the intersection of **`U1`** & **`U2`**
Get the intersection of `U1` & `U2`
@param U1 to check similarities with

@@ -6,0 +6,0 @@ @param U2 to check similarities against

@@ -8,3 +8,3 @@ import {Union} from './Union'

@param U to transform
@returns **intersection**
@returns `&`
@example

@@ -11,0 +11,0 @@ ```ts

import {Union} from './Union'
import {Key} from '../Any/Key'

@@ -13,6 +12,4 @@ /**

export type Keys<U extends Union> =
(
U extends unknown
? keyof U
: never
) & Key
U extends unknown
? keyof U
: never

@@ -8,3 +8,3 @@ import {IntersectOf} from './IntersectOf'

@param U
@returns **any**
@returns [[Any]]
@example

@@ -11,0 +11,0 @@ ```ts

@@ -5,3 +5,3 @@ import {Exclude} from './Exclude'

/**
Remove **`undefined`** & **`null`** out of **`U`**
Remove `undefined` & `null` out of `U`
@param U to make non-nullable

@@ -8,0 +8,0 @@ @returns [[Union]]

import {Union} from './Union'
/**
Add **`undefined | null`** to **`U`**
Add `undefined | null` to `U`
@param U to make nullable

@@ -6,0 +6,0 @@ @returns [[Union]]

@@ -6,3 +6,3 @@ import {Exclude} from './Exclude'

/**
Remove an item out of **`U`**
Remove an item out of `U`
(⚠️ it might not preserve order)

@@ -9,0 +9,0 @@ @param U to remove from

import {Union} from './Union'
/**
Replace **`M`** with **`A`** in **`U`**
Replace `M` with `A` in `U`
@param U to update

@@ -6,0 +6,0 @@ @param M to select

@@ -6,10 +6,10 @@ import {Union} from './Union'

/**
Extract the part of **`U`** that matches **`M`**
@param U to extract from
@param M to select with
@returns [[Union]]
@example
```ts
```
*/
* Extract the part of `U` that matches `M`
* @param U to extract from
* @param M to select with
* @returns [[Union]]
* @example
* ```ts
* ```
*/
export type Select<U extends Union, M extends any, match extends Match = 'default'> =

@@ -16,0 +16,0 @@ U extends unknown

@@ -7,4 +7,4 @@ import {ComputeRaw} from '../Any/Compute'

/**
@hidden
*/
* @hidden
*/
type _Strict<U, _U = U> =

@@ -16,10 +16,10 @@ U extends unknown

/**
Make a [[Union]] not allow excess properties (https://github.com/Microsoft/TypeScript/issues/20863)
@param U to make strict
@returns [[Union]]
@example
```ts
```
*/
* Make a [[Union]] not allow excess properties (https://github.com/Microsoft/TypeScript/issues/20863)
* @param U to make strict
* @returns [[Union]]
* @example
* ```ts
* ```
*/
export type Strict<U extends object> =
ComputeRaw<_Strict<U>>
/**
A [[Union]]
@example
```ts
type union0 = 1 | 2 | 3
type union1 = 'a' | 420
```
*/
* A [[Union]]
* @example
* ```ts
* type union0 = 1 | 2 | 3
* type union1 = 'a' | 420
* ```
*/
export type Union = any

@@ -698,2 +698,105 @@ function F() {

function dropLastWhile(predicate, iterable) {
if (arguments.length === 1) {
return _iterable => dropLastWhile(predicate, _iterable);
}
if (iterable.length === 0) return iterable;
const isArray = _isArray(iterable);
if (typeof predicate !== 'function') {
throw new Error(`'predicate' is from wrong type ${typeof predicate}`);
}
if (!isArray && typeof iterable !== 'string') {
throw new Error(`'iterable' is from wrong type ${typeof iterable}`);
}
let found = false;
const toReturn = [];
let counter = iterable.length;
while (counter > 0) {
counter--;
if (!found && predicate(iterable[counter]) === false) {
found = true;
toReturn.push(iterable[counter]);
} else if (found) {
toReturn.push(iterable[counter]);
}
}
return isArray ? toReturn.reverse() : toReturn.reverse().join('');
}
function dropRepeats(list) {
if (!_isArray(list)) {
throw new Error(`${list} is not a list`);
}
const toReturn = [];
list.reduce((prev, current) => {
if (!equals(prev, current)) {
toReturn.push(current);
}
return current;
}, undefined);
return toReturn;
}
function dropRepeatsWith(predicate, list) {
if (arguments.length === 1) {
return _iterable => dropRepeatsWith(predicate, _iterable);
}
if (!_isArray(list)) {
throw new Error(`${list} is not a list`);
}
const toReturn = [];
list.reduce((prev, current) => {
if (prev === undefined) {
toReturn.push(current);
return current;
}
if (!predicate(prev, current)) {
toReturn.push(current);
}
return current;
}, undefined);
return toReturn;
}
function dropWhile(predicate, iterable) {
if (arguments.length === 1) {
return _iterable => dropWhile(predicate, _iterable);
}
const isArray = _isArray(iterable);
if (!isArray && typeof iterable !== 'string') {
throw new Error('`iterable` is neither list nor a string');
}
let flag = false;
const holder = [];
let counter = -1;
while (counter++ < iterable.length - 1) {
if (flag) {
holder.push(iterable[counter]);
} else if (!predicate(iterable[counter])) {
if (!flag) flag = true;
holder.push(iterable[counter]);
}
}
return isArray ? holder : holder.join('');
}
function either(firstPredicate, secondPredicate) {

@@ -712,2 +815,67 @@ if (arguments.length === 1) {

function eqPropsFn(prop, obj1, obj2) {
if (!obj1 || !obj2) {
throw new Error('wrong object inputs are passed to R.eqProps');
}
return equals(obj1[prop], obj2[prop]);
}
const eqProps = curry(eqPropsFn);
function evolveArray(rules, list) {
return mapArray((x, i) => {
if (type(rules[i]) === 'Function') {
return rules[i](x);
}
return x;
}, list, true);
}
function evolveObject(rules, iterable) {
return mapObject((x, prop) => {
if (type(x) === 'Object') {
const typeRule = type(rules[prop]);
if (typeRule === 'Function') {
return rules[prop](x);
}
if (typeRule === 'Object') {
return evolve(rules[prop], x);
}
return x;
}
if (type(rules[prop]) === 'Function') {
return rules[prop](x);
}
return x;
}, iterable);
}
function evolve(rules, iterable) {
if (arguments.length === 1) {
return _iterable => evolve(rules, _iterable);
}
const rulesType = type(rules);
const iterableType = type(iterable);
if (iterableType !== rulesType) {
throw new Error('iterableType !== rulesType');
}
if (!['Object', 'Array'].includes(rulesType)) {
throw new Error(`'iterable' and 'rules' are from wrong type ${rulesType}`);
}
if (iterableType === 'Object') {
return evolveObject(rules, iterable);
}
return evolveArray(rules, iterable);
}
function filterObject(fn, obj) {

@@ -1168,3 +1336,2 @@ const willReturn = {};

function lens(getter, setter) {
if (arguments.length === 1) return _setter => lens(getter, _setter);
return function (functor) {

@@ -1556,2 +1723,6 @@ return function (target) {

if (!_isArray(propsToPick)) {
throw new Error('propsToPick is not a list');
}
return mapArray(prop => obj[prop], propsToPick);

@@ -1740,18 +1911,50 @@ }

function takeWhile(predicate, list) {
function takeLastWhile(predicate, input) {
if (arguments.length === 1) {
return _input => takeLastWhile(predicate, _input);
}
if (input.length === 0) return input;
let found = false;
const toReturn = [];
let stopFlag = false;
let counter = -1;
let counter = input.length;
while (stopFlag === false && counter++ < list.length - 1) {
if (!predicate(list[counter])) {
stopFlag = true;
} else {
toReturn.push(list[counter]);
while (!found || counter === 0) {
counter--;
if (predicate(input[counter]) === false) {
found = true;
} else if (!found) {
toReturn.push(input[counter]);
}
}
return toReturn;
return _isArray(input) ? toReturn.reverse() : toReturn.reverse().join('');
}
function takeWhile(predicate, iterable) {
if (arguments.length === 1) {
return _iterable => takeWhile(predicate, _iterable);
}
const isArray = _isArray(iterable);
if (!isArray && typeof iterable !== 'string') {
throw new Error('`iterable` is neither list nor a string');
}
let flag = true;
const holder = [];
let counter = -1;
while (counter++ < iterable.length - 1) {
if (!predicate(iterable[counter])) {
if (flag) flag = false;
} else if (flag) {
holder.push(iterable[counter]);
}
}
return isArray ? holder : holder.join('');
}
function tap(fn, x) {

@@ -1976,2 +2179,2 @@ if (arguments.length === 1) return _x => tap(fn, _x);

export { F, T, add, adjust, all, allPass, always, and, any, anyPass, append, applySpec, assoc, assocPath, both, chain, clamp, clone, complement, compose, concat, cond, converge, curry, curryN, dec, defaultTo, difference, dissoc, divide, drop, dropLast, either, endsWith, equals, filter, filterArray, filterObject, find, findIndex, findLast, findLastIndex, flatten, flip, forEach, fromPairs, groupBy, groupWith, has, hasPath, head, identical, identity, ifElse, inc, includes, indexBy, indexOf, init, intersection, intersperse, is, isEmpty, isNil, join, keys, last, lastIndexOf, length, lens, lensIndex, lensPath, lensProp, map, mapArray, mapObject, match, mathMod, max, maxBy, maxByFn, mean, median, merge, mergeAll, mergeDeepRight, mergeLeft, min, minBy, minByFn, modulo, move, multiply, negate, none, not, nth, of, omit, once, or, over, partial, partition, partitionArray, partitionObject, path, pathEq, pathOr, paths, pick, pickAll, pipe, pluck, prepend, product, prop, propEq, propIs, propOr, props, range, reduce, reject, repeat, replace, reverse, set, slice, sort, sortBy, split, splitAt, splitEvery, splitWhen, startsWith, subtract, sum, symmetricDifference, tail, take, takeLast, takeWhile, tap, test, times, toLower, toPairs, toString, toUpper, transpose, trim, tryCatch, type, union, uniq, uniqWith, unless, update, values, view, when, where, whereEq, without, xor, zip, zipObj, zipWith };
export { F, T, add, adjust, all, allPass, always, and, any, anyPass, append, applySpec, assoc, assocPath, both, chain, clamp, clone, complement, compose, concat, cond, converge, curry, curryN, dec, defaultTo, difference, dissoc, divide, drop, dropLast, dropLastWhile, dropRepeats, dropRepeatsWith, dropWhile, either, endsWith, eqProps, equals, evolve, evolveArray, evolveObject, filter, filterArray, filterObject, find, findIndex, findLast, findLastIndex, flatten, flip, forEach, fromPairs, groupBy, groupWith, has, hasPath, head, identical, identity, ifElse, inc, includes, indexBy, indexOf, init, intersection, intersperse, is, isEmpty, isNil, join, keys, last, lastIndexOf, length, lens, lensIndex, lensPath, lensProp, map, mapArray, mapObject, match, mathMod, max, maxBy, maxByFn, mean, median, merge, mergeAll, mergeDeepRight, mergeLeft, min, minBy, minByFn, modulo, move, multiply, negate, none, not, nth, of, omit, once, or, over, partial, partition, partitionArray, partitionObject, path, pathEq, pathOr, paths, pick, pickAll, pipe, pluck, prepend, product, prop, propEq, propIs, propOr, props, range, reduce, reject, repeat, replace, reverse, set, slice, sort, sortBy, split, splitAt, splitEvery, splitWhen, startsWith, subtract, sum, symmetricDifference, tail, take, takeLast, takeLastWhile, takeWhile, tap, test, times, toLower, toPairs, toString, toUpper, transpose, trim, tryCatch, type, union, uniq, uniqWith, unless, update, values, view, when, where, whereEq, without, xor, zip, zipObj, zipWith };

@@ -702,2 +702,105 @@ 'use strict';

function dropLastWhile(predicate, iterable) {
if (arguments.length === 1) {
return _iterable => dropLastWhile(predicate, _iterable);
}
if (iterable.length === 0) return iterable;
const isArray = _isArray(iterable);
if (typeof predicate !== 'function') {
throw new Error(`'predicate' is from wrong type ${typeof predicate}`);
}
if (!isArray && typeof iterable !== 'string') {
throw new Error(`'iterable' is from wrong type ${typeof iterable}`);
}
let found = false;
const toReturn = [];
let counter = iterable.length;
while (counter > 0) {
counter--;
if (!found && predicate(iterable[counter]) === false) {
found = true;
toReturn.push(iterable[counter]);
} else if (found) {
toReturn.push(iterable[counter]);
}
}
return isArray ? toReturn.reverse() : toReturn.reverse().join('');
}
function dropRepeats(list) {
if (!_isArray(list)) {
throw new Error(`${list} is not a list`);
}
const toReturn = [];
list.reduce((prev, current) => {
if (!equals(prev, current)) {
toReturn.push(current);
}
return current;
}, undefined);
return toReturn;
}
function dropRepeatsWith(predicate, list) {
if (arguments.length === 1) {
return _iterable => dropRepeatsWith(predicate, _iterable);
}
if (!_isArray(list)) {
throw new Error(`${list} is not a list`);
}
const toReturn = [];
list.reduce((prev, current) => {
if (prev === undefined) {
toReturn.push(current);
return current;
}
if (!predicate(prev, current)) {
toReturn.push(current);
}
return current;
}, undefined);
return toReturn;
}
function dropWhile(predicate, iterable) {
if (arguments.length === 1) {
return _iterable => dropWhile(predicate, _iterable);
}
const isArray = _isArray(iterable);
if (!isArray && typeof iterable !== 'string') {
throw new Error('`iterable` is neither list nor a string');
}
let flag = false;
const holder = [];
let counter = -1;
while (counter++ < iterable.length - 1) {
if (flag) {
holder.push(iterable[counter]);
} else if (!predicate(iterable[counter])) {
if (!flag) flag = true;
holder.push(iterable[counter]);
}
}
return isArray ? holder : holder.join('');
}
function either(firstPredicate, secondPredicate) {

@@ -716,2 +819,67 @@ if (arguments.length === 1) {

function eqPropsFn(prop, obj1, obj2) {
if (!obj1 || !obj2) {
throw new Error('wrong object inputs are passed to R.eqProps');
}
return equals(obj1[prop], obj2[prop]);
}
const eqProps = curry(eqPropsFn);
function evolveArray(rules, list) {
return mapArray((x, i) => {
if (type(rules[i]) === 'Function') {
return rules[i](x);
}
return x;
}, list, true);
}
function evolveObject(rules, iterable) {
return mapObject((x, prop) => {
if (type(x) === 'Object') {
const typeRule = type(rules[prop]);
if (typeRule === 'Function') {
return rules[prop](x);
}
if (typeRule === 'Object') {
return evolve(rules[prop], x);
}
return x;
}
if (type(rules[prop]) === 'Function') {
return rules[prop](x);
}
return x;
}, iterable);
}
function evolve(rules, iterable) {
if (arguments.length === 1) {
return _iterable => evolve(rules, _iterable);
}
const rulesType = type(rules);
const iterableType = type(iterable);
if (iterableType !== rulesType) {
throw new Error('iterableType !== rulesType');
}
if (!['Object', 'Array'].includes(rulesType)) {
throw new Error(`'iterable' and 'rules' are from wrong type ${rulesType}`);
}
if (iterableType === 'Object') {
return evolveObject(rules, iterable);
}
return evolveArray(rules, iterable);
}
function filterObject(fn, obj) {

@@ -1172,3 +1340,2 @@ const willReturn = {};

function lens(getter, setter) {
if (arguments.length === 1) return _setter => lens(getter, _setter);
return function (functor) {

@@ -1560,2 +1727,6 @@ return function (target) {

if (!_isArray(propsToPick)) {
throw new Error('propsToPick is not a list');
}
return mapArray(prop => obj[prop], propsToPick);

@@ -1744,18 +1915,50 @@ }

function takeWhile(predicate, list) {
function takeLastWhile(predicate, input) {
if (arguments.length === 1) {
return _input => takeLastWhile(predicate, _input);
}
if (input.length === 0) return input;
let found = false;
const toReturn = [];
let stopFlag = false;
let counter = -1;
let counter = input.length;
while (stopFlag === false && counter++ < list.length - 1) {
if (!predicate(list[counter])) {
stopFlag = true;
} else {
toReturn.push(list[counter]);
while (!found || counter === 0) {
counter--;
if (predicate(input[counter]) === false) {
found = true;
} else if (!found) {
toReturn.push(input[counter]);
}
}
return toReturn;
return _isArray(input) ? toReturn.reverse() : toReturn.reverse().join('');
}
function takeWhile(predicate, iterable) {
if (arguments.length === 1) {
return _iterable => takeWhile(predicate, _iterable);
}
const isArray = _isArray(iterable);
if (!isArray && typeof iterable !== 'string') {
throw new Error('`iterable` is neither list nor a string');
}
let flag = true;
const holder = [];
let counter = -1;
while (counter++ < iterable.length - 1) {
if (!predicate(iterable[counter])) {
if (flag) flag = false;
} else if (flag) {
holder.push(iterable[counter]);
}
}
return isArray ? holder : holder.join('');
}
function tap(fn, x) {

@@ -2012,5 +2215,13 @@ if (arguments.length === 1) return _x => tap(fn, _x);

exports.dropLast = dropLast;
exports.dropLastWhile = dropLastWhile;
exports.dropRepeats = dropRepeats;
exports.dropRepeatsWith = dropRepeatsWith;
exports.dropWhile = dropWhile;
exports.either = either;
exports.endsWith = endsWith;
exports.eqProps = eqProps;
exports.equals = equals;
exports.evolve = evolve;
exports.evolveArray = evolveArray;
exports.evolveObject = evolveObject;
exports.filter = filter;

@@ -2123,2 +2334,3 @@ exports.filterArray = filterArray;

exports.takeLast = takeLast;
exports.takeLastWhile = takeLastWhile;
exports.takeWhile = takeWhile;

@@ -2125,0 +2337,0 @@ exports.tap = tap;

@@ -704,2 +704,105 @@ (function (global, factory) {

function dropLastWhile(predicate, iterable) {
if (arguments.length === 1) {
return _iterable => dropLastWhile(predicate, _iterable);
}
if (iterable.length === 0) return iterable;
const isArray = _isArray(iterable);
if (typeof predicate !== 'function') {
throw new Error(`'predicate' is from wrong type ${typeof predicate}`);
}
if (!isArray && typeof iterable !== 'string') {
throw new Error(`'iterable' is from wrong type ${typeof iterable}`);
}
let found = false;
const toReturn = [];
let counter = iterable.length;
while (counter > 0) {
counter--;
if (!found && predicate(iterable[counter]) === false) {
found = true;
toReturn.push(iterable[counter]);
} else if (found) {
toReturn.push(iterable[counter]);
}
}
return isArray ? toReturn.reverse() : toReturn.reverse().join('');
}
function dropRepeats(list) {
if (!_isArray(list)) {
throw new Error(`${list} is not a list`);
}
const toReturn = [];
list.reduce((prev, current) => {
if (!equals(prev, current)) {
toReturn.push(current);
}
return current;
}, undefined);
return toReturn;
}
function dropRepeatsWith(predicate, list) {
if (arguments.length === 1) {
return _iterable => dropRepeatsWith(predicate, _iterable);
}
if (!_isArray(list)) {
throw new Error(`${list} is not a list`);
}
const toReturn = [];
list.reduce((prev, current) => {
if (prev === undefined) {
toReturn.push(current);
return current;
}
if (!predicate(prev, current)) {
toReturn.push(current);
}
return current;
}, undefined);
return toReturn;
}
function dropWhile(predicate, iterable) {
if (arguments.length === 1) {
return _iterable => dropWhile(predicate, _iterable);
}
const isArray = _isArray(iterable);
if (!isArray && typeof iterable !== 'string') {
throw new Error('`iterable` is neither list nor a string');
}
let flag = false;
const holder = [];
let counter = -1;
while (counter++ < iterable.length - 1) {
if (flag) {
holder.push(iterable[counter]);
} else if (!predicate(iterable[counter])) {
if (!flag) flag = true;
holder.push(iterable[counter]);
}
}
return isArray ? holder : holder.join('');
}
function either(firstPredicate, secondPredicate) {

@@ -718,2 +821,67 @@ if (arguments.length === 1) {

function eqPropsFn(prop, obj1, obj2) {
if (!obj1 || !obj2) {
throw new Error('wrong object inputs are passed to R.eqProps');
}
return equals(obj1[prop], obj2[prop]);
}
const eqProps = curry(eqPropsFn);
function evolveArray(rules, list) {
return mapArray((x, i) => {
if (type(rules[i]) === 'Function') {
return rules[i](x);
}
return x;
}, list, true);
}
function evolveObject(rules, iterable) {
return mapObject((x, prop) => {
if (type(x) === 'Object') {
const typeRule = type(rules[prop]);
if (typeRule === 'Function') {
return rules[prop](x);
}
if (typeRule === 'Object') {
return evolve(rules[prop], x);
}
return x;
}
if (type(rules[prop]) === 'Function') {
return rules[prop](x);
}
return x;
}, iterable);
}
function evolve(rules, iterable) {
if (arguments.length === 1) {
return _iterable => evolve(rules, _iterable);
}
const rulesType = type(rules);
const iterableType = type(iterable);
if (iterableType !== rulesType) {
throw new Error('iterableType !== rulesType');
}
if (!['Object', 'Array'].includes(rulesType)) {
throw new Error(`'iterable' and 'rules' are from wrong type ${rulesType}`);
}
if (iterableType === 'Object') {
return evolveObject(rules, iterable);
}
return evolveArray(rules, iterable);
}
function filterObject(fn, obj) {

@@ -1174,3 +1342,2 @@ const willReturn = {};

function lens(getter, setter) {
if (arguments.length === 1) return _setter => lens(getter, _setter);
return function (functor) {

@@ -1562,2 +1729,6 @@ return function (target) {

if (!_isArray(propsToPick)) {
throw new Error('propsToPick is not a list');
}
return mapArray(prop => obj[prop], propsToPick);

@@ -1746,18 +1917,50 @@ }

function takeWhile(predicate, list) {
function takeLastWhile(predicate, input) {
if (arguments.length === 1) {
return _input => takeLastWhile(predicate, _input);
}
if (input.length === 0) return input;
let found = false;
const toReturn = [];
let stopFlag = false;
let counter = -1;
let counter = input.length;
while (stopFlag === false && counter++ < list.length - 1) {
if (!predicate(list[counter])) {
stopFlag = true;
} else {
toReturn.push(list[counter]);
while (!found || counter === 0) {
counter--;
if (predicate(input[counter]) === false) {
found = true;
} else if (!found) {
toReturn.push(input[counter]);
}
}
return toReturn;
return _isArray(input) ? toReturn.reverse() : toReturn.reverse().join('');
}
function takeWhile(predicate, iterable) {
if (arguments.length === 1) {
return _iterable => takeWhile(predicate, _iterable);
}
const isArray = _isArray(iterable);
if (!isArray && typeof iterable !== 'string') {
throw new Error('`iterable` is neither list nor a string');
}
let flag = true;
const holder = [];
let counter = -1;
while (counter++ < iterable.length - 1) {
if (!predicate(iterable[counter])) {
if (flag) flag = false;
} else if (flag) {
holder.push(iterable[counter]);
}
}
return isArray ? holder : holder.join('');
}
function tap(fn, x) {

@@ -2014,5 +2217,13 @@ if (arguments.length === 1) return _x => tap(fn, _x);

exports.dropLast = dropLast;
exports.dropLastWhile = dropLastWhile;
exports.dropRepeats = dropRepeats;
exports.dropRepeatsWith = dropRepeatsWith;
exports.dropWhile = dropWhile;
exports.either = either;
exports.endsWith = endsWith;
exports.eqProps = eqProps;
exports.equals = equals;
exports.evolve = evolve;
exports.evolveArray = evolveArray;
exports.evolveObject = evolveObject;
exports.filter = filter;

@@ -2125,2 +2336,3 @@ exports.filterArray = filterArray;

exports.takeLast = takeLast;
exports.takeLastWhile = takeLastWhile;
exports.takeWhile = takeWhile;

@@ -2127,0 +2339,0 @@ exports.tap = tap;

@@ -47,5 +47,36 @@ import { F as FunctionToolbelt, O as ObjectToolbelt, L as ListToolbelt } from "./_ts-toolbelt/src/ts-toolbelt";

}
type Partial<T> = {
[P in keyof T]?: T[P];
};
type Merge<O1 extends object, O2 extends object, Depth extends 'flat' | 'deep'> = ObjectToolbelt.MergeUp<ListToolbelt.ObjectOf<O1>, ListToolbelt.ObjectOf<O2>, Depth, 1>;
type Evolvable<E extends Evolver> = {
[P in keyof E]?: Evolved<E[P]>;
};
type Evolver<T extends Evolvable<any> = any> = {
[key in keyof Partial<T>]: ((value: T[key]) => T[key]) | (T[key] extends Evolvable<any> ? Evolver<T[key]> : never);
};
type Evolve<O extends Evolvable<E>, E extends Evolver> = {
[P in keyof O]: P extends keyof E
? EvolveValue<O[P], E[P]>
: O[P];
};
type EvolveNestedValue<O, E extends Evolver> =
O extends object
? O extends Evolvable<E>
? Evolve<O, E>
: never
: never;
type EvolveValue<V, E> =
E extends (value: V) => any
? ReturnType<E>
: E extends Evolver
? EvolveNestedValue<V, E>
: never;
type Merge<O1 extends object, O2 extends object, Depth extends 'flat' | 'deep'> = ObjectToolbelt.Merge<ListToolbelt.ObjectOf<O1>, ListToolbelt.ObjectOf<O2>, Depth, 1>;
interface AssocPartialOne<K extends keyof any> {

@@ -118,7 +149,8 @@ <T>(val: T): <U>(obj: U) => Record<K, T> & U;

type ProduceRules<Input> = {
[key: string]: ProduceFunctionRule<Input> | ProduceAsyncRule<Input>
type ProduceRules<Output,K extends keyof Output, Input> = {
[P in K]: (input: Input) => Output[P];
}
type ProduceFunctionRule<Input> = (input: Input) => any
type ProduceAsyncRules<Output,K extends keyof Output, Input> = {
[P in K]: (input: Input) => Promise<Output[P]>;
}
type ProduceAsyncRule<Input> = (input: Input) => Promise<any>

@@ -196,6 +228,2 @@ type Async<T> = (x: any) => Promise<T>;

/**
* It returns a curried function with the same arity as the longest function in the spec object.
* Arguments will be applied to the spec methods recursively.
*/
export function applySpec<Spec extends Record<string, (...args: readonly any[]) => any>>(

@@ -327,2 +355,5 @@ spec: Spec

/**
* 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.
*/
export function converge(after: ((...a: any[]) => any), fns: Array<((...x: any[]) => any)>): (...y: any[]) => any;

@@ -654,3 +685,2 @@

export function lens<T, U, V>(getter: (s: T) => U, setter: (a: U, s: T) => V): Lens;
export function lens<T, U, V>(getter: (s: T) => U, setter: (a: U, s: T) => V): Lens;

@@ -1187,6 +1217,6 @@ /**

export function reduce<T, TResult>(reducer: (prev: TResult, current: T, i: number) => TResult, initialValue: TResult, list: T[]): TResult;
export function reduce<T, TResult>(reducer: (prev: TResult, current: T) => TResult, initialValue: TResult, list: T[]): TResult;
export function reduce<T, TResult>(reducer: (prev: TResult, current: T, i?: number) => TResult): (initialValue: TResult, list: T[]) => TResult;
export function reduce<T, TResult>(reducer: (prev: TResult, current: T, i?: number) => TResult, initialValue: TResult): (list: T[]) => TResult;
export function reduce<T, TResult>(reducer: (prev: TResult, current: T, i: number) => TResult, initialValue: TResult, list: readonly T[]): TResult;
export function reduce<T, TResult>(reducer: (prev: TResult, current: T) => TResult, initialValue: TResult, list: readonly T[]): TResult;
export function reduce<T, TResult>(reducer: (prev: TResult, current: T, i?: number) => TResult): (initialValue: TResult, list: readonly T[]) => TResult;
export function reduce<T, TResult>(reducer: (prev: TResult, current: T, i?: number) => TResult, initialValue: TResult): (list: readonly T[]) => TResult;

@@ -1304,5 +1334,2 @@ /**

export function takeWhile<T>(predicate: (x: T) => boolean, list: readonly T[]): T[];
export function takeWhile<T>(predicate: (x: T) => boolean): (list: readonly T[]) => T[];
/**

@@ -1479,1 +1506,44 @@ * It applies function `fn` to input `x` and returns `x`.

export function splitWhen<T>(predicate: Predicate<T>): <U>(list: U[]) => U[][];
export function takeLastWhile(predicate: (x: string) => boolean, input: string): string;
export function takeLastWhile(predicate: (x: string) => boolean): (input: string) => string;
export function takeLastWhile<T>(predicate: (x: T) => boolean, input: readonly T[]): T[];
export function takeLastWhile<T>(predicate: (x: T) => boolean): <T>(input: readonly T[]) => T[];
/**
* It takes object or array of functions as set of rules. These `rules` are applied to the `iterable` input to produce the result.
*/
export function evolve<T, U>(rules: Array<(x: T) => U>, list: T[]): U[];
export function evolve<T, U>(rules: Array<(x: T) => U>) : (list: T[]) => U[];
export function evolve<E extends Evolver, V extends Evolvable<E>>(rules: E, obj: V): Evolve<V, E>;
export function evolve<E extends Evolver>(rules: E): <V extends Evolvable<E>>(obj: V) => Evolve<V, E>;
export function dropLastWhile(predicate: (x: string) => boolean, iterable: string): string;
export function dropLastWhile(predicate: (x: string) => boolean): (iterable: string) => string;
export function dropLastWhile<T>(predicate: (x: T) => boolean, iterable: readonly T[]): T[];
export function dropLastWhile<T>(predicate: (x: T) => boolean): <T>(iterable: readonly T[]) => T[];
/**
* It removes any successive duplicates according to `R.equals`.
*/
export function dropRepeats<T>(list: readonly T[]): T[];
export function dropRepeatsWith<T>(predicate: (x: T, y: T) => boolean, list: readonly T[]): T[];
export function dropRepeatsWith<T>(predicate: (x: T, y: T) => boolean): (list: readonly T[]) => T[];
export function dropWhile(fn: Predicate<string>, iterable: string): string;
export function dropWhile(fn: Predicate<string>): (iterable: string) => string;
export function dropWhile<T>(fn: Predicate<T>, iterable: readonly T[]): T[];
export function dropWhile<T>(fn: Predicate<T>): (iterable: readonly T[]) => T[];
export function takeWhile(fn: Predicate<string>, iterable: string): string;
export function takeWhile(fn: Predicate<string>): (iterable: string) => string;
export function takeWhile<T>(fn: Predicate<T>, iterable: readonly T[]): T[];
export function takeWhile<T>(fn: Predicate<T>): (iterable: readonly T[]) => T[];
/**
* It returns `true` if property `prop` in `obj1` is equal to property `prop` in `obj2` according to `R.equals`.
*/
export function eqProps<T, U>(prop: string, obj1: T, obj2: U): boolean;
export function eqProps<P extends string>(prop: P): <T, U>(obj1: Record<P, T>, obj2: Record<P, U>) => boolean;
export function eqProps<T>(prop: string, obj1: T): <U>(obj2: U) => boolean;

@@ -5,3 +5,3 @@ {

"new": "node scripts/add-new-method/add-new-method.js",
"test": "jest source --bail=true",
"test": "jest source -u --bail=false",
"cover:spec": "jest source --coverage --no-cache -w 1",

@@ -23,3 +23,3 @@ "cover": "yarn typings&&yarn cover:spec",

"main": "./dist/rambda.js",
"version": "6.2.0",
"version": "6.3.0",
"dependencies": {},

@@ -30,10 +30,11 @@ "devDependencies": {

"@babel/preset-env": "7.11.5",
"@types/fs-extra": "9.0.1",
"@types/jest": "26.0.14",
"@types/fs-extra": "9.0.1",
"@types/ramda": "0.27.7",
"combinate": "1.1.1",
"cross-env": "7.0.2",
"dtslint": "4.0.0",
"dtslint": "4.0.4",
"fs-extra": "9.0.1",
"helpers-fn": "0.7.0",
"is-ci": "2.0.0",
"fs-extra": "9.0.1",
"jest": "26.4.2",

@@ -46,5 +47,5 @@ "jest-extended": "0.11.5",

"ramda": "0.27.0",
"rollup": "2.26.11",
"rollup": "2.28.2",
"rollup-plugin-babel": "4.4.0",
"rollup-plugin-cleanup": "3.1.1",
"rollup-plugin-cleanup": "3.2.1",
"rollup-plugin-commonjs": "10.1.0",

@@ -55,4 +56,4 @@ "rollup-plugin-json": "4.0.0",

"rollup-plugin-sourcemaps": "0.6.2",
"string-fn": "2.12.0",
"typescript": "4.0.2"
"string-fn": "2.12.2",
"typescript": "4.0.3"
},

@@ -59,0 +60,0 @@ "jest": {

@@ -1,2 +0,1 @@

// extract for optimization
export const _isArray = Array.isArray
export function lens(getter, setter){
if (arguments.length === 1) return _setter => lens(getter, _setter)
return function (functor){

@@ -5,0 +3,0 @@ return function (target){

@@ -0,1 +1,2 @@

import { _isArray } from './_internals/_isArray'
import { mapArray } from './map'

@@ -7,4 +8,7 @@

}
if (!_isArray(propsToPick)){
throw new Error('propsToPick is not a list')
}
return mapArray(prop => obj[ prop ], propsToPick)
}

@@ -1,15 +0,25 @@

export function takeWhile(predicate, list){
const toReturn = []
let stopFlag = false
import { _isArray } from '../src/_internals/_isArray'
export function takeWhile(predicate, iterable){
if (arguments.length === 1){
return _iterable => takeWhile(predicate, _iterable)
}
const isArray = _isArray(iterable)
if (!isArray && typeof iterable !== 'string'){
throw new Error('`iterable` is neither list nor a string')
}
let flag = true
const holder = []
let counter = -1
while (stopFlag === false && counter++ < list.length - 1){
if (!predicate(list[ counter ])){
stopFlag = true
} else {
toReturn.push(list[ counter ])
while (counter++ < iterable.length - 1){
if (!predicate(iterable[ counter ])){
if (flag) flag = false
} else if (flag){
holder.push(iterable[ counter ])
}
}
holder
return toReturn
return isArray ? holder : holder.join('')
}

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc