fnts 2.1.1 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/apply.js +6 -17
- package/compose.js +3 -16
- package/curry.js +6 -20
- package/either/either-sync.d.ts +1 -1
- package/either/either-sync.js +5 -8
- package/either/either.d.ts +2 -2
- package/either/either.js +5 -8
- package/either/index.d.ts +4 -4
- package/either/index.js +4 -11
- package/either/left.js +8 -13
- package/either/operators/bifold/bifold.d.ts +3 -3
- package/either/operators/bifold/bifold.js +7 -10
- package/either/operators/bifold/bifoldl.d.ts +2 -2
- package/either/operators/bifold/bifoldl.js +5 -8
- package/either/operators/bifold/bifoldr.d.ts +2 -2
- package/either/operators/bifold/bifoldr.js +5 -8
- package/either/operators/bifold/index.d.ts +3 -3
- package/either/operators/bifold/index.js +3 -9
- package/either/operators/bifold-map/bifold-map.d.ts +1 -1
- package/either/operators/bifold-map/bifold-map.js +16 -23
- package/either/operators/bifold-map/bifoldl-map.d.ts +3 -3
- package/either/operators/bifold-map/bifoldl-map.js +9 -16
- package/either/operators/bifold-map/bifoldr-map.d.ts +3 -3
- package/either/operators/bifold-map/bifoldr-map.js +9 -16
- package/either/operators/bifold-map/index.d.ts +3 -3
- package/either/operators/bifold-map/index.js +3 -9
- package/either/operators/bimap/bimap.d.ts +1 -1
- package/either/operators/bimap/bimap.js +10 -17
- package/either/operators/bimap/first.d.ts +2 -2
- package/either/operators/bimap/first.js +12 -19
- package/either/operators/bimap/index.d.ts +3 -3
- package/either/operators/bimap/index.js +3 -9
- package/either/operators/bimap/second.d.ts +2 -2
- package/either/operators/bimap/second.js +12 -19
- package/either/operators/bindr.d.ts +1 -1
- package/either/operators/bindr.js +11 -18
- package/either/operators/guards.d.ts +3 -3
- package/either/operators/guards.js +7 -13
- package/either/operators/index.d.ts +5 -5
- package/either/operators/index.js +5 -30
- package/either/right.js +8 -13
- package/guard.d.ts +3 -3
- package/guard.js +8 -19
- package/identity.js +1 -4
- package/index.d.ts +9 -10
- package/index.js +9 -23
- package/inject.js +7 -18
- package/lens/get.d.ts +24 -0
- package/lens/get.js +29 -0
- package/lens/index.d.ts +3 -0
- package/lens/index.js +3 -0
- package/lens/lens.d.ts +19 -0
- package/lens/lens.js +17 -0
- package/lens/set.d.ts +30 -0
- package/lens/set.js +44 -0
- package/maybe/index.d.ts +3 -3
- package/maybe/index.js +3 -9
- package/maybe/just.js +8 -13
- package/maybe/maybe.d.ts +2 -2
- package/maybe/maybe.js +5 -8
- package/maybe/nothing.js +7 -12
- package/maybe/operators/bind.d.ts +1 -1
- package/maybe/operators/bind.js +11 -18
- package/maybe/operators/fmap.d.ts +1 -1
- package/maybe/operators/fmap.js +12 -19
- package/maybe/operators/fold-map.d.ts +3 -3
- package/maybe/operators/fold-map.js +9 -16
- package/maybe/operators/fold.d.ts +3 -3
- package/maybe/operators/fold.js +7 -10
- package/maybe/operators/guards.d.ts +3 -3
- package/maybe/operators/guards.js +7 -13
- package/maybe/operators/index.d.ts +5 -5
- package/maybe/operators/index.js +5 -26
- package/package.json +11 -4
- package/permutation/index.d.ts +2 -2
- package/permutation/index.js +2 -7
- package/permutation/permutation-2.js +5 -12
- package/permutation/permutation-3.d.ts +1 -1
- package/permutation/permutation-3.js +5 -12
- package/pipe.js +4 -16
- package/rethrow.js +3 -6
- package/set.d.ts +24 -0
- package/set.js +35 -0
- package/tap.d.ts +1 -1
- package/tap.js +4 -7
- package/tsconfig.json +3 -3
- package/types/flatten.d.ts +34 -0
- package/types/index.d.ts +10 -7
- package/types/slice.d.ts +1 -1
- package/types/trim.d.ts +19 -0
- package/types/unshift.d.ts +16 -0
- package/get.d.ts +0 -25
- package/get.js +0 -26
package/tap.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* @module Side Effects
|
|
4
3
|
*/
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var identity_1 = require("./identity");
|
|
4
|
+
import inject from './inject.js';
|
|
5
|
+
import identity from './identity.js';
|
|
8
6
|
/**
|
|
9
7
|
* Performs a side effect
|
|
10
8
|
* passing the received argument through itself.
|
|
11
9
|
*/
|
|
12
|
-
function tap(effect) {
|
|
13
|
-
return (
|
|
10
|
+
export default function tap(effect) {
|
|
11
|
+
return inject(identity, effect);
|
|
14
12
|
}
|
|
15
|
-
exports.default = tap;
|
package/tsconfig.json
CHANGED
|
@@ -5,21 +5,21 @@
|
|
|
5
5
|
"moduleResolution": "node",
|
|
6
6
|
"lib": [
|
|
7
7
|
"es2015.iterable",
|
|
8
|
-
"
|
|
8
|
+
"esnext",
|
|
9
|
+
"dom"
|
|
9
10
|
],
|
|
11
|
+
"esModuleInterop": true,
|
|
10
12
|
"strict": true,
|
|
11
13
|
"alwaysStrict": true,
|
|
12
14
|
"skipLibCheck": true,
|
|
13
15
|
"noImplicitAny": true,
|
|
14
16
|
"noUnusedLocals": false,
|
|
15
|
-
"keyofStringsOnly": true,
|
|
16
17
|
"strictNullChecks": true,
|
|
17
18
|
"noImplicitReturns": true,
|
|
18
19
|
"noErrorTruncation": true,
|
|
19
20
|
"noUnusedParameters": false,
|
|
20
21
|
"strictFunctionTypes": true,
|
|
21
22
|
"strictBindCallApply": true,
|
|
22
|
-
"noStrictGenericChecks": true,
|
|
23
23
|
"allowUnreachableCode": false,
|
|
24
24
|
"forceConsistentCasingInFileNames": true
|
|
25
25
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Types
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Type subjective to flattening.
|
|
7
|
+
*/
|
|
8
|
+
export type Flattenable = Record<string, unknown> | any[]
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Recursively flattens object type to a union of its keys
|
|
12
|
+
* combined through dot-notation.
|
|
13
|
+
*/
|
|
14
|
+
export type Flatten<
|
|
15
|
+
Source extends Record<string, unknown> | any[],
|
|
16
|
+
> = keyof Source extends keyof any[]
|
|
17
|
+
? `${number}`
|
|
18
|
+
: (
|
|
19
|
+
| keyof Source
|
|
20
|
+
| keyof {
|
|
21
|
+
[
|
|
22
|
+
Key in keyof Source as
|
|
23
|
+
Key extends string
|
|
24
|
+
? Source[Key] extends Record<string, unknown>
|
|
25
|
+
? `${Key}.${Flatten<Source[Key]>}`
|
|
26
|
+
: Source[Key] extends any[]
|
|
27
|
+
? Source[Key] extends Array<any[]> | Record<string, unknown>[]
|
|
28
|
+
? `${Key}.${number}` | `${Key}.${number}.${Flatten<Source[Key][number]>}`
|
|
29
|
+
: `${Key}.${number}`
|
|
30
|
+
: Key
|
|
31
|
+
: never
|
|
32
|
+
] : never
|
|
33
|
+
}
|
|
34
|
+
)
|
package/types/index.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
export type
|
|
2
|
-
export type
|
|
3
|
-
export type
|
|
4
|
-
export type
|
|
5
|
-
export type
|
|
6
|
-
export type
|
|
7
|
-
export type
|
|
1
|
+
export type * from './map'
|
|
2
|
+
export type * from './last'
|
|
3
|
+
export type * from './trim'
|
|
4
|
+
export type * from './slice'
|
|
5
|
+
export type * from './tuple'
|
|
6
|
+
export type * from './effect'
|
|
7
|
+
export type * from './gradual'
|
|
8
|
+
export type * from './unshift'
|
|
9
|
+
export type * from './flatten'
|
|
10
|
+
export type * from './function'
|
package/types/slice.d.ts
CHANGED
package/types/trim.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Types
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { Tuple } from './tuple'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Removes `C` amount of `T` elements from the **end**.
|
|
9
|
+
*/
|
|
10
|
+
export type Trim<
|
|
11
|
+
T extends any[] | readonly any[],
|
|
12
|
+
C extends number
|
|
13
|
+
> = T['length'] extends C
|
|
14
|
+
? T
|
|
15
|
+
: T extends readonly [...infer S, ...Tuple<C>]
|
|
16
|
+
? S
|
|
17
|
+
: T extends [...infer S, ...Tuple<C>]
|
|
18
|
+
? S
|
|
19
|
+
: T
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module Types
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { Trim } from './trim'
|
|
6
|
+
import { Slice } from './slice'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Replaces `T` element on specified index `I` with `E`.
|
|
10
|
+
*/
|
|
11
|
+
export type Unshift<T extends any[] | readonly any[], I extends number, E> =
|
|
12
|
+
I extends 0
|
|
13
|
+
? [E, ...Slice<T, 1>]
|
|
14
|
+
: I extends Trim<T, 1>['length']
|
|
15
|
+
? [...Trim<T, 1>, E]
|
|
16
|
+
: [...Trim<T, Slice<T, I>['length']>, E, ...Slice<Slice<T, I>, 1>]
|
package/get.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module Get
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Recursively flattens object type to a union of its keys
|
|
6
|
-
* combined through dot-notation.
|
|
7
|
-
*/
|
|
8
|
-
export type Flatten<Source extends Record<string, unknown> | any[]> = keyof Source extends keyof any[] ? `${number}` : (keyof Source | keyof {
|
|
9
|
-
[Key in keyof Source as Key extends string ? Source[Key] extends Record<string, unknown> ? `${Key}.${Flatten<Source[Key]>}` : Source[Key] extends any[] ? Source[Key] extends Array<any[]> | Record<string, unknown>[] ? `${Key}.${number}` | `${Key}.${number}.${Flatten<Source[Key][number]>}` : `${Key}.${number}` : Key : never]: never;
|
|
10
|
-
});
|
|
11
|
-
/**
|
|
12
|
-
* Gets the value type inside a nested object type `Source` by provided `Path`
|
|
13
|
-
* written in dot-notation.
|
|
14
|
-
*/
|
|
15
|
-
export type Get<Source, Path extends string> = Source extends Record<string, unknown> ? Path extends `${infer Index extends number}.${infer Right}` ? Get<Source, Right> : Path extends `${infer Left extends keyof Source}.${infer Right}` ? Get<Exclude<Source[Left], undefined>, Right> | Extract<Source[Left], undefined> : Path extends keyof Source ? Source[Path] : never : Source extends any[] ? Path extends `${infer Left extends number}.${infer Right}` ? Get<Exclude<Source[Left], undefined>, Right> | Extract<Source[Left], undefined> : Path extends `${infer Index extends number}` ? Source[Index] : never : never;
|
|
16
|
-
/**
|
|
17
|
-
* Gets the value inside a nested `source` object by provided `path`
|
|
18
|
-
* written in dot-notation.
|
|
19
|
-
*/
|
|
20
|
-
export default function get<Source extends Record<string, unknown> | any[], Path extends Flatten<Source>>(path: Path): (source: Source) => Get<Source, Path>;
|
|
21
|
-
/**
|
|
22
|
-
* Gets the value inside a nested `source` object by provided `path`
|
|
23
|
-
* written in dot-notation.
|
|
24
|
-
*/
|
|
25
|
-
export default function get<Source extends Record<string, unknown> | any[], Path extends Flatten<Source>>(source: Source, path: Path): Get<Source, Path>;
|
package/get.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @module Get
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var permutation_2_1 = require("./permutation/permutation-2");
|
|
7
|
-
/**
|
|
8
|
-
* Gets the value inside a nested `source` object by provided `path`
|
|
9
|
-
* written in dot-notation.
|
|
10
|
-
*/
|
|
11
|
-
function get() {
|
|
12
|
-
var args = [];
|
|
13
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
14
|
-
args[_i] = arguments[_i];
|
|
15
|
-
}
|
|
16
|
-
return (0, permutation_2_1.default)(function (source, path) {
|
|
17
|
-
var keys = path.split('.');
|
|
18
|
-
var length = keys.length;
|
|
19
|
-
var result = source;
|
|
20
|
-
for (var index = 0; index < length; index += 1) {
|
|
21
|
-
result = result === null || result === void 0 ? void 0 : result[keys === null || keys === void 0 ? void 0 : keys[index]];
|
|
22
|
-
}
|
|
23
|
-
return result;
|
|
24
|
-
}).apply(void 0, args);
|
|
25
|
-
}
|
|
26
|
-
exports.default = get;
|