pareto-core-shorthands 0.2.1 → 0.2.3

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.
@@ -1,12 +1,14 @@
1
- import * as _pi from 'pareto-core-interface';
2
- export declare namespace optional {
3
- const set: typeof import("pareto-core-internals/dist/sync/expression/literals/optional").set;
4
- const not_set: typeof import("pareto-core-internals/dist/sync/expression/literals/optional").not_set;
5
- }
1
+ import * as _pi from "pareto-core-internals/dist/interface";
6
2
  export type Raw_Or_Normal_Dictionary<T> = {
7
3
  [key: string]: T;
8
4
  } | _pi.Dictionary<T>;
9
5
  export type Raw_Or_Normal_List<T> = T[] | _pi.List<T>;
6
+ export type Raw_Optional<T> = null | undefined | T;
7
+ export declare namespace optional {
8
+ const set: typeof import("pareto-core-internals/dist/__internals/sync/expression/literals/optional").set;
9
+ const not_set: typeof import("pareto-core-internals/dist/__internals/sync/expression/literals/optional").not_set;
10
+ const literal: <T>($: Raw_Optional<T>) => _pi.Optional_Value<T>;
11
+ }
10
12
  export declare namespace dictionary {
11
13
  const literal: <T>($: Raw_Or_Normal_Dictionary<T>) => _pi.Dictionary<T>;
12
14
  }
@@ -24,37 +24,43 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.list = exports.dictionary = exports.optional = void 0;
27
- const _pinternals = __importStar(require("pareto-core-internals/dist/sync/expression/initialize"));
27
+ const _pinternals = __importStar(require("pareto-core-internals/dist/__internals/sync/expression/initialize"));
28
28
  var optional;
29
29
  (function (optional) {
30
30
  optional.set = _pinternals.optional.set;
31
31
  optional.not_set = _pinternals.optional.not_set;
32
+ optional.literal = ($) => {
33
+ if ($ === null || $ === undefined) {
34
+ return optional.not_set();
35
+ }
36
+ else {
37
+ return optional.set($);
38
+ }
39
+ };
32
40
  })(optional || (exports.optional = optional = {}));
33
- const wrap_dictionary = ($) => {
34
- function is_normal($) {
35
- return $.__get_number_of_entries !== undefined && typeof $.__get_number_of_entries === "function";
36
- }
37
- if (is_normal($)) {
38
- return $;
39
- }
40
- else {
41
- return _pinternals.dictionary.literal($);
42
- }
43
- };
44
- const wrap_list = ($) => {
45
- if ($ instanceof Array) {
46
- return _pinternals.list.literal($);
47
- }
48
- if (!($.__for_each instanceof Function)) {
49
- throw new Error("invalid input in 'wrap_list'");
50
- }
51
- return $;
52
- };
53
41
  var dictionary;
54
42
  (function (dictionary) {
55
- dictionary.literal = wrap_dictionary;
43
+ dictionary.literal = ($) => {
44
+ function is_normal($) {
45
+ return $.__get_number_of_entries !== undefined && typeof $.__get_number_of_entries === "function";
46
+ }
47
+ if (is_normal($)) {
48
+ return $;
49
+ }
50
+ else {
51
+ return _pinternals.dictionary.literal($);
52
+ }
53
+ };
56
54
  })(dictionary || (exports.dictionary = dictionary = {}));
57
55
  var list;
58
56
  (function (list) {
59
- list.literal = wrap_list;
57
+ list.literal = ($) => {
58
+ if ($ instanceof Array) {
59
+ return _pinternals.list.literal($);
60
+ }
61
+ if (!($.__for_each instanceof Function)) {
62
+ throw new Error("invalid input in 'wrap_list'");
63
+ }
64
+ return $;
65
+ };
60
66
  })(list || (exports.list = list = {}));
@@ -1,8 +1,9 @@
1
- import * as _pi from 'pareto-core-interface';
1
+ import * as _pi from "pareto-core-internals/dist/interface";
2
2
  export type Raw_Or_Normal_Dictionary<T> = {
3
3
  [key: string]: T;
4
4
  } | _pi.Dictionary<T>;
5
5
  export type Raw_Or_Normal_List<T> = T[] | _pi.List<T>;
6
+ export type Raw_Optional<T> = null | undefined | T;
6
7
  export type Reference_To_Normal_Dictionary_Entry<G_Source, T_Dictionary_Entry> = {
7
8
  readonly 'key': string;
8
9
  readonly 'location': G_Source;
@@ -26,8 +27,9 @@ export type List<G_Source, T_L> = {
26
27
  readonly 'location': G_Source;
27
28
  };
28
29
  export declare namespace optional {
29
- const set: typeof import("pareto-core-internals/dist/sync/expression/literals/optional").set;
30
- const not_set: typeof import("pareto-core-internals/dist/sync/expression/literals/optional").not_set;
30
+ const set: typeof import("pareto-core-internals/dist/__internals/sync/expression/literals/optional").set;
31
+ const not_set: typeof import("pareto-core-internals/dist/__internals/sync/expression/literals/optional").not_set;
32
+ const literal: <T>($: Raw_Optional<T>) => _pi.Optional_Value<T>;
31
33
  }
32
34
  export declare const wrap_dictionary: <T>($: Raw_Or_Normal_Dictionary<T>) => Dictionary<_pi.Deprecated_Source_Location, T>;
33
35
  export declare const wrap_list: <T>($: Raw_Or_Normal_List<T>) => List<_pi.Deprecated_Source_Location, T>;
@@ -24,14 +24,22 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.wrap_stack_reference = exports.wrap_reference = exports.wrap_optional = exports.wrap_state_group = exports.wrap_list = exports.wrap_dictionary = exports.optional = void 0;
27
- const _pinternals = __importStar(require("pareto-core-internals/dist/sync/expression/initialize"));
28
- const get_location_info_1 = require("pareto-core-internals/dist/sync/get_location_info");
27
+ const _pinternals = __importStar(require("pareto-core-internals/dist/__internals/sync/expression/initialize"));
28
+ const get_location_info_1 = require("pareto-core-internals/dist/__internals/sync/get_location_info");
29
29
  //implementations
30
30
  const depth = 1;
31
31
  var optional;
32
32
  (function (optional) {
33
33
  optional.set = _pinternals.optional.set;
34
34
  optional.not_set = _pinternals.optional.not_set;
35
+ optional.literal = ($) => {
36
+ if ($ === null || $ === undefined) {
37
+ return optional.not_set();
38
+ }
39
+ else {
40
+ return optional.set($);
41
+ }
42
+ };
35
43
  })(optional || (exports.optional = optional = {}));
36
44
  const wrap_dictionary = ($) => {
37
45
  const location = (0, get_location_info_1.$$)(depth + 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pareto-core-shorthands",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "license": "ISC",
5
5
  "description": "the pareto package used for building datasets",
6
6
  "author": "Corno",