greybel-interpreter 1.0.4 → 1.1.2

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.
Files changed (97) hide show
  1. package/.editorconfig +14 -14
  2. package/.eslintrc +47 -47
  3. package/LICENSE +21 -21
  4. package/README.md +2 -2
  5. package/dist/context.d.ts +109 -109
  6. package/dist/context.js +378 -378
  7. package/dist/cps.d.ts +14 -15
  8. package/dist/cps.js +213 -220
  9. package/dist/handler/error.d.ts +6 -6
  10. package/dist/handler/error.js +35 -35
  11. package/dist/handler/output.d.ts +6 -6
  12. package/dist/handler/output.js +35 -35
  13. package/dist/handler/resource.d.ts +12 -12
  14. package/dist/handler/resource.js +51 -51
  15. package/dist/handler-container.d.ts +14 -14
  16. package/dist/handler-container.js +16 -16
  17. package/dist/index.d.ts +44 -44
  18. package/dist/index.js +129 -129
  19. package/dist/interpreter.d.ts +39 -39
  20. package/dist/interpreter.js +292 -292
  21. package/dist/intrinsics-container.d.ts +7 -7
  22. package/dist/intrinsics-container.js +19 -19
  23. package/dist/operations/assign.d.ts +13 -13
  24. package/dist/operations/assign.js +111 -111
  25. package/dist/operations/block.d.ts +12 -12
  26. package/dist/operations/block.js +108 -108
  27. package/dist/operations/break.d.ts +10 -10
  28. package/dist/operations/break.js +41 -41
  29. package/dist/operations/call.d.ts +13 -13
  30. package/dist/operations/call.js +124 -124
  31. package/dist/operations/chunk.d.ts +12 -12
  32. package/dist/operations/chunk.js +85 -85
  33. package/dist/operations/continue.d.ts +10 -10
  34. package/dist/operations/continue.js +41 -41
  35. package/dist/operations/debugger-statement.d.ts +10 -10
  36. package/dist/operations/debugger-statement.js +39 -39
  37. package/dist/operations/evaluate.d.ts +39 -39
  38. package/dist/operations/evaluate.js +366 -366
  39. package/dist/operations/for.d.ts +15 -15
  40. package/dist/operations/for.js +152 -146
  41. package/dist/operations/function-reference.d.ts +12 -12
  42. package/dist/operations/function-reference.js +103 -103
  43. package/dist/operations/function.d.ts +12 -12
  44. package/dist/operations/function.js +198 -198
  45. package/dist/operations/if-statement.d.ts +19 -19
  46. package/dist/operations/if-statement.js +181 -181
  47. package/dist/operations/import.d.ts +14 -14
  48. package/dist/operations/import.js +115 -115
  49. package/dist/operations/include.d.ts +13 -13
  50. package/dist/operations/include.js +95 -95
  51. package/dist/operations/list.d.ts +11 -11
  52. package/dist/operations/list.js +111 -111
  53. package/dist/operations/literal.d.ts +11 -11
  54. package/dist/operations/literal.js +58 -58
  55. package/dist/operations/map.d.ts +11 -11
  56. package/dist/operations/map.js +167 -167
  57. package/dist/operations/negated-binary.d.ts +11 -11
  58. package/dist/operations/negated-binary.js +109 -109
  59. package/dist/operations/new-instance.d.ts +11 -11
  60. package/dist/operations/new-instance.js +100 -100
  61. package/dist/operations/noop.d.ts +9 -9
  62. package/dist/operations/noop.js +36 -36
  63. package/dist/operations/not.d.ts +11 -11
  64. package/dist/operations/not.js +96 -96
  65. package/dist/operations/operation.d.ts +13 -13
  66. package/dist/operations/operation.js +11 -11
  67. package/dist/operations/reference.d.ts +9 -9
  68. package/dist/operations/reference.js +37 -37
  69. package/dist/operations/resolve.d.ts +38 -38
  70. package/dist/operations/resolve.js +330 -330
  71. package/dist/operations/return.d.ts +11 -11
  72. package/dist/operations/return.js +107 -107
  73. package/dist/operations/while.d.ts +13 -13
  74. package/dist/operations/while.js +136 -129
  75. package/dist/types/boolean.d.ts +11 -11
  76. package/dist/types/boolean.js +46 -46
  77. package/dist/types/default.d.ts +11 -11
  78. package/dist/types/default.js +20 -20
  79. package/dist/types/function.d.ts +32 -32
  80. package/dist/types/function.js +174 -174
  81. package/dist/types/generics.d.ts +17 -17
  82. package/dist/types/generics.js +40 -40
  83. package/dist/types/interface.d.ts +22 -22
  84. package/dist/types/interface.js +102 -102
  85. package/dist/types/list.d.ts +31 -31
  86. package/dist/types/list.js +227 -227
  87. package/dist/types/map.d.ts +30 -30
  88. package/dist/types/map.js +224 -224
  89. package/dist/types/nil.d.ts +9 -9
  90. package/dist/types/nil.js +44 -44
  91. package/dist/types/number.d.ts +11 -11
  92. package/dist/types/number.js +46 -46
  93. package/dist/types/string.d.ts +33 -33
  94. package/dist/types/string.js +149 -149
  95. package/dist/utils/path.d.ts +10 -10
  96. package/dist/utils/path.js +59 -59
  97. package/package.json +58 -58
@@ -1,46 +1,46 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- var generics_1 = require("./generics");
19
- var CustomNumber = /** @class */ (function (_super) {
20
- __extends(CustomNumber, _super);
21
- function CustomNumber(value) {
22
- var _this = _super.call(this) || this;
23
- _this.value = value;
24
- return _this;
25
- }
26
- CustomNumber.prototype.getCustomType = function () {
27
- return 'number';
28
- };
29
- CustomNumber.prototype.toString = function () {
30
- return this.value.toString();
31
- };
32
- CustomNumber.prototype.fork = function () {
33
- return new CustomNumber(this.value);
34
- };
35
- CustomNumber.prototype.toInt = function () {
36
- return this.value | 0;
37
- };
38
- CustomNumber.prototype.toNumber = function () {
39
- return this.value;
40
- };
41
- CustomNumber.prototype.toTruthy = function () {
42
- return !!this.value;
43
- };
44
- return CustomNumber;
45
- }(generics_1.CustomValue));
46
- exports.default = CustomNumber;
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ var generics_1 = require("./generics");
19
+ var CustomNumber = /** @class */ (function (_super) {
20
+ __extends(CustomNumber, _super);
21
+ function CustomNumber(value) {
22
+ var _this = _super.call(this) || this;
23
+ _this.value = value;
24
+ return _this;
25
+ }
26
+ CustomNumber.prototype.getCustomType = function () {
27
+ return 'number';
28
+ };
29
+ CustomNumber.prototype.toString = function () {
30
+ return this.value.toString();
31
+ };
32
+ CustomNumber.prototype.fork = function () {
33
+ return new CustomNumber(this.value);
34
+ };
35
+ CustomNumber.prototype.toInt = function () {
36
+ return this.value | 0;
37
+ };
38
+ CustomNumber.prototype.toNumber = function () {
39
+ return this.value;
40
+ };
41
+ CustomNumber.prototype.toTruthy = function () {
42
+ return !!this.value;
43
+ };
44
+ return CustomNumber;
45
+ }(generics_1.CustomValue));
46
+ exports.default = CustomNumber;
@@ -1,33 +1,33 @@
1
- import IntrinsicsContainer from '../intrinsics-container';
2
- import Path from '../utils/path';
3
- import CustomFunction from './function';
4
- import { CustomValue, CustomValueWithIntrinsics } from './generics';
5
- export declare class CustomStringIterator implements Iterator<CustomValue> {
6
- value: string;
7
- index: number;
8
- constructor(value: string);
9
- next(): IteratorResult<CustomValue>;
10
- }
11
- export default class CustomString extends CustomValueWithIntrinsics {
12
- static getCharIndex(item: CustomString, index: number): number;
13
- private static intrinsics;
14
- static getIntrinsics(): IntrinsicsContainer;
15
- static addIntrinsic(name: string, fn: CustomFunction): void;
16
- readonly value: string;
17
- constructor(value: string);
18
- getCustomType(): string;
19
- toString(): string;
20
- fork(): CustomString;
21
- isNumber(): boolean;
22
- parseFloat(): number;
23
- parseInt(): number;
24
- toNumber(): number;
25
- toInt(): number;
26
- toTruthy(): boolean;
27
- slice(a: CustomValue, b: CustomValue): CustomString;
28
- [Symbol.iterator](): CustomStringIterator;
29
- getCharIndex(index: number): number;
30
- has(path: Path<string> | string): boolean;
31
- set(_path: Path<string> | string, _newValue: CustomValue): void;
32
- get(path: Path<string> | string): CustomValue;
33
- }
1
+ import IntrinsicsContainer from '../intrinsics-container';
2
+ import Path from '../utils/path';
3
+ import CustomFunction from './function';
4
+ import { CustomValue, CustomValueWithIntrinsics } from './generics';
5
+ export declare class CustomStringIterator implements Iterator<CustomValue> {
6
+ value: string;
7
+ index: number;
8
+ constructor(value: string);
9
+ next(): IteratorResult<CustomValue>;
10
+ }
11
+ export default class CustomString extends CustomValueWithIntrinsics {
12
+ static getCharIndex(item: CustomString, index: number): number;
13
+ private static intrinsics;
14
+ static getIntrinsics(): IntrinsicsContainer;
15
+ static addIntrinsic(name: string, fn: CustomFunction): void;
16
+ readonly value: string;
17
+ constructor(value: string);
18
+ getCustomType(): string;
19
+ toString(): string;
20
+ fork(): CustomString;
21
+ isNumber(): boolean;
22
+ parseFloat(): number;
23
+ parseInt(): number;
24
+ toNumber(): number;
25
+ toInt(): number;
26
+ toTruthy(): boolean;
27
+ slice(a: CustomValue, b: CustomValue): CustomString;
28
+ [Symbol.iterator](): CustomStringIterator;
29
+ getCharIndex(index: number): number;
30
+ has(path: Path<string> | string): boolean;
31
+ set(_path: Path<string> | string, _newValue: CustomValue): void;
32
+ get(path: Path<string> | string): CustomValue;
33
+ }
@@ -1,149 +1,149 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __importDefault = (this && this.__importDefault) || function (mod) {
18
- return (mod && mod.__esModule) ? mod : { "default": mod };
19
- };
20
- Object.defineProperty(exports, "__esModule", { value: true });
21
- exports.CustomStringIterator = void 0;
22
- var intrinsics_container_1 = __importDefault(require("../intrinsics-container"));
23
- var path_1 = __importDefault(require("../utils/path"));
24
- var default_1 = __importDefault(require("./default"));
25
- var generics_1 = require("./generics");
26
- var CustomStringIterator = /** @class */ (function () {
27
- function CustomStringIterator(value) {
28
- var me = this;
29
- me.value = value;
30
- me.index = 0;
31
- }
32
- CustomStringIterator.prototype.next = function () {
33
- var me = this;
34
- if (me.index === me.value.length) {
35
- return {
36
- value: null,
37
- done: true
38
- };
39
- }
40
- return {
41
- value: new CustomString(me.value[me.index++]),
42
- done: false
43
- };
44
- };
45
- return CustomStringIterator;
46
- }());
47
- exports.CustomStringIterator = CustomStringIterator;
48
- var CustomString = /** @class */ (function (_super) {
49
- __extends(CustomString, _super);
50
- function CustomString(value) {
51
- var _this = _super.call(this) || this;
52
- _this.value = value;
53
- return _this;
54
- }
55
- CustomString.getCharIndex = function (item, index) {
56
- var n = index | 0;
57
- if (n < 0)
58
- n += item.value.length;
59
- if (n < 0 || n >= item.value.length)
60
- return -1;
61
- return n;
62
- };
63
- CustomString.getIntrinsics = function () {
64
- return this.intrinsics;
65
- };
66
- CustomString.addIntrinsic = function (name, fn) {
67
- this.intrinsics.add(name, fn);
68
- };
69
- CustomString.prototype.getCustomType = function () {
70
- return 'string';
71
- };
72
- CustomString.prototype.toString = function () {
73
- return this.value;
74
- };
75
- CustomString.prototype.fork = function () {
76
- return new CustomString(this.value);
77
- };
78
- CustomString.prototype.isNumber = function () {
79
- var nr = Number(this.value);
80
- return !Number.isNaN(nr);
81
- };
82
- CustomString.prototype.parseFloat = function () {
83
- return parseFloat(this.value);
84
- };
85
- CustomString.prototype.parseInt = function () {
86
- return parseInt(this.value);
87
- };
88
- CustomString.prototype.toNumber = function () {
89
- return 0;
90
- };
91
- CustomString.prototype.toInt = function () {
92
- return 0;
93
- };
94
- CustomString.prototype.toTruthy = function () {
95
- return this.value.length > 0;
96
- };
97
- CustomString.prototype.slice = function (a, b) {
98
- return new CustomString(this.value.slice(a.toNumber(), b.toNumber()));
99
- };
100
- CustomString.prototype[Symbol.iterator] = function () {
101
- return new CustomStringIterator(this.value);
102
- };
103
- CustomString.prototype.getCharIndex = function (index) {
104
- return CustomString.getCharIndex(this, index);
105
- };
106
- CustomString.prototype.has = function (path) {
107
- if (typeof path === 'string') {
108
- return this.has(new path_1.default([path]));
109
- }
110
- var traversalPath = path.clone();
111
- var current = traversalPath.next();
112
- if (current !== null) {
113
- var index = parseInt(current);
114
- if (Number.isNaN(index)) {
115
- return false;
116
- }
117
- return !!this.value[index];
118
- }
119
- return false;
120
- };
121
- CustomString.prototype.set = function (_path, _newValue) {
122
- throw new Error('Mutable operations are not allowed on a string.');
123
- };
124
- CustomString.prototype.get = function (path) {
125
- if (typeof path === 'string') {
126
- return this.get(new path_1.default([path]));
127
- }
128
- var traversalPath = path.clone();
129
- var current = traversalPath.next();
130
- if (current !== null) {
131
- var currentIndex = parseInt(current);
132
- var isCurrentNumber = !Number.isNaN(currentIndex);
133
- if (isCurrentNumber) {
134
- currentIndex = this.getCharIndex(currentIndex);
135
- }
136
- if (isCurrentNumber) {
137
- return new CustomString(this.value[currentIndex].toString());
138
- }
139
- else if (path.count() === 1 &&
140
- CustomString.getIntrinsics().has(current)) {
141
- return CustomString.intrinsics.get(current);
142
- }
143
- }
144
- return default_1.default.Void;
145
- };
146
- CustomString.intrinsics = new intrinsics_container_1.default();
147
- return CustomString;
148
- }(generics_1.CustomValueWithIntrinsics));
149
- exports.default = CustomString;
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __importDefault = (this && this.__importDefault) || function (mod) {
18
+ return (mod && mod.__esModule) ? mod : { "default": mod };
19
+ };
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.CustomStringIterator = void 0;
22
+ var intrinsics_container_1 = __importDefault(require("../intrinsics-container"));
23
+ var path_1 = __importDefault(require("../utils/path"));
24
+ var default_1 = __importDefault(require("./default"));
25
+ var generics_1 = require("./generics");
26
+ var CustomStringIterator = /** @class */ (function () {
27
+ function CustomStringIterator(value) {
28
+ var me = this;
29
+ me.value = value;
30
+ me.index = 0;
31
+ }
32
+ CustomStringIterator.prototype.next = function () {
33
+ var me = this;
34
+ if (me.index === me.value.length) {
35
+ return {
36
+ value: null,
37
+ done: true
38
+ };
39
+ }
40
+ return {
41
+ value: new CustomString(me.value[me.index++]),
42
+ done: false
43
+ };
44
+ };
45
+ return CustomStringIterator;
46
+ }());
47
+ exports.CustomStringIterator = CustomStringIterator;
48
+ var CustomString = /** @class */ (function (_super) {
49
+ __extends(CustomString, _super);
50
+ function CustomString(value) {
51
+ var _this = _super.call(this) || this;
52
+ _this.value = value;
53
+ return _this;
54
+ }
55
+ CustomString.getCharIndex = function (item, index) {
56
+ var n = index | 0;
57
+ if (n < 0)
58
+ n += item.value.length;
59
+ if (n < 0 || n >= item.value.length)
60
+ return -1;
61
+ return n;
62
+ };
63
+ CustomString.getIntrinsics = function () {
64
+ return this.intrinsics;
65
+ };
66
+ CustomString.addIntrinsic = function (name, fn) {
67
+ this.intrinsics.add(name, fn);
68
+ };
69
+ CustomString.prototype.getCustomType = function () {
70
+ return 'string';
71
+ };
72
+ CustomString.prototype.toString = function () {
73
+ return this.value;
74
+ };
75
+ CustomString.prototype.fork = function () {
76
+ return new CustomString(this.value);
77
+ };
78
+ CustomString.prototype.isNumber = function () {
79
+ var nr = Number(this.value);
80
+ return !Number.isNaN(nr);
81
+ };
82
+ CustomString.prototype.parseFloat = function () {
83
+ return parseFloat(this.value);
84
+ };
85
+ CustomString.prototype.parseInt = function () {
86
+ return parseInt(this.value);
87
+ };
88
+ CustomString.prototype.toNumber = function () {
89
+ return 0;
90
+ };
91
+ CustomString.prototype.toInt = function () {
92
+ return 0;
93
+ };
94
+ CustomString.prototype.toTruthy = function () {
95
+ return this.value.length > 0;
96
+ };
97
+ CustomString.prototype.slice = function (a, b) {
98
+ return new CustomString(this.value.slice(a.toNumber(), b.toNumber()));
99
+ };
100
+ CustomString.prototype[Symbol.iterator] = function () {
101
+ return new CustomStringIterator(this.value);
102
+ };
103
+ CustomString.prototype.getCharIndex = function (index) {
104
+ return CustomString.getCharIndex(this, index);
105
+ };
106
+ CustomString.prototype.has = function (path) {
107
+ if (typeof path === 'string') {
108
+ return this.has(new path_1.default([path]));
109
+ }
110
+ var traversalPath = path.clone();
111
+ var current = traversalPath.next();
112
+ if (current !== null) {
113
+ var index = parseInt(current);
114
+ if (Number.isNaN(index)) {
115
+ return false;
116
+ }
117
+ return !!this.value[index];
118
+ }
119
+ return false;
120
+ };
121
+ CustomString.prototype.set = function (_path, _newValue) {
122
+ throw new Error('Mutable operations are not allowed on a string.');
123
+ };
124
+ CustomString.prototype.get = function (path) {
125
+ if (typeof path === 'string') {
126
+ return this.get(new path_1.default([path]));
127
+ }
128
+ var traversalPath = path.clone();
129
+ var current = traversalPath.next();
130
+ if (current !== null) {
131
+ var currentIndex = parseInt(current);
132
+ var isCurrentNumber = !Number.isNaN(currentIndex);
133
+ if (isCurrentNumber) {
134
+ currentIndex = this.getCharIndex(currentIndex);
135
+ }
136
+ if (isCurrentNumber) {
137
+ return new CustomString(this.value[currentIndex].toString());
138
+ }
139
+ else if (path.count() === 1 &&
140
+ CustomString.getIntrinsics().has(current)) {
141
+ return CustomString.intrinsics.get(current);
142
+ }
143
+ }
144
+ return default_1.default.Void;
145
+ };
146
+ CustomString.intrinsics = new intrinsics_container_1.default();
147
+ return CustomString;
148
+ }(generics_1.CustomValueWithIntrinsics));
149
+ exports.default = CustomString;
@@ -1,10 +1,10 @@
1
- export default class Path<T> {
2
- readonly path: Array<T>;
3
- constructor(path?: Array<T>);
4
- next(): T | null;
5
- last(): T | null;
6
- add(value: T): void;
7
- toString(): string;
8
- count(): number;
9
- clone(): Path<T>;
10
- }
1
+ export default class Path<T> {
2
+ readonly path: Array<T>;
3
+ constructor(path?: Array<T>);
4
+ next(): T | null;
5
+ last(): T | null;
6
+ add(value: T): void;
7
+ toString(): string;
8
+ count(): number;
9
+ clone(): Path<T>;
10
+ }
@@ -1,59 +1,59 @@
1
- "use strict";
2
- var __read = (this && this.__read) || function (o, n) {
3
- var m = typeof Symbol === "function" && o[Symbol.iterator];
4
- if (!m) return o;
5
- var i = m.call(o), r, ar = [], e;
6
- try {
7
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8
- }
9
- catch (error) { e = { error: error }; }
10
- finally {
11
- try {
12
- if (r && !r.done && (m = i["return"])) m.call(i);
13
- }
14
- finally { if (e) throw e.error; }
15
- }
16
- return ar;
17
- };
18
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
19
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
20
- if (ar || !(i in from)) {
21
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
22
- ar[i] = from[i];
23
- }
24
- }
25
- return to.concat(ar || Array.prototype.slice.call(from));
26
- };
27
- Object.defineProperty(exports, "__esModule", { value: true });
28
- var Path = /** @class */ (function () {
29
- function Path(path) {
30
- if (path === void 0) { path = []; }
31
- this.path = __spreadArray([], __read(path), false);
32
- }
33
- Path.prototype.next = function () {
34
- if (this.path.length === 0) {
35
- return null;
36
- }
37
- return this.path.shift();
38
- };
39
- Path.prototype.last = function () {
40
- if (this.path.length === 0) {
41
- return null;
42
- }
43
- return this.path.pop();
44
- };
45
- Path.prototype.add = function (value) {
46
- this.path.push(value);
47
- };
48
- Path.prototype.toString = function () {
49
- return this.path.join('.');
50
- };
51
- Path.prototype.count = function () {
52
- return this.path.length;
53
- };
54
- Path.prototype.clone = function () {
55
- return new Path(this.path);
56
- };
57
- return Path;
58
- }());
59
- exports.default = Path;
1
+ "use strict";
2
+ var __read = (this && this.__read) || function (o, n) {
3
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
4
+ if (!m) return o;
5
+ var i = m.call(o), r, ar = [], e;
6
+ try {
7
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
8
+ }
9
+ catch (error) { e = { error: error }; }
10
+ finally {
11
+ try {
12
+ if (r && !r.done && (m = i["return"])) m.call(i);
13
+ }
14
+ finally { if (e) throw e.error; }
15
+ }
16
+ return ar;
17
+ };
18
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
19
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
20
+ if (ar || !(i in from)) {
21
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
22
+ ar[i] = from[i];
23
+ }
24
+ }
25
+ return to.concat(ar || Array.prototype.slice.call(from));
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ var Path = /** @class */ (function () {
29
+ function Path(path) {
30
+ if (path === void 0) { path = []; }
31
+ this.path = __spreadArray([], __read(path), false);
32
+ }
33
+ Path.prototype.next = function () {
34
+ if (this.path.length === 0) {
35
+ return null;
36
+ }
37
+ return this.path.shift();
38
+ };
39
+ Path.prototype.last = function () {
40
+ if (this.path.length === 0) {
41
+ return null;
42
+ }
43
+ return this.path.pop();
44
+ };
45
+ Path.prototype.add = function (value) {
46
+ this.path.push(value);
47
+ };
48
+ Path.prototype.toString = function () {
49
+ return this.path.join('.');
50
+ };
51
+ Path.prototype.count = function () {
52
+ return this.path.length;
53
+ };
54
+ Path.prototype.clone = function () {
55
+ return new Path(this.path);
56
+ };
57
+ return Path;
58
+ }());
59
+ exports.default = Path;