res-pareto-build 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,9 +1,11 @@
1
1
  import * as g_this from "./glossary";
2
2
  export type buildArray = g_this.F.BuildArray;
3
- export type buildDictionary = g_this.F.BuildDictionary;
3
+ export type createDictionaryBuilder = ($d: {
4
+ readonly 'onDuplicate': g_this.F.OnDuplicate;
5
+ }) => g_this.F.BuildDictionary;
4
6
  export type unsafeBuildDictionary = g_this.F.UnsafeBuildDictionary;
5
7
  export type API = {
6
8
  buildArray: buildArray;
7
- buildDictionary: buildDictionary;
9
+ createDictionaryBuilder: createDictionaryBuilder;
8
10
  unsafeBuildDictionary: unsafeBuildDictionary;
9
11
  };
@@ -1,6 +1,5 @@
1
1
  import { T } from './types.generated';
2
2
  import * as g_common from "glo-pareto-common";
3
- export declare namespace I { }
4
3
  export declare namespace B {
5
4
  type Add<GType> = ($: T.KeyValuePair<GType>) => void;
6
5
  type OnDuplicate<GType> = ($: g_common.T.String) => void;
@@ -8,6 +7,7 @@ export declare namespace B {
8
7
  }
9
8
  export declare namespace F {
10
9
  type BuildArray = <GType>($: g_common.T.Null, $c: ($b: B.Push<GType>) => void) => T.Array<GType>;
11
- type BuildDictionary = <GType>($: T.DictionaryBuildStrategy<GType>, $c: ($b: B.Add<GType>) => void, $b: B.OnDuplicate<GType>) => T.Dictionary<GType>;
10
+ type BuildDictionary = <GType>($: T.DictionaryBuildStrategy<GType>, $c: ($b: B.Add<GType>) => void) => T.Dictionary<GType>;
11
+ type OnDuplicate = <GType>($: g_common.T.Null, $c: ($b: B.OnDuplicate<GType>) => void) => void;
12
12
  type UnsafeBuildDictionary = <GType>($: g_common.T.Null, $c: ($b: B.Add<GType>) => void) => T.Dictionary<GType>;
13
13
  }
@@ -1,7 +1,7 @@
1
1
  import * as pt from 'pareto-core-types';
2
2
  export declare namespace T {
3
3
  namespace Array {
4
- type T<GType> = GType;
4
+ type A<GType> = GType;
5
5
  }
6
6
  type Array<GType> = pt.Array<GType>;
7
7
  namespace Dictionary {
@@ -1,2 +1,2 @@
1
- import { API } from "./definition/api.generated";
1
+ import { API } from "./api.generated";
2
2
  export declare const $r: API;
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.$r = void 0;
4
4
  const buildArray_native_1 = require("./implementations/buildArray.native");
5
- const buildDictionary_native_1 = require("./implementations/buildDictionary.native");
5
+ const createDictionaryBuilder_native_1 = require("./implementations/createDictionaryBuilder.native");
6
6
  const unsafeBuildDictionary_native_1 = require("./implementations/unsafeBuildDictionary.native");
7
7
  exports.$r = {
8
8
  'buildArray': buildArray_native_1.$$,
9
- 'buildDictionary': buildDictionary_native_1.$$,
9
+ 'createDictionaryBuilder': createDictionaryBuilder_native_1.$$,
10
10
  'unsafeBuildDictionary': unsafeBuildDictionary_native_1.$$,
11
11
  };
@@ -1,2 +1,2 @@
1
- import { buildArray } from "../definition/api.generated";
1
+ import { buildArray } from "../api.generated";
2
2
  export declare const $$: buildArray;
@@ -0,0 +1,2 @@
1
+ import { createDictionaryBuilder } from "../api.generated";
2
+ export declare const $$: createDictionaryBuilder;
@@ -25,30 +25,34 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.$$ = void 0;
27
27
  const pi = __importStar(require("pareto-core-internals"));
28
- const $$ = ($, $c, $i) => {
29
- const dbs = $;
30
- const out = {};
31
- $c(($) => {
32
- if (out[$.key] === undefined) {
33
- out[$.key] = $.value;
34
- }
35
- else {
36
- const kv = $;
37
- switch (dbs[0]) {
38
- case 'ignore':
39
- pi.cc(dbs[1], ($) => {
40
- });
41
- break;
42
- case 'overwrite':
43
- pi.cc(dbs[1], ($) => {
44
- out[kv.key] = kv.value;
45
- });
46
- break;
47
- default: pi.au(dbs[0]);
28
+ const $$ = ($d) => {
29
+ return ($, $c) => {
30
+ const dbs = $;
31
+ const out = {};
32
+ $c(($) => {
33
+ if (out[$.key] === undefined) {
34
+ out[$.key] = $.value;
48
35
  }
49
- $i($.key);
50
- }
51
- });
52
- return pi.wrapRawDictionary(out);
36
+ else {
37
+ const kv = $;
38
+ switch (dbs[0]) {
39
+ case 'ignore':
40
+ pi.cc(dbs[1], ($) => {
41
+ });
42
+ break;
43
+ case 'overwrite':
44
+ pi.cc(dbs[1], ($) => {
45
+ out[kv.key] = kv.value;
46
+ });
47
+ break;
48
+ default: pi.au(dbs[0]);
49
+ }
50
+ $d.onDuplicate(null, ($i) => {
51
+ $i($.key);
52
+ });
53
+ }
54
+ });
55
+ return pi.wrapRawDictionary(out);
56
+ };
53
57
  };
54
58
  exports.$$ = $$;
@@ -1,2 +1,2 @@
1
- import { unsafeBuildDictionary } from "../definition/api.generated";
1
+ import { unsafeBuildDictionary } from "../api.generated";
2
2
  export declare const $$: unsafeBuildDictionary;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export * from "./definition/api.generated";
2
- export * from "./definition/glossary";
1
+ export * from "./api.generated";
2
+ export * from "./glossary";
3
3
  export { $r } from "./implementation.generated";
package/dist/index.js CHANGED
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.$r = void 0;
18
- __exportStar(require("./definition/api.generated"), exports);
19
- __exportStar(require("./definition/glossary"), exports);
18
+ __exportStar(require("./api.generated"), exports);
19
+ __exportStar(require("./glossary"), exports);
20
20
  var implementation_generated_1 = require("./implementation.generated");
21
21
  Object.defineProperty(exports, "$r", { enumerable: true, get: function () { return implementation_generated_1.$r; } });
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "license": "TBD",
4
4
  "description": "this library provides functions to build arrays and dictionaries by adding entries/elements one by one",
5
5
  "dependencies": {
6
- "glo-pareto-common": "^0.17.0",
6
+ "glo-pareto-common": "^0.20.0",
7
7
  "pareto-core-internals": "^0.13.0"
8
8
  },
9
9
  "files": [
@@ -16,6 +16,6 @@
16
16
  "main": "dist/index.js",
17
17
  "types": "dist/index.d.ts",
18
18
  "name": "res-pareto-build",
19
- "version": "0.5.0",
20
- "content-fingerprint": "d9cc941bb053ebfd44b77e1f6e0e35f4e50fa94f"
19
+ "version": "0.6.0",
20
+ "content-fingerprint": "5891851e0e7383fbeda0258f4114b84f7c8324c3"
21
21
  }
@@ -1,2 +0,0 @@
1
- import { buildDictionary } from "../definition/api.generated";
2
- export declare const $$: buildDictionary;
File without changes