fortepiano 0.1.5 → 0.1.7
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 +12 -0
- package/ReadonlyRecord.d.ts +1 -0
- package/esm/ReadonlyRecord.js +1 -0
- package/esm/string.js +1 -0
- package/lib/ReadonlyRecord.d.ts +1 -0
- package/lib/ReadonlyRecord.js +3 -1
- package/lib/string.d.ts +1 -0
- package/lib/string.js +3 -1
- package/package.json +1 -1
- package/string.d.ts +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@ 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.7](https://github.com/facile-it/fortepiano/compare/v0.1.6...v0.1.7) - 2023-01-02
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Add `infix` to `string` module.
|
|
12
|
+
|
|
13
|
+
## [0.1.6](https://github.com/facile-it/fortepiano/compare/v0.1.5...v0.1.6) - 2022-09-30
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- Add `collectWithIndex` function to `ReadonlyRecord` module.
|
|
18
|
+
|
|
7
19
|
## [0.1.5](https://github.com/facile-it/fortepiano/compare/v0.1.4...v0.1.5) - 2022-09-22
|
|
8
20
|
|
|
9
21
|
### Added
|
package/ReadonlyRecord.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as E from 'fp-ts/Eq';
|
|
2
2
|
import * as RR from 'fp-ts/ReadonlyRecord';
|
|
3
|
+
export declare const collectWithIndex: <K extends string, A, B>(f: (k: K, a: A) => B) => (r: Readonly<Record<K, A>>) => readonly B[];
|
|
3
4
|
export declare const values: <A>(as: Readonly<Record<string, A>>) => readonly A[];
|
|
4
5
|
export declare const same: <A>(E: E.Eq<A>) => (as: Readonly<Record<string, A>>) => boolean;
|
package/esm/ReadonlyRecord.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { pipe } from 'fp-ts/function';
|
|
2
2
|
import * as $RA from './ReadonlyArray';
|
|
3
|
+
export const collectWithIndex = (f) => (r) => Object.entries(r).map(([k, v]) => f(k, v));
|
|
3
4
|
export const values = (as) => Object.values(as);
|
|
4
5
|
export const same = (E) => (as) => pipe(as, values, $RA.same(E));
|
package/esm/string.js
CHANGED
|
@@ -5,4 +5,5 @@ export const capitalize = (s) => (S.isEmpty(s) ? s : s[0].toUpperCase() + s.slic
|
|
|
5
5
|
export const uncapitalize = (s) => (S.isEmpty(s) ? s : s[0].toLowerCase() + s.slice(1));
|
|
6
6
|
export const prefix = (prefix) => (s) => `${prefix}${s}`;
|
|
7
7
|
export const suffix = (suffix) => (s) => `${s}${suffix}`;
|
|
8
|
+
export const infix = (middle) => (s0, s1) => `${s0}${middle}${s1}`;
|
|
8
9
|
export const test = (re) => (s) => re.test(s);
|
package/lib/ReadonlyRecord.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as E from 'fp-ts/Eq';
|
|
2
2
|
import * as RR from 'fp-ts/ReadonlyRecord';
|
|
3
|
+
export declare const collectWithIndex: <K extends string, A, B>(f: (k: K, a: A) => B) => (r: Readonly<Record<K, A>>) => readonly B[];
|
|
3
4
|
export declare const values: <A>(as: Readonly<Record<string, A>>) => readonly A[];
|
|
4
5
|
export declare const same: <A>(E: E.Eq<A>) => (as: Readonly<Record<string, A>>) => boolean;
|
package/lib/ReadonlyRecord.js
CHANGED
|
@@ -23,9 +23,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.same = exports.values = void 0;
|
|
26
|
+
exports.same = exports.values = exports.collectWithIndex = void 0;
|
|
27
27
|
const function_1 = require("fp-ts/function");
|
|
28
28
|
const $RA = __importStar(require("./ReadonlyArray"));
|
|
29
|
+
const collectWithIndex = (f) => (r) => Object.entries(r).map(([k, v]) => f(k, v));
|
|
30
|
+
exports.collectWithIndex = collectWithIndex;
|
|
29
31
|
const values = (as) => Object.values(as);
|
|
30
32
|
exports.values = values;
|
|
31
33
|
const same = (E) => (as) => (0, function_1.pipe)(as, exports.values, $RA.same(E));
|
package/lib/string.d.ts
CHANGED
|
@@ -4,4 +4,5 @@ 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
5
|
export declare const prefix: <Prefix extends string>(prefix: Prefix) => <S extends string>(s: S) => `${Prefix}${S}`;
|
|
6
6
|
export declare const suffix: <Suffix extends string>(suffix: Suffix) => <S extends string>(s: S) => `${S}${Suffix}`;
|
|
7
|
+
export declare const infix: <M extends string>(middle: M) => <S0 extends string, S1 extends string>(s0: S0, s1: S1) => `${S0}${M}${S1}`;
|
|
7
8
|
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.suffix = exports.prefix = exports.uncapitalize = exports.capitalize = exports.lowercase = exports.uppercase = void 0;
|
|
26
|
+
exports.test = exports.infix = 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;
|
|
@@ -37,5 +37,7 @@ const prefix = (prefix) => (s) => `${prefix}${s}`;
|
|
|
37
37
|
exports.prefix = prefix;
|
|
38
38
|
const suffix = (suffix) => (s) => `${s}${suffix}`;
|
|
39
39
|
exports.suffix = suffix;
|
|
40
|
+
const infix = (middle) => (s0, s1) => `${s0}${middle}${s1}`;
|
|
41
|
+
exports.infix = infix;
|
|
40
42
|
const test = (re) => (s) => re.test(s);
|
|
41
43
|
exports.test = test;
|
package/package.json
CHANGED
package/string.d.ts
CHANGED
|
@@ -4,4 +4,5 @@ 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
5
|
export declare const prefix: <Prefix extends string>(prefix: Prefix) => <S extends string>(s: S) => `${Prefix}${S}`;
|
|
6
6
|
export declare const suffix: <Suffix extends string>(suffix: Suffix) => <S extends string>(s: S) => `${S}${Suffix}`;
|
|
7
|
+
export declare const infix: <M extends string>(middle: M) => <S0 extends string, S1 extends string>(s0: S0, s1: S1) => `${S0}${M}${S1}`;
|
|
7
8
|
export declare const test: (re: RegExp) => (s: string) => boolean;
|