functype 0.8.35 → 0.8.37

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 (86) hide show
  1. package/README.md +43 -43
  2. package/dist/chunk-4H62YQ42.mjs +0 -0
  3. package/dist/chunk-BOSMSYRM.mjs +1 -0
  4. package/dist/chunk-KJV27YM3.js +1 -0
  5. package/dist/chunk-WTWWDZY6.js +1 -0
  6. package/dist/collections/index.d.mts +1 -1
  7. package/dist/collections/index.d.ts +1 -1
  8. package/dist/core/task/Task.d.mts +1 -1
  9. package/dist/core/task/Task.d.ts +1 -1
  10. package/dist/core/task/Task.js +1 -1
  11. package/dist/core/task/Task.mjs +1 -1
  12. package/dist/either/Either.d.mts +1 -1
  13. package/dist/either/Either.d.ts +1 -1
  14. package/dist/either/Either.js +1 -1
  15. package/dist/either/Either.mjs +1 -1
  16. package/dist/functor/index.d.mts +4 -1
  17. package/dist/functor/index.d.ts +4 -1
  18. package/dist/{index-B6k3GVAd.d.ts → index-1xz2kaxi.d.ts} +53 -59
  19. package/dist/{index-Cwkc_dEO.d.mts → index-DvBKFQoa.d.mts} +53 -59
  20. package/dist/index.d.mts +3 -3
  21. package/dist/index.d.ts +3 -3
  22. package/dist/index.js +1 -1
  23. package/dist/index.mjs +1 -1
  24. package/dist/iterable/index.d.mts +1 -1
  25. package/dist/iterable/index.d.ts +1 -1
  26. package/dist/iterable/index.js +1 -1
  27. package/dist/iterable/index.mjs +1 -1
  28. package/dist/list/List.d.mts +2 -2
  29. package/dist/list/List.d.ts +2 -2
  30. package/dist/list/List.js +1 -1
  31. package/dist/list/List.mjs +1 -1
  32. package/dist/map/Map.d.mts +1 -1
  33. package/dist/map/Map.d.ts +1 -1
  34. package/dist/map/Map.js +1 -1
  35. package/dist/map/Map.mjs +1 -1
  36. package/dist/option/Option.d.mts +1 -1
  37. package/dist/option/Option.d.ts +1 -1
  38. package/dist/option/Option.js +1 -1
  39. package/dist/option/Option.mjs +1 -1
  40. package/dist/set/Set.d.mts +1 -1
  41. package/dist/set/Set.d.ts +1 -1
  42. package/dist/set/Set.js +1 -1
  43. package/dist/set/Set.mjs +1 -1
  44. package/dist/try/Try.d.mts +1 -1
  45. package/dist/try/Try.d.ts +1 -1
  46. package/dist/try/Try.js +1 -1
  47. package/dist/try/Try.mjs +1 -1
  48. package/dist/typeable/Typeable.d.mts +5 -4
  49. package/dist/typeable/Typeable.d.ts +5 -4
  50. package/dist/util/index.d.mts +1 -1
  51. package/dist/util/index.d.ts +1 -1
  52. package/dist/util/index.js +1 -1
  53. package/dist/util/index.mjs +1 -1
  54. package/dist/util/isIterable.js +1 -1
  55. package/dist/util/isIterable.mjs +1 -1
  56. package/package.json +10 -10
  57. package/dist/chunk-52OPFRS2.js +0 -1
  58. package/dist/chunk-BNNK42JC.js +0 -1
  59. package/dist/chunk-QBAH7SOA.mjs +0 -1
  60. package/dist/chunk-RRAIFS3D.mjs +0 -1
  61. package/dist/iterable/Seq.d.mts +0 -8
  62. package/dist/iterable/Seq.d.ts +0 -8
  63. package/dist/iterable/Seq.js +0 -1
  64. package/dist/iterable/Seq.mjs +0 -1
  65. package/lib/TaskPromise.d.ts +0 -3
  66. package/lib/collections/index.d.ts +0 -8
  67. package/lib/either/Either.d.ts +0 -52
  68. package/lib/either/EitherT.d.ts +0 -9
  69. package/lib/error/ParseError.d.ts +0 -6
  70. package/lib/functor/index.d.ts +0 -15
  71. package/lib/identity/Identity.d.ts +0 -4
  72. package/lib/index.d.ts +0 -21
  73. package/lib/iterable/Seq.d.ts +0 -31
  74. package/lib/iterable/index.d.ts +0 -22
  75. package/lib/list/List.d.ts +0 -26
  76. package/lib/map/Map.d.ts +0 -17
  77. package/lib/map/shim.d.ts +0 -2
  78. package/lib/option/Option.d.ts +0 -30
  79. package/lib/serializable/Serializable.d.ts +0 -15
  80. package/lib/set/Set.d.ts +0 -15
  81. package/lib/set/shim.d.ts +0 -2
  82. package/lib/try/Try.d.ts +0 -18
  83. package/lib/tuple/Tuple.d.ts +0 -9
  84. package/lib/typeable/Typeable.d.ts +0 -4
  85. package/lib/util/index.d.ts +0 -3
  86. package/lib/util/isIterable.d.ts +0 -1
@@ -1,22 +0,0 @@
1
- import { Functor, Type } from "../functor";
2
- import { Option } from "../option/Option";
3
- export type _Iterable_<A extends Type> = {
4
- count(p: (x: A) => boolean): number;
5
- find(p: (a: A) => boolean): Option<A>;
6
- forEach(f: (a: A) => void): void;
7
- exists(p: (a: A) => boolean): boolean;
8
- filter(p: (a: A) => boolean): _Iterable_<A>;
9
- filterNot(p: (a: A) => boolean): _Iterable_<A>;
10
- reduce(f: (b: A, a: A) => A): A;
11
- reduceRight(f: (b: A, a: A) => A): A;
12
- foldLeft<B>(z: B): (op: (b: B, a: A) => B) => B;
13
- foldRight<B>(z: B): (op: (a: A, b: B) => B) => B;
14
- get head(): A;
15
- get headOption(): Option<A>;
16
- get isEmpty(): boolean;
17
- map<B extends Type>(f: (a: A) => B): _Iterable_<B>;
18
- flatMap<B extends Type>(f: (a: A) => _Iterable_<B> | Iterable<B>): _Iterable_<B>;
19
- get size(): number;
20
- toArray(): readonly A[];
21
- } & Functor<A>;
22
- export { Seq } from "./Seq";
@@ -1,26 +0,0 @@
1
- import { Collection } from "../collections";
2
- import { _Iterable_, Seq } from "../iterable";
3
- import { Option } from "../option/Option";
4
- import { Set } from "../set/Set";
5
- import { Typeable } from "../typeable/Typeable";
6
- export type List<A> = {
7
- add: (item: A) => List<A>;
8
- map: <B>(f: (a: A) => B) => List<B>;
9
- flatMap: <B>(f: (a: A) => _Iterable_<B>) => List<B>;
10
- remove: (value: A) => List<A>;
11
- contains: (value: A) => boolean;
12
- removeAt: (index: number) => List<A>;
13
- get: (index: number) => Option<A>;
14
- concat: (other: List<A>) => List<A>;
15
- toList: () => List<A>;
16
- toSet: () => Set<A>;
17
- toString: () => string;
18
- toValue: () => {
19
- _tag: string;
20
- value: A[];
21
- };
22
- } & Seq<A> & Typeable<"List">;
23
- type InternalList<A> = List<A> & ArrayLike<A> & _Iterable_<A> & Collection<A>;
24
- export declare const List: <A>(values?: Iterable<A> | _Iterable_<A>) => List<A>;
25
- export declare const TestList: <A>(values?: Iterable<A> | _Iterable_<A>) => InternalList<A>;
26
- export {};
package/lib/map/Map.d.ts DELETED
@@ -1,17 +0,0 @@
1
- import { Collection } from "../collections";
2
- import { Traversable } from "../index";
3
- import { _Iterable_ } from "../iterable";
4
- import { Option } from "../option/Option";
5
- import { Tuple } from "../tuple/Tuple";
6
- type SafeTraversable<K, V> = Omit<Traversable<Tuple<[K, V]>>, "map" | "flatMap">;
7
- export type Map<K, V> = {
8
- add(item: Tuple<[K, V]>): Map<K, V>;
9
- remove(value: K): Map<K, V>;
10
- map<U>(f: (value: V) => U): Map<K, U>;
11
- flatMap<K2, V2>(f: (entry: Tuple<[K, V]>) => _Iterable_<[K2, V2]>): Map<K2, V2>;
12
- get(key: K): Option<V>;
13
- getOrElse(key: K, defaultValue: V): V;
14
- orElse(key: K, alternative: Option<V>): Option<V>;
15
- } & SafeTraversable<K, V> & Collection<Tuple<[K, V]>>;
16
- export declare const Map: <K, V>(entries?: readonly (readonly [K, V])[] | IterableIterator<[K, V]> | null) => Map<K, V>;
17
- export {};
package/lib/map/shim.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export type IESMap<K, V> = Map<K, V>;
2
- export declare const ESMap: MapConstructor;
@@ -1,30 +0,0 @@
1
- import { Functor, Type } from "../functor";
2
- import { Either, List, Traversable } from "../index";
3
- import { Typeable } from "../typeable/Typeable";
4
- export type Option<T extends Type> = {
5
- readonly _tag: "Some" | "None";
6
- readonly value: T | undefined;
7
- isEmpty: boolean;
8
- get(): T;
9
- getOrElse(defaultValue: T): T;
10
- orElse(alternative: Option<T>): Option<T>;
11
- map<U extends Type>(f: (value: T) => U): Option<U>;
12
- filter(predicate: (value: T) => boolean): Option<T>;
13
- flatMap<U extends Type>(f: (value: T) => Option<U>): Option<U>;
14
- reduce<U>(f: (acc: U, value: T) => U): U;
15
- reduceRight<U>(f: (acc: U, value: T) => U): U;
16
- foldLeft<B>(z: B): (op: (b: B, a: T) => B) => B;
17
- foldRight<B>(z: B): (op: (a: T, b: B) => B) => B;
18
- toList(): List<T>;
19
- contains(value: T): boolean;
20
- size: number;
21
- toEither<E>(left: E): Either<E, T>;
22
- toString(): string;
23
- toValue(): {
24
- _tag: "Some" | "None";
25
- value: T;
26
- };
27
- } & (Traversable<T> & Functor<T> & Typeable<"Some" | "None">);
28
- export declare const Some: <T extends Type>(value: T) => Option<T>;
29
- export declare const None: <T extends Type>() => Option<T>;
30
- export declare const Option: <T extends Type>(value: T | null | undefined) => Option<T>;
@@ -1,15 +0,0 @@
1
- export type SerializableTypes = "json" | "yaml";
2
- type SerializationMethods<T> = {
3
- json: {
4
- toJSON(): string;
5
- fromJSON(json: string): T;
6
- };
7
- yaml: {
8
- toYAML(): string;
9
- fromYAML(yaml: string): T;
10
- };
11
- };
12
- export type Serializable<STypes extends SerializableTypes[], T> = T & (STypes extends [] ? NonNullable<unknown> : STypes extends [infer First, ...infer Rest] ? First extends keyof SerializationMethods<T> ? SerializationMethods<T>[First] & Serializable<Rest extends SerializableTypes[] ? Rest : [], T> : never : never);
13
- export type SupportedSerializationTypes<T> = T extends Serializable<infer Types, never> ? Types : never;
14
- export declare function createSerializable<STypes extends SerializableTypes[], T>(obj: T, serializationMethods: Pick<SerializationMethods<T>, STypes[number]>): Serializable<STypes, T>;
15
- export {};
package/lib/set/Set.d.ts DELETED
@@ -1,15 +0,0 @@
1
- import { Collection } from "../collections";
2
- import { _Iterable_ } from "../iterable";
3
- import { List } from "../list/List";
4
- export type Set<A> = {
5
- add: (value: A) => Set<A>;
6
- remove: (value: A) => Set<A>;
7
- contains: (value: A) => boolean;
8
- has: (value: A) => boolean;
9
- map: <B>(f: (a: A) => B) => Set<B>;
10
- flatMap: <B>(f: (a: A) => _Iterable_<B>) => Set<B>;
11
- toList: () => List<A>;
12
- toSet: () => Set<A>;
13
- toString: () => string;
14
- } & _Iterable_<A> & Collection<A>;
15
- export declare const Set: <A>(iterable?: Iterable<A> | _Iterable_<A>) => Set<A>;
package/lib/set/shim.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export type IESSet<T> = Set<T>;
2
- export declare const ESSet: SetConstructor;
package/lib/try/Try.d.ts DELETED
@@ -1,18 +0,0 @@
1
- import { Either } from "../either/Either";
2
- import { Typeable } from "../typeable/Typeable";
3
- export type Try<T> = {
4
- readonly _tag: "Success" | "Failure";
5
- readonly value: T | undefined;
6
- readonly error: Error | undefined;
7
- isSuccess: () => boolean;
8
- isFailure: () => boolean;
9
- get: () => T;
10
- getOrElse: (defaultValue: T) => T;
11
- orElse: (alternative: Try<T>) => Try<T>;
12
- orThrow: (error: Error) => T;
13
- toEither: () => Either<Error, T>;
14
- map: <U>(f: (value: T) => U) => Try<U>;
15
- flatMap: <U>(f: (value: T) => Try<U>) => Try<U>;
16
- toString: () => string;
17
- } & Typeable<"Success" | "Failure">;
18
- export declare const Try: <T>(f: () => T) => Try<T>;
@@ -1,9 +0,0 @@
1
- import { ArrayFunctor, ArrayType } from "../functor";
2
- export type Tuple<T extends ArrayType> = {
3
- get<K extends number>(index: K): T[K];
4
- map<U extends ArrayType>(f: (value: T) => U): Tuple<U>;
5
- flatMap<U extends ArrayType>(f: (value: T) => Tuple<U>): Tuple<U>;
6
- toArray(): T;
7
- [Symbol.iterator](): Iterator<T[number]>;
8
- } & ArrayFunctor<T>;
9
- export declare const Tuple: <T extends ArrayType>(values: T) => Tuple<T>;
@@ -1,4 +0,0 @@
1
- export declare function Typeable(type: string): {
2
- readonly _tag: string;
3
- };
4
- export type Typeable<T extends string> = ReturnType<typeof Typeable>;
@@ -1,3 +0,0 @@
1
- import { Either } from "../either/Either";
2
- import { ParseError } from "../error/ParseError";
3
- export declare const parseNumber: (input: string) => Either<ParseError, number>;
@@ -1 +0,0 @@
1
- export declare const isIterable: <T>(value: unknown) => value is Iterable<T>;