fnts 1.1.1 → 1.3.2

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.
Files changed (95) hide show
  1. package/README.md +4 -50
  2. package/compose.d.ts +9 -9
  3. package/compose.js +24 -1
  4. package/curry.d.ts +8 -5
  5. package/curry.js +37 -1
  6. package/either/either-sync.d.ts +4 -2
  7. package/either/either-sync.js +21 -1
  8. package/either/either.d.ts +4 -2
  9. package/either/either.js +18 -1
  10. package/either/index.d.ts +3 -3
  11. package/either/index.js +11 -1
  12. package/either/left.d.ts +4 -2
  13. package/either/left.js +22 -1
  14. package/either/operators/bifold/bifold.d.ts +4 -2
  15. package/either/operators/bifold/bifold.js +15 -1
  16. package/either/operators/bifold/bifoldl.d.ts +4 -2
  17. package/either/operators/bifold/bifoldl.js +17 -1
  18. package/either/operators/bifold/bifoldr.d.ts +4 -2
  19. package/either/operators/bifold/bifoldr.js +17 -1
  20. package/either/operators/bifold/index.d.ts +3 -3
  21. package/either/operators/bifold/index.js +9 -1
  22. package/either/operators/bifold-map.d.ts +6 -4
  23. package/either/operators/bifold-map.js +20 -1
  24. package/either/operators/bimap/bimap.d.ts +6 -4
  25. package/either/operators/bimap/bimap.js +20 -1
  26. package/either/operators/bimap/first.d.ts +6 -4
  27. package/either/operators/bimap/first.js +22 -1
  28. package/either/operators/bimap/index.d.ts +3 -3
  29. package/either/operators/bimap/index.js +9 -1
  30. package/either/operators/bimap/second.d.ts +6 -4
  31. package/either/operators/bimap/second.js +22 -1
  32. package/either/operators/guards.d.ts +3 -0
  33. package/either/operators/guards.js +22 -1
  34. package/either/operators/index.d.ts +3 -3
  35. package/either/operators/index.js +24 -1
  36. package/either/right.d.ts +4 -2
  37. package/either/right.js +22 -1
  38. package/guard.d.ts +6 -3
  39. package/guard.js +36 -1
  40. package/identity.d.ts +4 -2
  41. package/identity.js +12 -1
  42. package/index.d.ts +9 -5
  43. package/index.js +21 -1
  44. package/inject.d.ts +15 -0
  45. package/inject.js +23 -0
  46. package/maybe/index.d.ts +2 -2
  47. package/maybe/index.js +9 -1
  48. package/maybe/just.d.ts +4 -2
  49. package/maybe/just.js +22 -1
  50. package/maybe/maybe.d.ts +4 -2
  51. package/maybe/maybe.js +17 -1
  52. package/maybe/nothing.d.ts +4 -2
  53. package/maybe/nothing.js +22 -1
  54. package/maybe/operators/bind.d.ts +6 -4
  55. package/maybe/operators/bind.js +21 -1
  56. package/maybe/operators/fmap.d.ts +6 -4
  57. package/maybe/operators/fmap.js +22 -1
  58. package/maybe/operators/fold-map.d.ts +10 -8
  59. package/maybe/operators/fold-map.js +20 -1
  60. package/maybe/operators/fold.d.ts +4 -2
  61. package/maybe/operators/fold.js +17 -1
  62. package/maybe/operators/guards.d.ts +3 -0
  63. package/maybe/operators/guards.js +22 -1
  64. package/maybe/operators/index.d.ts +4 -4
  65. package/maybe/operators/index.js +14 -1
  66. package/package.json +10 -4
  67. package/permutation/index.d.ts +2 -0
  68. package/permutation/index.js +7 -0
  69. package/permutation/permutation-2.d.ts +8 -0
  70. package/permutation/permutation-2.js +18 -0
  71. package/permutation/permutation-3.d.ts +8 -0
  72. package/permutation/permutation-3.js +18 -0
  73. package/pipe.d.ts +9 -9
  74. package/pipe.js +24 -1
  75. package/rethrow.d.ts +9 -0
  76. package/rethrow.js +16 -0
  77. package/tap.d.ts +11 -0
  78. package/tap.js +15 -0
  79. package/ternary.d.ts +10 -0
  80. package/ternary.js +16 -0
  81. package/tsconfig.json +1 -1
  82. package/types/effect.d.ts +11 -0
  83. package/types/function.d.ts +13 -0
  84. package/types/gradual.d.ts +17 -0
  85. package/types/index.d.ts +7 -0
  86. package/{.internal → types}/last.d.ts +7 -0
  87. package/types/map.d.ts +8 -0
  88. package/{.internal → types}/slice.d.ts +7 -0
  89. package/{.internal → types}/tuple.d.ts +6 -0
  90. package/.internal/gradual.d.ts +0 -5
  91. package/.internal/map.d.ts +0 -1
  92. package/.internal/permutation-of-2.d.ts +0 -1
  93. package/.internal/permutation-of-2.js +0 -1
  94. package/.internal/permutation-of-3.d.ts +0 -1
  95. package/.internal/permutation-of-3.js +0 -1
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @module Maybe Operators
3
+ */
1
4
  import { Just } from '../just';
2
5
  import type { Maybe } from '../maybe';
3
6
  import { Nothing } from '../nothing';
@@ -8,5 +11,4 @@ export declare type Fold<Monad extends Maybe<any>> = Monad extends Just<infer Va
8
11
  /**
9
12
  * Returns the value of the provided `monad`.
10
13
  */
11
- export declare function fold<Monad extends Maybe<any>>(monad: Monad): Fold<Monad>;
12
- export default fold;
14
+ export default function fold<Monad extends Maybe<any>>(monad: Monad): Fold<Monad>;
@@ -1 +1,17 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.fold=fold,exports.default=void 0;var _just=require("../just"),_nothing=require("../nothing"),_guards=require("./guards");function fold(a){return(0,_guards.isJust)(a)?a[_just.jid]:a[_nothing.nid]}var _default=fold;exports.default=_default;
1
+ "use strict";
2
+ /**
3
+ * @module Maybe Operators
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ var just_1 = require("../just");
7
+ var nothing_1 = require("../nothing");
8
+ var guards_1 = require("./guards");
9
+ /**
10
+ * Returns the value of the provided `monad`.
11
+ */
12
+ function fold(monad) {
13
+ return guards_1.isJust(monad)
14
+ ? monad[just_1.jid]
15
+ : monad[nothing_1.nid];
16
+ }
17
+ exports.default = fold;
@@ -1,3 +1,6 @@
1
+ /**
2
+ * @module Maybe Operators
3
+ */
1
4
  import { Just } from '../just';
2
5
  import type { Maybe } from '../maybe';
3
6
  import { Nothing } from '../nothing';
@@ -1 +1,22 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.isJust=isJust,exports.isNothing=isNothing;var _just=require("../just"),_nothing=require("../nothing");function isJust(a){return Object.prototype.hasOwnProperty.call(a,_just.jid)}function isNothing(a){return Object.prototype.hasOwnProperty.call(a,_nothing.nid)}
1
+ "use strict";
2
+ /**
3
+ * @module Maybe Operators
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.isNothing = exports.isJust = void 0;
7
+ var just_1 = require("../just");
8
+ var nothing_1 = require("../nothing");
9
+ /**
10
+ * Type guard function to tell if the provided `monad` is `Just`.
11
+ */
12
+ function isJust(monad) {
13
+ return Object.prototype.hasOwnProperty.call(monad, just_1.jid);
14
+ }
15
+ exports.isJust = isJust;
16
+ /**
17
+ * Type guard function to tell if the provided `monad` is `Nothing`.
18
+ */
19
+ function isNothing(monad) {
20
+ return Object.prototype.hasOwnProperty.call(monad, nothing_1.nid);
21
+ }
22
+ exports.isNothing = isNothing;
@@ -1,5 +1,5 @@
1
- export { fmap } from './fmap';
2
- export { bind } from './bind';
3
- export { fold } from './fold';
1
+ export { default as fmap } from './fmap';
2
+ export { default as bind } from './bind';
3
+ export { default as fold } from './fold';
4
4
  export { isJust, isNothing } from './guards';
5
- export { foldMap, FoldMap } from './fold-map';
5
+ export { default as foldMap, FoldMap } from './fold-map';
@@ -1 +1,14 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),Object.defineProperty(exports,"fmap",{enumerable:!0,get:function get(){return _fmap.fmap}}),Object.defineProperty(exports,"bind",{enumerable:!0,get:function get(){return _bind.bind}}),Object.defineProperty(exports,"fold",{enumerable:!0,get:function get(){return _fold.fold}}),Object.defineProperty(exports,"isJust",{enumerable:!0,get:function get(){return _guards.isJust}}),Object.defineProperty(exports,"isNothing",{enumerable:!0,get:function get(){return _guards.isNothing}}),Object.defineProperty(exports,"foldMap",{enumerable:!0,get:function get(){return _foldMap.foldMap}}),Object.defineProperty(exports,"FoldMap",{enumerable:!0,get:function get(){return _foldMap.FoldMap}});var _fmap=require("./fmap"),_bind=require("./bind"),_fold=require("./fold"),_guards=require("./guards"),_foldMap=require("./fold-map");
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.foldMap = exports.isNothing = exports.isJust = exports.fold = exports.bind = exports.fmap = void 0;
4
+ var fmap_1 = require("./fmap");
5
+ Object.defineProperty(exports, "fmap", { enumerable: true, get: function () { return fmap_1.default; } });
6
+ var bind_1 = require("./bind");
7
+ Object.defineProperty(exports, "bind", { enumerable: true, get: function () { return bind_1.default; } });
8
+ var fold_1 = require("./fold");
9
+ Object.defineProperty(exports, "fold", { enumerable: true, get: function () { return fold_1.default; } });
10
+ var guards_1 = require("./guards");
11
+ Object.defineProperty(exports, "isJust", { enumerable: true, get: function () { return guards_1.isJust; } });
12
+ Object.defineProperty(exports, "isNothing", { enumerable: true, get: function () { return guards_1.isNothing; } });
13
+ var fold_map_1 = require("./fold-map");
14
+ Object.defineProperty(exports, "foldMap", { enumerable: true, get: function () { return fold_map_1.default; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fnts",
3
- "version": "1.1.1",
3
+ "version": "1.3.2",
4
4
  "license": "MIT",
5
5
  "author": "Dmytro Vasylkivskyi",
6
6
  "description": "TypeScript / JavaScript FP utilities",
@@ -12,9 +12,15 @@
12
12
  "typescript",
13
13
  "javascript"
14
14
  ],
15
- "homepage": "https://github.com/drizzer14/fnts",
16
- "repository": "github:drizzer14/fnts",
15
+ "homepage": "https://drizzer14.github.io/fnts",
16
+ "repository": "https://github.com/drizzer14/fnts",
17
17
  "peerDependencies": {
18
18
  "typescript": ">=4.2.2"
19
- }
19
+ },
20
+ "peerDependenciesMeta": {
21
+ "typescript": {
22
+ "optional": true
23
+ }
24
+ },
25
+ "main": "index.js"
20
26
  }
@@ -0,0 +1,2 @@
1
+ export { default as permutation2 } from './permutation-2';
2
+ export { default as permutation3 } from './permutation-3';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.permutation3 = exports.permutation2 = void 0;
4
+ var permutation_2_1 = require("./permutation-2");
5
+ Object.defineProperty(exports, "permutation2", { enumerable: true, get: function () { return permutation_2_1.default; } });
6
+ var permutation_3_1 = require("./permutation-3");
7
+ Object.defineProperty(exports, "permutation3", { enumerable: true, get: function () { return permutation_3_1.default; } });
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @module Permutation
3
+ */
4
+ import type { VariadicFunction } from './../types/function';
5
+ export declare type BinaryFunction = (a: any, b: any) => any;
6
+ export declare type FirstParameter<Function extends VariadicFunction> = Parameters<Function>[0];
7
+ export declare type SecondParameter<Function extends VariadicFunction> = Parameters<Function>[1];
8
+ export default function permutation2<Function extends BinaryFunction>(fn: Function, shouldCurry?: (a: FirstParameter<Function> | SecondParameter<Function>, b: SecondParameter<Function> | undefined) => boolean): VariadicFunction;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ /**
3
+ * @module Permutation
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ function permutation2(fn, shouldCurry) {
7
+ return function () {
8
+ var args = [];
9
+ for (var _i = 0; _i < arguments.length; _i++) {
10
+ args[_i] = arguments[_i];
11
+ }
12
+ var a1 = args[0], b = args[1];
13
+ return (shouldCurry === null || shouldCurry === void 0 ? void 0 : shouldCurry(a1, b)) || args.length < fn.length
14
+ ? function (a2) { return fn(a2, a1); }
15
+ : fn(a1, b);
16
+ };
17
+ }
18
+ exports.default = permutation2;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @module Permutation
3
+ */
4
+ import type { VariadicFunction } from './../types/function';
5
+ import type { FirstParameter, SecondParameter } from './permutation-2';
6
+ export declare type TernaryFunction = (a: any, b: any, c: any) => any;
7
+ export declare type ThirdParameter<Function extends VariadicFunction> = Parameters<Function>[2];
8
+ export default function permutation3<Function extends TernaryFunction>(fn: Function, shouldCurry?: (a: FirstParameter<Function> | SecondParameter<Function>, b: SecondParameter<Function> | ThirdParameter<Function>, c: ThirdParameter<Function> | undefined) => boolean): VariadicFunction;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ /**
3
+ * @module Permutation
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ function permutation3(fn, shouldCurry) {
7
+ return function () {
8
+ var args = [];
9
+ for (var _i = 0; _i < arguments.length; _i++) {
10
+ args[_i] = arguments[_i];
11
+ }
12
+ var a1 = args[0], b = args[1], c = args[2];
13
+ return (shouldCurry === null || shouldCurry === void 0 ? void 0 : shouldCurry(a1, b, c)) || args.length < fn.length
14
+ ? function (a2) { return fn(a2, a1, b); }
15
+ : fn(a1, b, c);
16
+ };
17
+ }
18
+ exports.default = permutation3;
package/pipe.d.ts CHANGED
@@ -1,4 +1,8 @@
1
- import type { Last } from './.internal/last';
1
+ /**
2
+ * @module Composition
3
+ */
4
+ import type { Last } from './types/last';
5
+ import type { UnaryFunction } from './types/function';
2
6
  /**
3
7
  * Creates a `Pipeline` type which parses all of the provided functions' types.
4
8
  * Any function with either an incorrect argument or a return type will not fit
@@ -6,16 +10,12 @@ import type { Last } from './.internal/last';
6
10
  * type matches the return type of the previous function and its return type
7
11
  * matches the type of the next function's argument.
8
12
  */
9
- export declare type Pipeline<Functions extends Array<(...args: any[]) => any>, Length extends number = Functions['length']> = Length extends 1 ? Functions : Functions extends [infer First, infer Second, ...infer Rest] ? [
13
+ export declare type Pipeline<Functions extends UnaryFunction[], Length extends number = Functions['length']> = Length extends 1 ? Functions : Functions extends [infer First, infer Second, ...infer Rest] ? [
10
14
  First,
11
- ...Pipeline<[
12
- (arg: ReturnType<First>) => ReturnType<Second>,
13
- ...Rest
14
- ]>
15
- ] : any;
15
+ ...Pipeline<First extends UnaryFunction ? Second extends UnaryFunction ? Rest extends UnaryFunction[] ? [(arg: ReturnType<First>) => ReturnType<Second>, ...Rest] : never : never : never>
16
+ ] : Functions;
16
17
  /**
17
18
  * Applies all of the provided `functions` one-by-one in left-to-right order
18
19
  * starting from the `argument`.
19
20
  */
20
- export declare function pipe<Functions extends Array<(arg: any) => any>>(...functions: Pipeline<Functions>): (arg: Parameters<Functions[0]>[0]) => ReturnType<Last<Functions>>;
21
- export default pipe;
21
+ export default function pipe<Functions extends Array<(arg: any) => any>>(...functions: Pipeline<Functions>): (arg: Parameters<Functions[0]>[0]) => ReturnType<Last<Functions>>;
package/pipe.js CHANGED
@@ -1 +1,24 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.pipe=pipe,exports.default=void 0;function pipe(){for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];return a=>{for(var c,d=b.length,e=a,f=0;f<d;f+=1)c=b[f],e=c(e);return e}}var _default=pipe;exports.default=_default;
1
+ "use strict";
2
+ /**
3
+ * @module Composition
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ /**
7
+ * Applies all of the provided `functions` one-by-one in left-to-right order
8
+ * starting from the `argument`.
9
+ */
10
+ function pipe() {
11
+ var functions = [];
12
+ for (var _i = 0; _i < arguments.length; _i++) {
13
+ functions[_i] = arguments[_i];
14
+ }
15
+ return function (arg) {
16
+ var length = functions.length;
17
+ var pipeline = arg;
18
+ for (var index = 0; index < length; index += 1) {
19
+ pipeline = functions[index](pipeline);
20
+ }
21
+ return pipeline;
22
+ };
23
+ }
24
+ exports.default = pipe;
package/rethrow.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @module Side Effects
3
+ */
4
+ import type { Effect } from './types/effect';
5
+ /**
6
+ * Rethrows a received error
7
+ * performing an optional side effect.
8
+ */
9
+ export default function rethrow<Error>(effect: Effect<(error: Error) => never>): (error: Error) => never;
package/rethrow.js ADDED
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ /**
3
+ * @module Side Effects
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ var inject_1 = require("./inject");
7
+ /**
8
+ * Rethrows a received error
9
+ * performing an optional side effect.
10
+ */
11
+ function rethrow(effect) {
12
+ return inject_1.default(function (error) {
13
+ throw error;
14
+ }, effect);
15
+ }
16
+ exports.default = rethrow;
package/tap.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @module Side Effects
3
+ */
4
+ import type { Map } from './types/map';
5
+ import type { Identity } from './identity';
6
+ import type { Effect } from './types/effect';
7
+ /**
8
+ * Performs a side effect
9
+ * passing the received argument through itself.
10
+ */
11
+ export default function tap<Value>(effect: Effect<Map<Value, any>>): Identity<Value>;
package/tap.js ADDED
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ /**
3
+ * @module Side Effects
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ var inject_1 = require("./inject");
7
+ var identity_1 = require("./identity");
8
+ /**
9
+ * Performs a side effect
10
+ * passing the received argument through itself.
11
+ */
12
+ function tap(effect) {
13
+ return inject_1.default(identity_1.default, effect);
14
+ }
15
+ exports.default = tap;
package/ternary.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @module Ternary
3
+ */
4
+ import type { Map } from './types/map';
5
+ /**
6
+ * Functional alternative to the ternary operator.
7
+ * Enforces the same return type for both branches,
8
+ * the result is evaluated lazily.
9
+ */
10
+ export default function ternary<Value, Return>(predicate: Map<Value, boolean>, left: Map<Value, Return>, right: Map<Value, Return>): Map<Value, Return>;
package/ternary.js ADDED
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ /**
3
+ * @module Ternary
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ /**
7
+ * Functional alternative to the ternary operator.
8
+ * Enforces the same return type for both branches,
9
+ * the result is evaluated lazily.
10
+ */
11
+ function ternary(predicate, left, right) {
12
+ return function (value) {
13
+ return predicate(value) ? left(value) : right(value);
14
+ };
15
+ }
16
+ exports.default = ternary;
package/tsconfig.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "target": "es2019",
3
+ "target": "esnext",
4
4
  "module": "esnext",
5
5
  "moduleResolution": "node",
6
6
  "lib": [
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @module Types
3
+ */
4
+
5
+ import type { VariadicFunction } from './function';
6
+
7
+ /**
8
+ * A simple side effect function descriptor.
9
+ */
10
+ export type Effect<Function extends VariadicFunction> =
11
+ (...args: Parameters<Function>) => void
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @module Types
3
+ */
4
+
5
+ /**
6
+ * A type of a function accepting exactly one argument
7
+ */
8
+ export type UnaryFunction = (arg: any) => any
9
+
10
+ /**
11
+ * A type of a function accepting an arbitrary amount of arguments
12
+ */
13
+ export type VariadicFunction = (...args: any[]) => any
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @module Types
3
+ */
4
+
5
+ /**
6
+ * Gradual defines a tuple type which accepts any amount
7
+ * of entries from the original one.
8
+ *
9
+ * ```typescript
10
+ * Gradual<[1, 2, 3]> === [1] | [1, 2] | [1, 2, 3]
11
+ * ```
12
+ */
13
+ export type Gradual<T extends any[] | readonly any[]> = T extends [...infer R, any]
14
+ ? R['length'] extends 0
15
+ ? T
16
+ : T | Gradual<R>
17
+ : T
@@ -0,0 +1,7 @@
1
+ export type { Map } from './map';
2
+ export type { Last } from './last';
3
+ export type { Slice } from './slice';
4
+ export type { Tuple } from './tuple';
5
+ export type { Effect } from './effect';
6
+ export type { Gradual } from './gradual';
7
+ export type { UnaryFunction, VariadicFunction } from './function';
@@ -1,3 +1,10 @@
1
+ /**
2
+ * @module Types
3
+ */
4
+
5
+ /**
6
+ * Picks the last entry from the tuple or array.
7
+ */
1
8
  export type Last<T extends any[]> =
2
9
  T extends [...any[], infer L]
3
10
  ? L
package/types/map.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @module Types
3
+ */
4
+
5
+ /**
6
+ * A type of a function which maps the original value type to another one.
7
+ */
8
+ export type Map<From, To> = (value: From) => To
@@ -1,5 +1,12 @@
1
+ /**
2
+ * @module Types
3
+ */
4
+
1
5
  import type { Tuple } from './tuple'
2
6
 
7
+ /**
8
+ * Slices the tuple by `C` amount of entries from the **end**.
9
+ */
3
10
  export type Slice<
4
11
  T extends any[] | readonly any[],
5
12
  C extends number
@@ -1,4 +1,10 @@
1
1
  /**
2
+ * @module Types
3
+ */
4
+
5
+ /**
6
+ * Creates a tuple of specified length.
7
+ *
2
8
  * {@link https://itnext.io/implementing-arithmetic-within-typescripts-type-system-a1ef140a6f6f Gracefully borrowed from here}
3
9
  */
4
10
  export type Tuple<L extends number, T extends any[] | readonly any[] = []> =
@@ -1,5 +0,0 @@
1
- export type Gradual<T extends any[] | readonly any[]> = T extends [...infer R, any]
2
- ? R['length'] extends 0
3
- ? T
4
- : T | Gradual<R>
5
- : T
@@ -1 +0,0 @@
1
- export type Map<From, To> = (value: From) => To
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.permutationOf2=void 0;var permutationOf2=(a,c)=>function(){for(var d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];var[g,h]=e;return null!==c&&void 0!==c&&c(g,h)||e.length<a.length?b=>a(b,g):a(g,h)};exports.permutationOf2=permutationOf2;var _default=permutationOf2;exports.default=_default;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=exports.permutationOf3=void 0;var permutationOf3=a=>function(){for(var d=arguments.length,e=Array(d),f=0;f<d;f++)e[f]=arguments[f];var[g,h,b]=e;return e.length<a.length?b=>a(b,g,h):a(g,h,b)};exports.permutationOf3=permutationOf3;var _default=permutationOf3;exports.default=_default;