pareto-core-interface 0.1.14 → 0.1.15

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,4 +1,5 @@
1
1
  import { Abort } from "../interfaces/Abort";
2
+ import { Non_Void } from "../interfaces/Non_Void";
2
3
  import { List } from "./List";
3
4
  import { Optional_Value } from "./Optional_Value";
4
5
  /**
@@ -10,11 +11,11 @@ export interface Dictionary<T> {
10
11
  *
11
12
  * @param handle_entry callback to transform an individual entry. keys are not available.
12
13
  */
13
- map<NT>(handle_entry: (value: T, key: string) => NT): Dictionary<NT>;
14
+ map<NT>(handle_entry: (value: T, key: string) => Non_Void<NT>): Dictionary<NT>;
14
15
  /**
15
16
  * the ordering of the list will be the same as the insertion order in the dictionary
16
17
  */
17
- to_list<New_Type>(handle_entry: (value: T, key: string) => New_Type): List<New_Type>;
18
+ to_list<New_Type>(handle_entry: (value: T, key: string) => Non_Void<New_Type>): List<New_Type>;
18
19
  /**
19
20
  * This method is only to be used by resources
20
21
  * returns an {@link Optional_Value } of type T reflecting wether the entry existed or not
@@ -24,6 +25,6 @@ export interface Dictionary<T> {
24
25
  get_possible_entry(key: string): Optional_Value<T>;
25
26
  get_entry(key: string, abort: Abort<null>): T;
26
27
  get_number_of_entries(): number;
27
- filter<New_Type>(handle_entry: (value: T, key: string) => Optional_Value<New_Type>): Dictionary<New_Type>;
28
+ filter<New_Type>(handle_entry: (value: T, key: string) => Optional_Value<Non_Void<New_Type>>): Dictionary<New_Type>;
28
29
  is_empty(): boolean;
29
30
  }
@@ -1,4 +1,5 @@
1
1
  import { Abort } from "../interfaces/Abort";
2
+ import { Non_Void } from "../interfaces/Non_Void";
2
3
  import { Optional_Value } from "./Optional_Value";
3
4
  /**
4
5
  * An List for Pareto.
@@ -9,7 +10,7 @@ export interface List<T> {
9
10
  *
10
11
  * @param handle_element callback to transform an individual entry.
11
12
  */
12
- map<NT>(handle_element: ($: T) => NT): List<NT>;
13
+ map<NT>(handle_element: ($: T) => Non_Void<NT>): List<NT>;
13
14
  filter<New_Type>(handle_element: ($: T) => Optional_Value<New_Type>): List<New_Type>;
14
15
  get_number_of_elements(): number;
15
16
  is_empty(): boolean;
@@ -1,3 +1,4 @@
1
+ import { Non_Void } from "../interfaces/Non_Void";
1
2
  /**
2
3
  * Why this type and not use for example 'null | T'?
3
4
  * the 'null | T' is vulnerable. If you have a parametrized function 'foo<T>() null | T' and T is null | number,
@@ -9,11 +10,12 @@ export interface Optional_Value<T> {
9
10
  * @param set what to do when the value was set, returns the new type
10
11
  * @param not_set what to do when the value was not set, returns the new type
11
12
  */
12
- transform<NT>(set: ($: T) => NT, not_set: () => NT): NT;
13
+ transform<NT>(set: ($: T) => Non_Void<NT>, not_set: () => Non_Void<NT>): NT;
13
14
  /**
14
15
  *
15
16
  */
16
17
  map<NT>(//this one should be called 'map'
17
- set: ($: T) => NT): Optional_Value<NT>;
18
+ set: ($: T) => Non_Void<NT>): Optional_Value<NT>;
18
19
  is_set(): boolean;
20
+ _extract_data(set: ($: T) => void, not_set: () => void): void;
19
21
  }
@@ -4,5 +4,6 @@ export type Iterator<Element> = {
4
4
  'look': () => Optional_Value<Element>;
5
5
  'look ahead': (offset: number) => Optional_Value<Element>;
6
6
  'consume': (abort: Abort<null>) => Element;
7
+ 'discard': () => void;
7
8
  'get position': () => number;
8
9
  };
@@ -0,0 +1 @@
1
+ export type Non_Void<T> = T extends void ? never : T;
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTm9uX1ZvaWQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW50ZXJmYWNlcy9Ob25fVm9pZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiIn0=
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pareto-core-interface",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Corno",
6
6
  "description": "core types needed to define an interface in the Pareto language",