res-pareto-build 0.1.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,9 @@
1
- import * as glo from "./glossary";
2
- export type CbuildArray = glo.FBuildArray;
3
- export type CunsafeBuildDictionary = glo.FUnsafeBuildDictionary;
1
+ import * as gglo from "./glossary";
2
+ export type CbuildArray = gglo.FBuildArray;
3
+ export type CbuildDictionary = gglo.FBuildDictionary;
4
+ export type CunsafeBuildDictionary = gglo.FUnsafeBuildDictionary;
4
5
  export type API = {
5
6
  buildArray: CbuildArray;
7
+ buildDictionary: CbuildDictionary;
6
8
  unsafeBuildDictionary: CunsafeBuildDictionary;
7
9
  };
@@ -1,6 +1,8 @@
1
1
  import { T } from './types.generated';
2
- import * as mcommon from "glo-pareto-common";
2
+ import * as gcommon from "glo-pareto-common";
3
3
  export type IAdd<GPType> = ($: T.KeyValuePair<GPType>) => void;
4
+ export type IOnDuplicate<GPType> = ($: gcommon.T.String) => void;
4
5
  export type IPush<GPType> = ($: T.Type<GPType>) => void;
5
- export type FBuildArray = <GPType>($: mcommon.T.Null, $c: ($i: IPush<GPType>) => void) => T.Array<GPType>;
6
- export type FUnsafeBuildDictionary = <GPType>($: mcommon.T.Null, $c: ($i: IAdd<GPType>) => void) => T.Dictionary<GPType>;
6
+ export type FBuildArray = <GPType>($: gcommon.T.Null, $c: ($i: IPush<GPType>) => void) => T.Array<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>($: gcommon.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;
@@ -2,8 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.$a = void 0;
4
4
  const buildArray_native_1 = require("./implementations/buildArray.native");
5
+ const buildDictionary_native_1 = require("./implementations/buildDictionary.native");
5
6
  const unsafeBuildDictionary_native_1 = require("./implementations/unsafeBuildDictionary.native");
6
7
  exports.$a = {
7
8
  'buildArray': buildArray_native_1.$$,
9
+ 'buildDictionary': buildDictionary_native_1.$$,
8
10
  'unsafeBuildDictionary': unsafeBuildDictionary_native_1.$$,
9
11
  };
@@ -0,0 +1,2 @@
1
+ import { CbuildDictionary } from "../api";
2
+ export declare const $$: CbuildDictionary;
@@ -0,0 +1,54 @@
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, $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]);
48
+ }
49
+ $i($.key);
50
+ }
51
+ });
52
+ return pi.wrapRawDictionary(out);
53
+ };
54
+ 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.1.0",
20
- "content-fingerprint": "ee21324e1764983c3861dff1102ede68d6146e77"
19
+ "version": "0.3.0",
20
+ "content-fingerprint": "8d6bd7e9c4fbc2ab5096b645592b0329b2bc3620"
21
21
  }