fortepiano 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,27 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [0.1.5](https://github.com/facile-it/fortepiano/compare/v0.1.4...v0.1.5) - 2022-09-22
8
+
9
+ ### Added
10
+
11
+ - Add `prefix` to `string` module.
12
+ - Add `suffix` to `string` module.
13
+
14
+ ### Changed
15
+
16
+ - Changed overloads of `$mock.union` function.
17
+
18
+ ### Fixed
19
+
20
+ - Update `yarn.lock` in order to fix "typescript (18.x)" and "jest (18.x)" jobs in CI.
21
+
22
+ ## [0.1.4](https://github.com/facile-it/fortepiano/compare/v0.1.3...v0.1.4) - 2022-06-24
23
+
24
+ ### Security
25
+
26
+ - Fix CVE-2022-33987.
27
+
7
28
  ## [0.1.3](https://github.com/facile-it/fortepiano/compare/v0.1.2...v0.1.3) - 2022-05-31
8
29
 
9
30
  ### Added
@@ -69,13 +90,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
69
90
  - Replace `struct` type with `Struct`.
70
91
  - Rename `GeneratorL` module to `Yield`.
71
92
  - Use `cause` property to record wrapped errors (inspired by TC39).
72
- - Decode from Json and then from the given codec in the `get` function of the `Redis` module.
73
93
 
74
94
  ### Deprecated
75
95
 
76
96
  - Deprecate `struct` (use `Struct` instead).
77
97
  - Deprecate `GeneratorL` module (use `Yield` instead).
78
98
 
99
+ ### Fixed
100
+
101
+ - Decode from Json and then from the given codec in the `get` function of the `Redis` module.
102
+
79
103
  ## [0.1.2](https://github.com/facile-it/fortepiano/compare/v0.1.1...v0.1.2) - 2022-04-29
80
104
 
81
105
  ### Added
package/Console.d.ts CHANGED
@@ -6,7 +6,7 @@ export declare const info: (...as: ReadonlyArray<unknown>) => IO.IO<void>;
6
6
  export declare const log: (...as: ReadonlyArray<unknown>) => IO.IO<void>;
7
7
  export declare const trace: (...as: ReadonlyArray<unknown>) => IO.IO<void>;
8
8
  export declare const warn: (...as: ReadonlyArray<unknown>) => IO.IO<void>;
9
- export declare const assert: (condition?: boolean | undefined, ...as: ReadonlyArray<unknown>) => IO.IO<void>;
9
+ export declare const assert: (condition?: boolean, ...as: ReadonlyArray<unknown>) => IO.IO<void>;
10
10
  export declare const count: (a?: unknown) => IO.IO<void>;
11
11
  export declare const countReset: (a?: unknown) => IO.IO<void>;
12
12
  export declare const group: (...as: ReadonlyArray<unknown>) => IO.IO<void>;
package/Mock.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { PartialDeep } from '.';
1
2
  import * as Appli from 'fp-ts/Applicative';
2
3
  import * as _Apply from 'fp-ts/Apply';
3
4
  import * as C from 'fp-ts/Chain';
@@ -9,7 +10,6 @@ import * as MIO from 'fp-ts/MonadIO';
9
10
  import * as P from 'fp-ts/Pointed';
10
11
  import * as RNEA from 'fp-ts/ReadonlyNonEmptyArray';
11
12
  import * as RR from 'fp-ts/ReadonlyRecord';
12
- import { PartialDeep } from '.';
13
13
  export declare const URI = "Mock";
14
14
  export declare type URI = typeof URI;
15
15
  declare module 'fp-ts/HKT' {
@@ -61,6 +61,11 @@ export declare const tuple: <T extends Mock<any>[]>(...t: T & {
61
61
  }) => Mock<{ [K in keyof T]: [T[K]] extends [Mock<infer A>] ? A : never; }>;
62
62
  export declare const struct: <NER extends Record<string, Mock<any>>>(r: keyof NER extends never ? never : NER) => Mock<{ [K in keyof NER]: [NER[K]] extends [Mock<infer A>] ? A : never; }>;
63
63
  export declare const partial: <A>(Ms: EnforceNonEmptyRecord<{ readonly [K in keyof A]: Mock<A[K]>; }>) => Mock<Partial<Readonly<A>>>;
64
+ export declare function union<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(a: Mock<A>, b: Mock<B>, c: Mock<C>, d: Mock<D>, e: Mock<E>, f: Mock<F>, g: Mock<G>, h: Mock<H>, i: Mock<I>, j: Mock<J>, k: Mock<K>, l: Mock<L>, m: Mock<M>, n: Mock<N>, o: Mock<O>): Mock<A | B | C | D | E | F | G | H | I | J | K | L | M | N | O>;
65
+ export declare function union<A, B, C, D, E, F, G, H, I, J, K, L, M, N>(a: Mock<A>, b: Mock<B>, c: Mock<C>, d: Mock<D>, e: Mock<E>, f: Mock<F>, g: Mock<G>, h: Mock<H>, i: Mock<I>, j: Mock<J>, k: Mock<K>, l: Mock<L>, m: Mock<M>, n: Mock<N>): Mock<A | B | C | D | E | F | G | H | I | J | K | L | M | N>;
66
+ export declare function union<A, B, C, D, E, F, G, H, I, J, K, L, M>(a: Mock<A>, b: Mock<B>, c: Mock<C>, d: Mock<D>, e: Mock<E>, f: Mock<F>, g: Mock<G>, h: Mock<H>, i: Mock<I>, j: Mock<J>, k: Mock<K>, l: Mock<L>, m: Mock<M>): Mock<A | B | C | D | E | F | G | H | I | J | K | L | M>;
67
+ export declare function union<A, B, C, D, E, F, G, H, I, J, K, L>(a: Mock<A>, b: Mock<B>, c: Mock<C>, d: Mock<D>, e: Mock<E>, f: Mock<F>, g: Mock<G>, h: Mock<H>, i: Mock<I>, j: Mock<J>, k: Mock<K>, l: Mock<L>): Mock<A | B | C | D | E | F | G | H | I | J | K | L>;
68
+ export declare function union<A, B, C, D, E, F, G, H, I, J, K>(a: Mock<A>, b: Mock<B>, c: Mock<C>, d: Mock<D>, e: Mock<E>, f: Mock<F>, g: Mock<G>, h: Mock<H>, i: Mock<I>, j: Mock<J>, k: Mock<K>): Mock<A | B | C | D | E | F | G | H | I | J | K>;
64
69
  export declare function union<A, B, C, D, E, F, G, H, I, J>(a: Mock<A>, b: Mock<B>, c: Mock<C>, d: Mock<D>, e: Mock<E>, f: Mock<F>, g: Mock<G>, h: Mock<H>, i: Mock<I>, j: Mock<J>): Mock<A | B | C | D | E | F | G | H | I | J>;
65
70
  export declare function union<A, B, C, D, E, F, G, H, I>(a: Mock<A>, b: Mock<B>, c: Mock<C>, d: Mock<D>, e: Mock<E>, f: Mock<F>, g: Mock<G>, h: Mock<H>, i: Mock<I>): Mock<A | B | C | D | E | F | G | H | I>;
66
71
  export declare function union<A, B, C, D, E, F, G, H>(a: Mock<A>, b: Mock<B>, c: Mock<C>, d: Mock<D>, e: Mock<E>, f: Mock<F>, g: Mock<G>, h: Mock<H>): Mock<A | B | C | D | E | F | G | H>;
package/Type.d.ts CHANGED
@@ -4,10 +4,10 @@ export declare const numeric: t.Type<number, number, unknown>;
4
4
  export declare function literal<V extends number | string>(value: V, name?: string): t.LiteralC<V>;
5
5
  export declare function literal(regExp: RegExp, name?: string): t.StringC;
6
6
  export declare const struct: t.Type<object, object, unknown>;
7
- export declare const nullable: <C extends t.Mixed>(codec: C, name?: string | undefined) => t.UnionC<[C, t.UndefinedC]>;
7
+ export declare const nullable: <C extends t.Mixed>(codec: C, name?: string) => t.UnionC<[C, t.UndefinedC]>;
8
8
  export declare const alias: <C extends t.Mixed>(name: string, codec: C) => t.Type<t.TypeOf<C>, t.OutputOf<C>, t.InputOf<C>>;
9
9
  export declare function literalUnion<A extends number | string, B extends {
10
10
  readonly [K in A]: null;
11
11
  }>(strings: Readonly<[A, A, ...ReadonlyArray<A>]>, name?: string): t.KeyofC<B>;
12
- export declare const lax: <P extends t.Props>(props: P, name?: string | undefined) => t.Type<{ [K in keyof P]?: t.TypeOf<P[K]> | undefined; }, { [K_1 in keyof P]?: t.OutputOf<P[K_1]> | undefined; }, unknown>;
12
+ export declare const lax: <P extends t.Props>(props: P, name?: string) => t.Type<{ [K in keyof P]?: t.TypeOf<P[K]> | undefined; }, { [K_1 in keyof P]?: t.OutputOf<P[K_1]> | undefined; }, unknown>;
13
13
  export declare const decode: <C extends t.Mixed>(codec: C) => (u: unknown) => E.Either<Error, t.TypeOf<C>>;
@@ -1,4 +1,4 @@
1
1
  import { Lazy } from 'fp-ts/function';
2
2
  import * as $C from '../Cache';
3
- declare const _storage: (storage: Lazy<Storage>, name?: string | undefined, ttl?: number) => $C.Cache;
3
+ declare const _storage: (storage: Lazy<Storage>, name?: string, ttl?: number) => $C.Cache;
4
4
  export { _storage as storage };
package/esm/Mock.js CHANGED
@@ -1,3 +1,7 @@
1
+ import { curry, recurse, run } from './function';
2
+ import * as $St from './struct';
3
+ import * as $t from './Type';
4
+ import * as $Y from './Yield';
1
5
  import * as _Apply from 'fp-ts/Apply';
2
6
  import * as C from 'fp-ts/Chain';
3
7
  import * as FIO from 'fp-ts/FromIO';
@@ -14,10 +18,6 @@ import * as RNEA from 'fp-ts/ReadonlyNonEmptyArray';
14
18
  import * as RR from 'fp-ts/ReadonlyRecord';
15
19
  import * as Se from 'fp-ts/Semigroup';
16
20
  import * as t from 'io-ts';
17
- import { curry, recurse, run } from './function';
18
- import * as $St from './struct';
19
- import * as $t from './Type';
20
- import * as $Y from './Yield';
21
21
  export const URI = 'Mock';
22
22
  export const Functor = {
23
23
  URI,
package/esm/string.js CHANGED
@@ -3,4 +3,6 @@ export const uppercase = (s) => s.toUpperCase();
3
3
  export const lowercase = (s) => s.toLowerCase();
4
4
  export const capitalize = (s) => (S.isEmpty(s) ? s : s[0].toUpperCase() + s.slice(1));
5
5
  export const uncapitalize = (s) => (S.isEmpty(s) ? s : s[0].toLowerCase() + s.slice(1));
6
+ export const prefix = (prefix) => (s) => `${prefix}${s}`;
7
+ export const suffix = (suffix) => (s) => `${s}${suffix}`;
6
8
  export const test = (re) => (s) => re.test(s);
package/lib/Console.d.ts CHANGED
@@ -6,7 +6,7 @@ export declare const info: (...as: ReadonlyArray<unknown>) => IO.IO<void>;
6
6
  export declare const log: (...as: ReadonlyArray<unknown>) => IO.IO<void>;
7
7
  export declare const trace: (...as: ReadonlyArray<unknown>) => IO.IO<void>;
8
8
  export declare const warn: (...as: ReadonlyArray<unknown>) => IO.IO<void>;
9
- export declare const assert: (condition?: boolean | undefined, ...as: ReadonlyArray<unknown>) => IO.IO<void>;
9
+ export declare const assert: (condition?: boolean, ...as: ReadonlyArray<unknown>) => IO.IO<void>;
10
10
  export declare const count: (a?: unknown) => IO.IO<void>;
11
11
  export declare const countReset: (a?: unknown) => IO.IO<void>;
12
12
  export declare const group: (...as: ReadonlyArray<unknown>) => IO.IO<void>;
package/lib/Mock.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { PartialDeep } from '.';
1
2
  import * as Appli from 'fp-ts/Applicative';
2
3
  import * as _Apply from 'fp-ts/Apply';
3
4
  import * as C from 'fp-ts/Chain';
@@ -9,7 +10,6 @@ import * as MIO from 'fp-ts/MonadIO';
9
10
  import * as P from 'fp-ts/Pointed';
10
11
  import * as RNEA from 'fp-ts/ReadonlyNonEmptyArray';
11
12
  import * as RR from 'fp-ts/ReadonlyRecord';
12
- import { PartialDeep } from '.';
13
13
  export declare const URI = "Mock";
14
14
  export declare type URI = typeof URI;
15
15
  declare module 'fp-ts/HKT' {
@@ -61,6 +61,11 @@ export declare const tuple: <T extends Mock<any>[]>(...t: T & {
61
61
  }) => Mock<{ [K in keyof T]: [T[K]] extends [Mock<infer A>] ? A : never; }>;
62
62
  export declare const struct: <NER extends Record<string, Mock<any>>>(r: keyof NER extends never ? never : NER) => Mock<{ [K in keyof NER]: [NER[K]] extends [Mock<infer A>] ? A : never; }>;
63
63
  export declare const partial: <A>(Ms: EnforceNonEmptyRecord<{ readonly [K in keyof A]: Mock<A[K]>; }>) => Mock<Partial<Readonly<A>>>;
64
+ export declare function union<A, B, C, D, E, F, G, H, I, J, K, L, M, N, O>(a: Mock<A>, b: Mock<B>, c: Mock<C>, d: Mock<D>, e: Mock<E>, f: Mock<F>, g: Mock<G>, h: Mock<H>, i: Mock<I>, j: Mock<J>, k: Mock<K>, l: Mock<L>, m: Mock<M>, n: Mock<N>, o: Mock<O>): Mock<A | B | C | D | E | F | G | H | I | J | K | L | M | N | O>;
65
+ export declare function union<A, B, C, D, E, F, G, H, I, J, K, L, M, N>(a: Mock<A>, b: Mock<B>, c: Mock<C>, d: Mock<D>, e: Mock<E>, f: Mock<F>, g: Mock<G>, h: Mock<H>, i: Mock<I>, j: Mock<J>, k: Mock<K>, l: Mock<L>, m: Mock<M>, n: Mock<N>): Mock<A | B | C | D | E | F | G | H | I | J | K | L | M | N>;
66
+ export declare function union<A, B, C, D, E, F, G, H, I, J, K, L, M>(a: Mock<A>, b: Mock<B>, c: Mock<C>, d: Mock<D>, e: Mock<E>, f: Mock<F>, g: Mock<G>, h: Mock<H>, i: Mock<I>, j: Mock<J>, k: Mock<K>, l: Mock<L>, m: Mock<M>): Mock<A | B | C | D | E | F | G | H | I | J | K | L | M>;
67
+ export declare function union<A, B, C, D, E, F, G, H, I, J, K, L>(a: Mock<A>, b: Mock<B>, c: Mock<C>, d: Mock<D>, e: Mock<E>, f: Mock<F>, g: Mock<G>, h: Mock<H>, i: Mock<I>, j: Mock<J>, k: Mock<K>, l: Mock<L>): Mock<A | B | C | D | E | F | G | H | I | J | K | L>;
68
+ export declare function union<A, B, C, D, E, F, G, H, I, J, K>(a: Mock<A>, b: Mock<B>, c: Mock<C>, d: Mock<D>, e: Mock<E>, f: Mock<F>, g: Mock<G>, h: Mock<H>, i: Mock<I>, j: Mock<J>, k: Mock<K>): Mock<A | B | C | D | E | F | G | H | I | J | K>;
64
69
  export declare function union<A, B, C, D, E, F, G, H, I, J>(a: Mock<A>, b: Mock<B>, c: Mock<C>, d: Mock<D>, e: Mock<E>, f: Mock<F>, g: Mock<G>, h: Mock<H>, i: Mock<I>, j: Mock<J>): Mock<A | B | C | D | E | F | G | H | I | J>;
65
70
  export declare function union<A, B, C, D, E, F, G, H, I>(a: Mock<A>, b: Mock<B>, c: Mock<C>, d: Mock<D>, e: Mock<E>, f: Mock<F>, g: Mock<G>, h: Mock<H>, i: Mock<I>): Mock<A | B | C | D | E | F | G | H | I>;
66
71
  export declare function union<A, B, C, D, E, F, G, H>(a: Mock<A>, b: Mock<B>, c: Mock<C>, d: Mock<D>, e: Mock<E>, f: Mock<F>, g: Mock<G>, h: Mock<H>): Mock<A | B | C | D | E | F | G | H>;
package/lib/Mock.js CHANGED
@@ -24,10 +24,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.null = exports.undefined = exports.void = exports.readonlyRecord = exports.readonlyNonEmptyArray = exports.readonlyArray = exports.union = exports.partial = exports.struct = exports.tuple = exports.nullable = exports.unknown = exports.literal = exports.string = exports.number = exports.integer = exports.float = exports.boolean = exports.MonadIO = exports.chainFirstIOK = exports.chainIOK = exports.fromIOK = exports.fromIO = exports.FromIO = exports.Monad = exports.bind = exports.chainFirst = exports.chain = exports.Chain = exports.Applicative = exports.apS = exports.apSecond = exports.apFirst = exports.ap = exports.Apply = exports.Do = exports.of = exports.Pointed = exports.bindTo = exports.flap = exports.map = exports.Functor = exports.URI = void 0;
27
+ const function_1 = require("./function");
28
+ const $St = __importStar(require("./struct"));
29
+ const $t = __importStar(require("./Type"));
30
+ const $Y = __importStar(require("./Yield"));
27
31
  const _Apply = __importStar(require("fp-ts/Apply"));
28
32
  const C = __importStar(require("fp-ts/Chain"));
29
33
  const FIO = __importStar(require("fp-ts/FromIO"));
30
- const function_1 = require("fp-ts/function");
34
+ const function_2 = require("fp-ts/function");
31
35
  const F = __importStar(require("fp-ts/Functor"));
32
36
  const IO = __importStar(require("fp-ts/IO"));
33
37
  const N = __importStar(require("fp-ts/number"));
@@ -40,63 +44,59 @@ const RNEA = __importStar(require("fp-ts/ReadonlyNonEmptyArray"));
40
44
  const RR = __importStar(require("fp-ts/ReadonlyRecord"));
41
45
  const Se = __importStar(require("fp-ts/Semigroup"));
42
46
  const t = __importStar(require("io-ts"));
43
- const function_2 = require("./function");
44
- const $St = __importStar(require("./struct"));
45
- const $t = __importStar(require("./Type"));
46
- const $Y = __importStar(require("./Yield"));
47
47
  exports.URI = 'Mock';
48
48
  exports.Functor = {
49
49
  URI: exports.URI,
50
- map: (fa, f) => (0, function_1.pipe)(fa(), IO.map(f), exports.FromIO.fromIO),
50
+ map: (fa, f) => (0, function_2.pipe)(fa(), IO.map(f), exports.FromIO.fromIO),
51
51
  };
52
- exports.map = (0, function_2.curry)((0, function_1.flip)(exports.Functor.map));
52
+ exports.map = (0, function_1.curry)((0, function_2.flip)(exports.Functor.map));
53
53
  exports.flap = F.flap(exports.Functor);
54
54
  exports.bindTo = F.bindTo(exports.Functor);
55
55
  exports.Pointed = {
56
56
  URI: exports.URI,
57
- of: (a) => (...as) => (0, function_1.pipe)(as, RNEA.fromReadonlyArray, Op.traverse(IO.Applicative)(R.randomElem), IO.map(Op.match(() => a, (_a) => $t.struct.is(a) && $t.struct.is(_a)
58
- ? (0, function_1.pipe)(_a, $St.filterDeep(Pr.not(t.undefined.is)), (_a) => $St.patch(_a)(a))
57
+ of: (a) => (...as) => (0, function_2.pipe)(as, RNEA.fromReadonlyArray, Op.traverse(IO.Applicative)(R.randomElem), IO.map(Op.match(() => a, (_a) => $t.struct.is(a) && $t.struct.is(_a)
58
+ ? (0, function_2.pipe)(_a, $St.filterDeep(Pr.not(t.undefined.is)), (_a) => $St.patch(_a)(a))
59
59
  : _a))),
60
60
  };
61
61
  exports.of = exports.Pointed.of;
62
62
  exports.Do = exports.Pointed.of({});
63
- exports.Apply = Object.assign(Object.assign({}, exports.Functor), { ap: (fab, fa) => exports.Chain.chain(fab, (0, function_2.curry)(exports.Functor.map)(fa)) });
64
- exports.ap = (0, function_2.curry)((0, function_1.flip)(exports.Apply.ap));
63
+ exports.Apply = Object.assign(Object.assign({}, exports.Functor), { ap: (fab, fa) => exports.Chain.chain(fab, (0, function_1.curry)(exports.Functor.map)(fa)) });
64
+ exports.ap = (0, function_1.curry)((0, function_2.flip)(exports.Apply.ap));
65
65
  exports.apFirst = _Apply.apFirst(exports.Apply);
66
66
  exports.apSecond = _Apply.apSecond(exports.Apply);
67
67
  exports.apS = _Apply.apS(exports.Apply);
68
68
  exports.Applicative = Object.assign(Object.assign({}, exports.Pointed), exports.Apply);
69
69
  exports.Chain = Object.assign(Object.assign({}, exports.Apply), { chain: (fa, f) => exports.Functor.map(exports.Functor.map(fa, f), (fb) => fb()()) });
70
- exports.chain = (0, function_2.curry)((0, function_1.flip)(exports.Chain.chain));
70
+ exports.chain = (0, function_1.curry)((0, function_2.flip)(exports.Chain.chain));
71
71
  exports.chainFirst = C.chainFirst(exports.Chain);
72
72
  exports.bind = C.bind(exports.Chain);
73
73
  exports.Monad = Object.assign(Object.assign({}, exports.Applicative), exports.Chain);
74
74
  exports.FromIO = {
75
75
  URI: exports.URI,
76
- fromIO: (fa) => (...as) => (0, function_1.pipe)(fa, IO.chain((a) => exports.Pointed.of(a)(...as))),
76
+ fromIO: (fa) => (...as) => (0, function_2.pipe)(fa, IO.chain((a) => exports.Pointed.of(a)(...as))),
77
77
  };
78
78
  exports.fromIO = exports.FromIO.fromIO;
79
79
  exports.fromIOK = FIO.fromIOK(exports.FromIO);
80
80
  exports.chainIOK = FIO.chainIOK(exports.FromIO, exports.Chain);
81
81
  exports.chainFirstIOK = FIO.chainFirstIOK(exports.FromIO, exports.Chain);
82
82
  exports.MonadIO = Object.assign(Object.assign({}, exports.Monad), exports.FromIO);
83
- const _void = () => function_1.constVoid;
83
+ const _void = () => function_2.constVoid;
84
84
  exports.void = _void;
85
- const _undefined = () => function_1.constUndefined;
85
+ const _undefined = () => function_2.constUndefined;
86
86
  exports.undefined = _undefined;
87
- const _null = () => function_1.constNull;
87
+ const _null = () => function_2.constNull;
88
88
  exports.null = _null;
89
89
  exports.boolean = (0, exports.fromIO)(R.randomBool);
90
- const float = (min = Number.MIN_SAFE_INTEGER * 1e-6, max = Number.MAX_SAFE_INTEGER * 1e-6) => (...as) => (0, function_1.pipe)((0, exports.fromIO)(R.randomRange(min, Math.max(min + Number.EPSILON, max)))(...as), IO.map(Or.clamp(N.Ord)(min, Math.max(min + Number.EPSILON, max - Number.EPSILON))));
90
+ const float = (min = Number.MIN_SAFE_INTEGER * 1e-6, max = Number.MAX_SAFE_INTEGER * 1e-6) => (...as) => (0, function_2.pipe)((0, exports.fromIO)(R.randomRange(min, Math.max(min + Number.EPSILON, max)))(...as), IO.map(Or.clamp(N.Ord)(min, Math.max(min + Number.EPSILON, max - Number.EPSILON))));
91
91
  exports.float = float;
92
- const integer = (min = Number.MIN_SAFE_INTEGER * 1e-6, max = Number.MAX_SAFE_INTEGER * 1e-6) => (...as) => (0, function_1.pipe)((0, exports.float)(min, max)(...as), IO.map(Math.floor));
92
+ const integer = (min = Number.MIN_SAFE_INTEGER * 1e-6, max = Number.MAX_SAFE_INTEGER * 1e-6) => (...as) => (0, function_2.pipe)((0, exports.float)(min, max)(...as), IO.map(Math.floor));
93
93
  exports.integer = integer;
94
- const number = (min = Number.MIN_SAFE_INTEGER * 1e-6, max = Number.MAX_SAFE_INTEGER * 1e-6) => (...as) => (0, function_1.pipe)(union((0, exports.float)(min, max), (0, exports.integer)(min, max))(...as), IO.map(Or.clamp(N.Ord)(min, Math.max(min + Number.EPSILON, max - Number.EPSILON))));
94
+ const number = (min = Number.MIN_SAFE_INTEGER * 1e-6, max = Number.MAX_SAFE_INTEGER * 1e-6) => (...as) => (0, function_2.pipe)(union((0, exports.float)(min, max), (0, exports.integer)(min, max))(...as), IO.map(Or.clamp(N.Ord)(min, Math.max(min + Number.EPSILON, max - Number.EPSILON))));
95
95
  exports.number = number;
96
96
  exports.string = (0, exports.fromIO)(() => Math.random().toString(36).split('.')[1]);
97
97
  const literal = (a) => (0, exports.of)(a);
98
98
  exports.literal = literal;
99
- const unknown = (depth = 10) => (0, function_2.recurse)((_unknown, _depth) => (_depth < depth
99
+ const unknown = (depth = 10) => (0, function_1.recurse)((_unknown, _depth) => (_depth < depth
100
100
  ? union(_undefined, _null, exports.boolean, (0, exports.number)(), exports.string, (0, exports.readonlyArray)(_unknown), (0, exports.readonlyRecord)(exports.string, _unknown))
101
101
  : union(_undefined, _null, exports.boolean, (0, exports.number)(), exports.string)));
102
102
  exports.unknown = unknown;
@@ -104,15 +104,15 @@ const nullable = (M) => union(M, _undefined);
104
104
  exports.nullable = nullable;
105
105
  exports.tuple = _Apply.sequenceT(exports.Apply);
106
106
  exports.struct = _Apply.sequenceS(exports.Apply);
107
- const partial = (Ms) => (0, function_1.pipe)(Ms, RR.map(exports.nullable), exports.struct);
107
+ const partial = (Ms) => (0, function_2.pipe)(Ms, RR.map(exports.nullable), exports.struct);
108
108
  exports.partial = partial;
109
109
  function union(...Ms) {
110
- return (0, function_1.pipe)(Ms, R.randomElem, IO.chain(function_2.run), exports.fromIO);
110
+ return (0, function_2.pipe)(Ms, R.randomElem, IO.chain(function_1.run), exports.fromIO);
111
111
  }
112
112
  exports.union = union;
113
- const readonlyArray = (M, min = 0, max = 10) => (0, function_1.pipe)(R.randomInt(Math.max(0, min), Math.max(0, min, max)), IO.map((n) => (0, function_1.pipe)($Y.fromIO(M()), $Y.takeLeft(n), $Y.toReadonlyArray)), exports.fromIO);
113
+ const readonlyArray = (M, min = 0, max = 10) => (0, function_2.pipe)(R.randomInt(Math.max(0, min), Math.max(0, min, max)), IO.map((n) => (0, function_2.pipe)($Y.fromIO(M()), $Y.takeLeft(n), $Y.toReadonlyArray)), exports.fromIO);
114
114
  exports.readonlyArray = readonlyArray;
115
115
  const readonlyNonEmptyArray = (M, min = 1, max = 10) => (0, exports.readonlyArray)(M, Math.max(1, min), Math.max(1, min, max));
116
116
  exports.readonlyNonEmptyArray = readonlyNonEmptyArray;
117
- const readonlyRecord = (KM, TM, min = 0, max = 10) => (0, function_1.pipe)((0, exports.readonlyArray)((0, exports.tuple)(KM, TM), Math.max(0, min), Math.max(0, min, max))(), IO.map(RR.fromFoldable(Se.last(), RA.Foldable)), exports.fromIO);
117
+ const readonlyRecord = (KM, TM, min = 0, max = 10) => (0, function_2.pipe)((0, exports.readonlyArray)((0, exports.tuple)(KM, TM), Math.max(0, min), Math.max(0, min, max))(), IO.map(RR.fromFoldable(Se.last(), RA.Foldable)), exports.fromIO);
118
118
  exports.readonlyRecord = readonlyRecord;
package/lib/Type.d.ts CHANGED
@@ -4,10 +4,10 @@ export declare const numeric: t.Type<number, number, unknown>;
4
4
  export declare function literal<V extends number | string>(value: V, name?: string): t.LiteralC<V>;
5
5
  export declare function literal(regExp: RegExp, name?: string): t.StringC;
6
6
  export declare const struct: t.Type<object, object, unknown>;
7
- export declare const nullable: <C extends t.Mixed>(codec: C, name?: string | undefined) => t.UnionC<[C, t.UndefinedC]>;
7
+ export declare const nullable: <C extends t.Mixed>(codec: C, name?: string) => t.UnionC<[C, t.UndefinedC]>;
8
8
  export declare const alias: <C extends t.Mixed>(name: string, codec: C) => t.Type<t.TypeOf<C>, t.OutputOf<C>, t.InputOf<C>>;
9
9
  export declare function literalUnion<A extends number | string, B extends {
10
10
  readonly [K in A]: null;
11
11
  }>(strings: Readonly<[A, A, ...ReadonlyArray<A>]>, name?: string): t.KeyofC<B>;
12
- export declare const lax: <P extends t.Props>(props: P, name?: string | undefined) => t.Type<{ [K in keyof P]?: t.TypeOf<P[K]> | undefined; }, { [K_1 in keyof P]?: t.OutputOf<P[K_1]> | undefined; }, unknown>;
12
+ export declare const lax: <P extends t.Props>(props: P, name?: string) => t.Type<{ [K in keyof P]?: t.TypeOf<P[K]> | undefined; }, { [K_1 in keyof P]?: t.OutputOf<P[K_1]> | undefined; }, unknown>;
13
13
  export declare const decode: <C extends t.Mixed>(codec: C) => (u: unknown) => E.Either<Error, t.TypeOf<C>>;
@@ -1,4 +1,4 @@
1
1
  import { Lazy } from 'fp-ts/function';
2
2
  import * as $C from '../Cache';
3
- declare const _storage: (storage: Lazy<Storage>, name?: string | undefined, ttl?: number) => $C.Cache;
3
+ declare const _storage: (storage: Lazy<Storage>, name?: string, ttl?: number) => $C.Cache;
4
4
  export { _storage as storage };
package/lib/string.d.ts CHANGED
@@ -2,4 +2,6 @@ export declare const uppercase: <S extends string>(s: S) => Uppercase<S>;
2
2
  export declare const lowercase: <S extends string>(s: S) => Lowercase<S>;
3
3
  export declare const capitalize: <S extends string>(s: S) => Capitalize<S>;
4
4
  export declare const uncapitalize: <S extends string>(s: S) => Uncapitalize<S>;
5
+ export declare const prefix: <Prefix extends string>(prefix: Prefix) => <S extends string>(s: S) => `${Prefix}${S}`;
6
+ export declare const suffix: <Suffix extends string>(suffix: Suffix) => <S extends string>(s: S) => `${S}${Suffix}`;
5
7
  export declare const test: (re: RegExp) => (s: string) => boolean;
package/lib/string.js CHANGED
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.test = exports.uncapitalize = exports.capitalize = exports.lowercase = exports.uppercase = void 0;
26
+ exports.test = exports.suffix = exports.prefix = exports.uncapitalize = exports.capitalize = exports.lowercase = exports.uppercase = void 0;
27
27
  const S = __importStar(require("fp-ts/string"));
28
28
  const uppercase = (s) => s.toUpperCase();
29
29
  exports.uppercase = uppercase;
@@ -33,5 +33,9 @@ const capitalize = (s) => (S.isEmpty(s) ? s : s[0].toUpperCase() + s.slice(1));
33
33
  exports.capitalize = capitalize;
34
34
  const uncapitalize = (s) => (S.isEmpty(s) ? s : s[0].toLowerCase() + s.slice(1));
35
35
  exports.uncapitalize = uncapitalize;
36
+ const prefix = (prefix) => (s) => `${prefix}${s}`;
37
+ exports.prefix = prefix;
38
+ const suffix = (suffix) => (s) => `${s}${suffix}`;
39
+ exports.suffix = suffix;
36
40
  const test = (re) => (s) => re.test(s);
37
41
  exports.test = test;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fortepiano",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Playing actual music over fp-ts notes",
5
5
  "keywords": [
6
6
  "typescript",
@@ -100,5 +100,5 @@
100
100
  "optional": true
101
101
  }
102
102
  },
103
- "packageManager": "yarn@3.2.0"
103
+ "packageManager": "yarn@3.2.3"
104
104
  }
package/string.d.ts CHANGED
@@ -2,4 +2,6 @@ export declare const uppercase: <S extends string>(s: S) => Uppercase<S>;
2
2
  export declare const lowercase: <S extends string>(s: S) => Lowercase<S>;
3
3
  export declare const capitalize: <S extends string>(s: S) => Capitalize<S>;
4
4
  export declare const uncapitalize: <S extends string>(s: S) => Uncapitalize<S>;
5
+ export declare const prefix: <Prefix extends string>(prefix: Prefix) => <S extends string>(s: S) => `${Prefix}${S}`;
6
+ export declare const suffix: <Suffix extends string>(suffix: Suffix) => <S extends string>(s: S) => `${S}${Suffix}`;
5
7
  export declare const test: (re: RegExp) => (s: string) => boolean;