fortepiano 0.1.5 → 0.1.6

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,12 @@ 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.6](https://github.com/facile-it/fortepiano/compare/v0.1.5...v0.1.6) - 2022-09-30
8
+
9
+ ### Added
10
+
11
+ - Add `collectWithIndex` function to `ReadonlyRecord` module.
12
+
7
13
  ## [0.1.5](https://github.com/facile-it/fortepiano/compare/v0.1.4...v0.1.5) - 2022-09-22
8
14
 
9
15
  ### Added
@@ -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;
@@ -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));
@@ -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;
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fortepiano",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Playing actual music over fp-ts notes",
5
5
  "keywords": [
6
6
  "typescript",