res-pareto-build 0.0.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,9 @@
1
1
  import * as glo from "./glossary";
2
2
  export type CbuildArray = glo.FBuildArray;
3
3
  export type CbuildDictionary = glo.FBuildDictionary;
4
+ export type CunsafeBuildDictionary = glo.FUnsafeBuildDictionary;
4
5
  export type API = {
5
6
  buildArray: CbuildArray;
6
7
  buildDictionary: CbuildDictionary;
8
+ unsafeBuildDictionary: CunsafeBuildDictionary;
7
9
  };
@@ -1,6 +1,8 @@
1
1
  import { T } from './types.generated';
2
2
  import * as mcommon from "glo-pareto-common";
3
3
  export type IAdd<GPType> = ($: T.KeyValuePair<GPType>) => void;
4
+ export type IOnDuplicate<GPType> = ($: mcommon.T.String) => void;
4
5
  export type IPush<GPType> = ($: T.Type<GPType>) => void;
5
6
  export type FBuildArray = <GPType>($: mcommon.T.Null, $c: ($i: IPush<GPType>) => void) => T.Array<GPType>;
6
- export type FBuildDictionary = <GPType>($: mcommon.T.Null, $c: ($i: IAdd<GPType>) => void) => T.Dictionary<GPType>;
7
+ export type FBuildDictionary = <GPType>($: T.DictionaryBuildStrategy<GPType>, $c: ($i: IAdd<GPType>) => void, $i: IOnDuplicate<GPType>) => T.Dictionary<GPType>;
8
+ export type FUnsafeBuildDictionary = <GPType>($: mcommon.T.Null, $c: ($i: IAdd<GPType>) => void) => T.Dictionary<GPType>;
@@ -8,6 +8,13 @@ export declare namespace T {
8
8
  type D<GPType> = GPType;
9
9
  }
10
10
  type Dictionary<GPType> = pt.Dictionary<GPType>;
11
+ namespace DictionaryBuildStrategy {
12
+ namespace ignore { }
13
+ type ignore<GPType> = {};
14
+ namespace overwrite { }
15
+ type overwrite<GPType> = {};
16
+ }
17
+ type DictionaryBuildStrategy<GPType> = ['ignore', {}] | ['overwrite', {}];
11
18
  namespace KeyValuePair {
12
19
  type key<GPType> = string;
13
20
  type value<GPType> = GPType;
@@ -3,7 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.$a = void 0;
4
4
  const buildArray_native_1 = require("./implementations/buildArray.native");
5
5
  const buildDictionary_native_1 = require("./implementations/buildDictionary.native");
6
+ const unsafeBuildDictionary_native_1 = require("./implementations/unsafeBuildDictionary.native");
6
7
  exports.$a = {
7
8
  'buildArray': buildArray_native_1.$$,
8
9
  'buildDictionary': buildDictionary_native_1.$$,
10
+ 'unsafeBuildDictionary': unsafeBuildDictionary_native_1.$$,
9
11
  };
@@ -25,10 +25,29 @@ 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) => {
28
+ const $$ = ($, $c, $i) => {
29
+ const dbs = $;
29
30
  const out = {};
30
31
  $c(($) => {
31
- out[$.key] = $.value;
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]);
48
+ }
49
+ $i($.key);
50
+ }
32
51
  });
33
52
  return pi.wrapRawDictionary(out);
34
53
  };
@@ -0,0 +1,2 @@
1
+ import { CunsafeBuildDictionary } from "../api";
2
+ export declare const $$: CunsafeBuildDictionary;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.$$ = void 0;
27
+ const pi = __importStar(require("pareto-core-internals"));
28
+ const $$ = ($, $c) => {
29
+ const out = {};
30
+ $c(($) => {
31
+ if (out[$.key] !== undefined) {
32
+ pi.panic(`entry '${$.key}' already exists`);
33
+ }
34
+ out[$.key] = $.value;
35
+ });
36
+ return pi.wrapRawDictionary(out);
37
+ };
38
+ exports.$$ = $$;
package/package.json CHANGED
@@ -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.0.0",
20
- "content-fingerprint": "77db4d751e0b86550410aac098fe2022eaa8b62a"
19
+ "version": "0.2.0",
20
+ "content-fingerprint": "5ade92f33317790b881ee27b7058f8e53fa05d80"
21
21
  }