greybel-interpreter 0.6.9 → 0.7.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 (83) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +2 -2
  3. package/dist/context.d.ts +98 -98
  4. package/dist/context.js +456 -456
  5. package/dist/cps.d.ts +17 -17
  6. package/dist/cps.js +872 -871
  7. package/dist/custom-types/boolean.d.ts +12 -12
  8. package/dist/custom-types/boolean.js +47 -47
  9. package/dist/custom-types/list.d.ts +26 -26
  10. package/dist/custom-types/list.js +236 -236
  11. package/dist/custom-types/map.d.ts +26 -26
  12. package/dist/custom-types/map.js +245 -245
  13. package/dist/custom-types/nil.d.ts +10 -10
  14. package/dist/custom-types/nil.js +44 -44
  15. package/dist/custom-types/number.d.ts +12 -12
  16. package/dist/custom-types/number.js +47 -47
  17. package/dist/custom-types/string.d.ts +25 -25
  18. package/dist/custom-types/string.js +172 -172
  19. package/dist/expressions/assign.d.ts +13 -13
  20. package/dist/expressions/assign.js +174 -174
  21. package/dist/expressions/binary-negated-expression.d.ts +18 -18
  22. package/dist/expressions/binary-negated-expression.js +127 -127
  23. package/dist/expressions/call.d.ts +14 -14
  24. package/dist/expressions/call.js +209 -208
  25. package/dist/expressions/import.d.ts +14 -14
  26. package/dist/expressions/import.js +155 -155
  27. package/dist/expressions/include.d.ts +13 -13
  28. package/dist/expressions/include.js +132 -132
  29. package/dist/expressions/list.d.ts +14 -14
  30. package/dist/expressions/list.js +142 -134
  31. package/dist/expressions/logical-and-binary.d.ts +22 -22
  32. package/dist/expressions/logical-and-binary.js +222 -222
  33. package/dist/expressions/map.d.ts +19 -19
  34. package/dist/expressions/map.js +197 -197
  35. package/dist/expressions/path.d.ts +31 -31
  36. package/dist/expressions/path.js +384 -383
  37. package/dist/index.d.ts +36 -36
  38. package/dist/index.js +93 -89
  39. package/dist/interpreter.d.ts +29 -29
  40. package/dist/interpreter.js +210 -210
  41. package/dist/operations/argument.d.ts +8 -8
  42. package/dist/operations/argument.js +145 -145
  43. package/dist/operations/body.d.ts +8 -8
  44. package/dist/operations/body.js +140 -140
  45. package/dist/operations/break.d.ts +7 -7
  46. package/dist/operations/break.js +34 -34
  47. package/dist/operations/continue.d.ts +7 -7
  48. package/dist/operations/continue.js +34 -34
  49. package/dist/operations/debugger.d.ts +7 -7
  50. package/dist/operations/debugger.js +32 -32
  51. package/dist/operations/else-if.d.ts +12 -12
  52. package/dist/operations/else-if.js +31 -31
  53. package/dist/operations/else.d.ts +10 -10
  54. package/dist/operations/else.js +30 -30
  55. package/dist/operations/for.d.ts +16 -16
  56. package/dist/operations/for.js +143 -143
  57. package/dist/operations/function.d.ts +26 -26
  58. package/dist/operations/function.js +145 -145
  59. package/dist/operations/if-statement.d.ts +8 -8
  60. package/dist/operations/if-statement.js +169 -169
  61. package/dist/operations/if.d.ts +12 -12
  62. package/dist/operations/if.js +31 -31
  63. package/dist/operations/new.d.ts +11 -11
  64. package/dist/operations/new.js +97 -96
  65. package/dist/operations/not.d.ts +11 -11
  66. package/dist/operations/not.js +96 -95
  67. package/dist/operations/reference.d.ts +11 -11
  68. package/dist/operations/reference.js +103 -102
  69. package/dist/operations/return.d.ts +11 -11
  70. package/dist/operations/return.js +106 -106
  71. package/dist/operations/while.d.ts +14 -14
  72. package/dist/operations/while.js +145 -133
  73. package/dist/resource.d.ts +9 -9
  74. package/dist/resource.js +29 -29
  75. package/dist/typer.d.ts +6 -6
  76. package/dist/typer.js +95 -95
  77. package/dist/types/custom-type.d.ts +22 -22
  78. package/dist/types/custom-type.js +67 -67
  79. package/dist/types/expression.d.ts +7 -7
  80. package/dist/types/expression.js +9 -9
  81. package/dist/types/operation.d.ts +10 -10
  82. package/dist/types/operation.js +38 -38
  83. package/package.json +44 -44
@@ -1,26 +1,26 @@
1
- import { CustomObjectType, Callable } from '../types/custom-type';
2
- export declare class CustomMapIterator implements Iterator<CustomMap> {
3
- value: Map<string, any>;
4
- index: number;
5
- constructor(value: Map<string, any>);
6
- next(): IteratorResult<CustomMap>;
7
- }
8
- export default class CustomMap extends CustomObjectType implements Iterable<CustomMap> {
9
- static intrinsics: Map<string, Function>;
10
- value: Map<string, any>;
11
- isInstance: boolean;
12
- constructor(value?: Map<string, any>);
13
- [Symbol.iterator](): CustomMapIterator;
14
- extend(value: Map<string, any>): CustomMap;
15
- has(path: string[]): Promise<boolean>;
16
- set(path: string[], value: any): Promise<void>;
17
- get(path: string[]): Promise<any>;
18
- getCallable(path: string[]): Promise<Callable>;
19
- createInstance(): CustomMap;
20
- getType(): string;
21
- toNumber(): number;
22
- toTruthy(): boolean;
23
- toString(): string;
24
- valueOf(): Map<string, any>;
25
- fork(): CustomMap;
26
- }
1
+ import { CustomObjectType, Callable } from '../types/custom-type';
2
+ export declare class CustomMapIterator implements Iterator<CustomMap> {
3
+ value: Map<string, any>;
4
+ index: number;
5
+ constructor(value: Map<string, any>);
6
+ next(): IteratorResult<CustomMap>;
7
+ }
8
+ export default class CustomMap extends CustomObjectType implements Iterable<CustomMap> {
9
+ static intrinsics: Map<string, Function>;
10
+ value: Map<string, any>;
11
+ isInstance: boolean;
12
+ constructor(value?: Map<string, any>);
13
+ [Symbol.iterator](): CustomMapIterator;
14
+ extend(value: Map<string, any>): CustomMap;
15
+ has(path: string[]): Promise<boolean>;
16
+ set(path: string[], value: any): Promise<void>;
17
+ get(path: string[]): Promise<any>;
18
+ getCallable(path: string[]): Promise<Callable>;
19
+ createInstance(): CustomMap;
20
+ getType(): string;
21
+ toNumber(): number;
22
+ toTruthy(): boolean;
23
+ toString(): string;
24
+ valueOf(): Map<string, any>;
25
+ fork(): CustomMap;
26
+ }
@@ -1,245 +1,245 @@
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 __read = (this && this.__read) || function (o, n) {
18
- var m = typeof Symbol === "function" && o[Symbol.iterator];
19
- if (!m) return o;
20
- var i = m.call(o), r, ar = [], e;
21
- try {
22
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
23
- }
24
- catch (error) { e = { error: error }; }
25
- finally {
26
- try {
27
- if (r && !r.done && (m = i["return"])) m.call(i);
28
- }
29
- finally { if (e) throw e.error; }
30
- }
31
- return ar;
32
- };
33
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
34
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
35
- if (ar || !(i in from)) {
36
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
37
- ar[i] = from[i];
38
- }
39
- }
40
- return to.concat(ar || Array.prototype.slice.call(from));
41
- };
42
- var __importDefault = (this && this.__importDefault) || function (mod) {
43
- return (mod && mod.__esModule) ? mod : { "default": mod };
44
- };
45
- Object.defineProperty(exports, "__esModule", { value: true });
46
- exports.CustomMapIterator = void 0;
47
- var nil_1 = __importDefault(require("./nil"));
48
- var custom_type_1 = require("../types/custom-type");
49
- var operation_1 = require("../types/operation");
50
- var string_1 = __importDefault(require("./string"));
51
- var CustomMapIterator = /** @class */ (function () {
52
- function CustomMapIterator(value) {
53
- var me = this;
54
- me.value = value;
55
- me.index = 0;
56
- }
57
- CustomMapIterator.prototype.next = function () {
58
- var me = this;
59
- var keys = Array.from(me.value.keys());
60
- if (me.index === keys.length) {
61
- return {
62
- value: new nil_1.default(),
63
- done: true
64
- };
65
- }
66
- var key = keys[me.index++];
67
- return {
68
- value: new CustomMap(new Map([
69
- ['key', new string_1.default(key)],
70
- ['value', me.value.get(key)]
71
- ])),
72
- done: false
73
- };
74
- };
75
- return CustomMapIterator;
76
- }());
77
- exports.CustomMapIterator = CustomMapIterator;
78
- var CustomMap = /** @class */ (function (_super) {
79
- __extends(CustomMap, _super);
80
- function CustomMap(value) {
81
- var _this = _super.call(this) || this;
82
- var me = _this;
83
- me.value = value || new Map();
84
- me.isInstance = false;
85
- return _this;
86
- }
87
- CustomMap.prototype[Symbol.iterator] = function () {
88
- return new CustomMapIterator(this.value);
89
- };
90
- CustomMap.prototype.extend = function (value) {
91
- var me = this;
92
- me.value = new Map(__spreadArray(__spreadArray([], __read(me.value.entries()), false), __read(value.entries()), false));
93
- return me;
94
- };
95
- CustomMap.prototype.has = function (path) {
96
- var me = this;
97
- if (path.length === 0) {
98
- return Promise.resolve(true);
99
- }
100
- var traversalPath = [].concat(path);
101
- var refs = me.value;
102
- var current = traversalPath.shift();
103
- if (current != null) {
104
- if (refs.has(current)) {
105
- var sub = refs.get(current);
106
- if (traversalPath.length > 0 && sub instanceof custom_type_1.CustomObjectType) {
107
- return sub.has(traversalPath);
108
- }
109
- if (traversalPath.length === 0) {
110
- return Promise.resolve(true);
111
- }
112
- }
113
- }
114
- return Promise.resolve(false);
115
- };
116
- CustomMap.prototype.set = function (path, value) {
117
- var me = this;
118
- if (!path) {
119
- console.warn('Cannot set empty path for ', me);
120
- return;
121
- }
122
- var traversalPath = [].concat(path);
123
- var refs = me.value;
124
- var last = traversalPath.pop();
125
- var current = traversalPath.shift();
126
- if (current != null) {
127
- if (refs.has(current)) {
128
- var sub = refs.get(current);
129
- if (sub instanceof custom_type_1.CustomObjectType) {
130
- return sub.set(traversalPath.concat(last), value);
131
- }
132
- }
133
- console.warn("Cannot set path ".concat(path === null || path === void 0 ? void 0 : path.join('.')));
134
- return;
135
- }
136
- if (value instanceof operation_1.FunctionOperationBase) {
137
- refs.set(last, value.fork(me));
138
- }
139
- else {
140
- refs.set(last, value);
141
- }
142
- };
143
- CustomMap.prototype.get = function (path) {
144
- var me = this;
145
- if (path.length === 0) {
146
- return Promise.resolve(me);
147
- }
148
- var traversalPath = [].concat(path);
149
- var refs = me.value;
150
- var current = traversalPath.shift();
151
- if (current != null) {
152
- if (refs.has(current)) {
153
- var sub = refs.get(current);
154
- if (traversalPath.length > 0 &&
155
- (sub instanceof custom_type_1.CustomObjectType || sub instanceof string_1.default)) {
156
- return sub.get(traversalPath);
157
- }
158
- if (traversalPath.length === 0) {
159
- return sub;
160
- }
161
- }
162
- else if (path.length === 1 && CustomMap.intrinsics.has(current)) {
163
- return Promise.resolve(CustomMap.intrinsics.get(current).bind(null, me));
164
- }
165
- else {
166
- throw new Error("Cannot get path ".concat(path.join('.')));
167
- }
168
- }
169
- return Promise.resolve(null);
170
- };
171
- CustomMap.prototype.getCallable = function (path) {
172
- var me = this;
173
- var traversalPath = [].concat(path);
174
- var refs = me.value;
175
- var current = traversalPath.shift();
176
- if (current != null) {
177
- if (refs.has(current)) {
178
- var sub = refs.get(current);
179
- if (sub instanceof custom_type_1.CustomObjectType || sub instanceof string_1.default) {
180
- return sub.getCallable(traversalPath);
181
- }
182
- if (traversalPath.length === 0) {
183
- return Promise.resolve({
184
- origin: sub,
185
- context: me
186
- });
187
- }
188
- }
189
- else if (path.length === 1 && CustomMap.intrinsics.has(current)) {
190
- return Promise.resolve({
191
- origin: CustomMap.intrinsics.get(current).bind(null, me),
192
- context: me
193
- });
194
- }
195
- else {
196
- throw new Error("Cannot get callable path ".concat(path.join('.')));
197
- }
198
- }
199
- return Promise.resolve({
200
- origin: null,
201
- context: me
202
- });
203
- };
204
- CustomMap.prototype.createInstance = function () {
205
- var me = this;
206
- var newInstance = new CustomMap();
207
- newInstance.isInstance = true;
208
- me.value.forEach(function (item, key) {
209
- newInstance.value.set(key, item instanceof operation_1.FunctionOperationBase
210
- ? item.fork(newInstance)
211
- : item);
212
- });
213
- return newInstance;
214
- };
215
- CustomMap.prototype.getType = function () {
216
- var _a;
217
- var me = this;
218
- return ((_a = me.value.get('classID')) === null || _a === void 0 ? void 0 : _a.toString()) || 'map';
219
- };
220
- CustomMap.prototype.toNumber = function () {
221
- return Number.NaN;
222
- };
223
- CustomMap.prototype.toTruthy = function () {
224
- return this.value.size > 0;
225
- };
226
- CustomMap.prototype.toString = function () {
227
- var me = this;
228
- var body = Object
229
- .entries(me.value)
230
- .map(function (_a) {
231
- var _b = __read(_a, 2), key = _b[0], value = _b[1];
232
- return "\"".concat(key, "\": ").concat(value === null || value === void 0 ? void 0 : value.toString());
233
- });
234
- return "{".concat(body.join(','), "}");
235
- };
236
- CustomMap.prototype.valueOf = function () {
237
- return this.value;
238
- };
239
- CustomMap.prototype.fork = function () {
240
- return new CustomMap(this.value);
241
- };
242
- CustomMap.intrinsics = new Map();
243
- return CustomMap;
244
- }(custom_type_1.CustomObjectType));
245
- exports.default = CustomMap;
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 __read = (this && this.__read) || function (o, n) {
18
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
19
+ if (!m) return o;
20
+ var i = m.call(o), r, ar = [], e;
21
+ try {
22
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
23
+ }
24
+ catch (error) { e = { error: error }; }
25
+ finally {
26
+ try {
27
+ if (r && !r.done && (m = i["return"])) m.call(i);
28
+ }
29
+ finally { if (e) throw e.error; }
30
+ }
31
+ return ar;
32
+ };
33
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
34
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
35
+ if (ar || !(i in from)) {
36
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
37
+ ar[i] = from[i];
38
+ }
39
+ }
40
+ return to.concat(ar || Array.prototype.slice.call(from));
41
+ };
42
+ var __importDefault = (this && this.__importDefault) || function (mod) {
43
+ return (mod && mod.__esModule) ? mod : { "default": mod };
44
+ };
45
+ Object.defineProperty(exports, "__esModule", { value: true });
46
+ exports.CustomMapIterator = void 0;
47
+ var nil_1 = __importDefault(require("./nil"));
48
+ var custom_type_1 = require("../types/custom-type");
49
+ var operation_1 = require("../types/operation");
50
+ var string_1 = __importDefault(require("./string"));
51
+ var CustomMapIterator = /** @class */ (function () {
52
+ function CustomMapIterator(value) {
53
+ var me = this;
54
+ me.value = value;
55
+ me.index = 0;
56
+ }
57
+ CustomMapIterator.prototype.next = function () {
58
+ var me = this;
59
+ var keys = Array.from(me.value.keys());
60
+ if (me.index === keys.length) {
61
+ return {
62
+ value: new nil_1.default(),
63
+ done: true
64
+ };
65
+ }
66
+ var key = keys[me.index++];
67
+ return {
68
+ value: new CustomMap(new Map([
69
+ ['key', new string_1.default(key)],
70
+ ['value', me.value.get(key)]
71
+ ])),
72
+ done: false
73
+ };
74
+ };
75
+ return CustomMapIterator;
76
+ }());
77
+ exports.CustomMapIterator = CustomMapIterator;
78
+ var CustomMap = /** @class */ (function (_super) {
79
+ __extends(CustomMap, _super);
80
+ function CustomMap(value) {
81
+ var _this = _super.call(this) || this;
82
+ var me = _this;
83
+ me.value = value || new Map();
84
+ me.isInstance = false;
85
+ return _this;
86
+ }
87
+ CustomMap.prototype[Symbol.iterator] = function () {
88
+ return new CustomMapIterator(this.value);
89
+ };
90
+ CustomMap.prototype.extend = function (value) {
91
+ var me = this;
92
+ me.value = new Map(__spreadArray(__spreadArray([], __read(me.value.entries()), false), __read(value.entries()), false));
93
+ return me;
94
+ };
95
+ CustomMap.prototype.has = function (path) {
96
+ var me = this;
97
+ if (path.length === 0) {
98
+ return Promise.resolve(true);
99
+ }
100
+ var traversalPath = [].concat(path);
101
+ var refs = me.value;
102
+ var current = traversalPath.shift();
103
+ if (current != null) {
104
+ if (refs.has(current)) {
105
+ var sub = refs.get(current);
106
+ if (traversalPath.length > 0 && sub instanceof custom_type_1.CustomObjectType) {
107
+ return sub.has(traversalPath);
108
+ }
109
+ if (traversalPath.length === 0) {
110
+ return Promise.resolve(true);
111
+ }
112
+ }
113
+ }
114
+ return Promise.resolve(false);
115
+ };
116
+ CustomMap.prototype.set = function (path, value) {
117
+ var me = this;
118
+ if (!path) {
119
+ console.warn('Cannot set empty path for ', me);
120
+ return;
121
+ }
122
+ var traversalPath = [].concat(path);
123
+ var refs = me.value;
124
+ var last = traversalPath.pop();
125
+ var current = traversalPath.shift();
126
+ if (current != null) {
127
+ if (refs.has(current)) {
128
+ var sub = refs.get(current);
129
+ if (sub instanceof custom_type_1.CustomObjectType) {
130
+ return sub.set(traversalPath.concat(last), value);
131
+ }
132
+ }
133
+ console.warn("Cannot set path ".concat(path === null || path === void 0 ? void 0 : path.join('.')));
134
+ return;
135
+ }
136
+ if (value instanceof operation_1.FunctionOperationBase) {
137
+ refs.set(last, value.fork(me));
138
+ }
139
+ else {
140
+ refs.set(last, value);
141
+ }
142
+ };
143
+ CustomMap.prototype.get = function (path) {
144
+ var me = this;
145
+ if (path.length === 0) {
146
+ return Promise.resolve(me);
147
+ }
148
+ var traversalPath = [].concat(path);
149
+ var refs = me.value;
150
+ var current = traversalPath.shift();
151
+ if (current != null) {
152
+ if (refs.has(current)) {
153
+ var sub = refs.get(current);
154
+ if (traversalPath.length > 0 &&
155
+ (sub instanceof custom_type_1.CustomObjectType || sub instanceof string_1.default)) {
156
+ return sub.get(traversalPath);
157
+ }
158
+ if (traversalPath.length === 0) {
159
+ return sub;
160
+ }
161
+ }
162
+ else if (path.length === 1 && CustomMap.intrinsics.has(current)) {
163
+ return Promise.resolve(CustomMap.intrinsics.get(current).bind(null, me));
164
+ }
165
+ else {
166
+ throw new Error("Cannot get path ".concat(path.join('.')));
167
+ }
168
+ }
169
+ return Promise.resolve(null);
170
+ };
171
+ CustomMap.prototype.getCallable = function (path) {
172
+ var me = this;
173
+ var traversalPath = [].concat(path);
174
+ var refs = me.value;
175
+ var current = traversalPath.shift();
176
+ if (current != null) {
177
+ if (refs.has(current)) {
178
+ var sub = refs.get(current);
179
+ if (sub instanceof custom_type_1.CustomObjectType || sub instanceof string_1.default) {
180
+ return sub.getCallable(traversalPath);
181
+ }
182
+ if (traversalPath.length === 0) {
183
+ return Promise.resolve({
184
+ origin: sub,
185
+ context: me
186
+ });
187
+ }
188
+ }
189
+ else if (path.length === 1 && CustomMap.intrinsics.has(current)) {
190
+ return Promise.resolve({
191
+ origin: CustomMap.intrinsics.get(current).bind(null, me),
192
+ context: me
193
+ });
194
+ }
195
+ else {
196
+ throw new Error("Cannot get callable path ".concat(path.join('.')));
197
+ }
198
+ }
199
+ return Promise.resolve({
200
+ origin: null,
201
+ context: me
202
+ });
203
+ };
204
+ CustomMap.prototype.createInstance = function () {
205
+ var me = this;
206
+ var newInstance = new CustomMap();
207
+ newInstance.isInstance = true;
208
+ me.value.forEach(function (item, key) {
209
+ newInstance.value.set(key, item instanceof operation_1.FunctionOperationBase
210
+ ? item.fork(newInstance)
211
+ : item);
212
+ });
213
+ return newInstance;
214
+ };
215
+ CustomMap.prototype.getType = function () {
216
+ var _a;
217
+ var me = this;
218
+ return ((_a = me.value.get('classID')) === null || _a === void 0 ? void 0 : _a.toString()) || 'map';
219
+ };
220
+ CustomMap.prototype.toNumber = function () {
221
+ return Number.NaN;
222
+ };
223
+ CustomMap.prototype.toTruthy = function () {
224
+ return this.value.size > 0;
225
+ };
226
+ CustomMap.prototype.toString = function () {
227
+ var me = this;
228
+ var body = Object
229
+ .entries(me.value)
230
+ .map(function (_a) {
231
+ var _b = __read(_a, 2), key = _b[0], value = _b[1];
232
+ return "\"".concat(key, "\": ").concat(value === null || value === void 0 ? void 0 : value.toString());
233
+ });
234
+ return "{".concat(body.join(','), "}");
235
+ };
236
+ CustomMap.prototype.valueOf = function () {
237
+ return this.value;
238
+ };
239
+ CustomMap.prototype.fork = function () {
240
+ return new CustomMap(this.value);
241
+ };
242
+ CustomMap.intrinsics = new Map();
243
+ return CustomMap;
244
+ }(custom_type_1.CustomObjectType));
245
+ exports.default = CustomMap;
@@ -1,10 +1,10 @@
1
- import { CustomLiteralType } from '../types/custom-type';
2
- export default class CustomNil extends CustomLiteralType {
3
- static intrinsics: Map<string, Function>;
4
- value: null;
5
- getType(): string;
6
- toNumber(): number;
7
- toTruthy(): boolean;
8
- toString(): string;
9
- valueOf(): any[];
10
- }
1
+ import { CustomLiteralType } from '../types/custom-type';
2
+ export default class CustomNil extends CustomLiteralType {
3
+ static intrinsics: Map<string, Function>;
4
+ value: null;
5
+ getType(): string;
6
+ toNumber(): number;
7
+ toTruthy(): boolean;
8
+ toString(): string;
9
+ valueOf(): any[];
10
+ }
@@ -1,44 +1,44 @@
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 custom_type_1 = require("../types/custom-type");
19
- var CustomNil = /** @class */ (function (_super) {
20
- __extends(CustomNil, _super);
21
- function CustomNil() {
22
- var _this = _super !== null && _super.apply(this, arguments) || this;
23
- _this.value = null;
24
- return _this;
25
- }
26
- CustomNil.prototype.getType = function () {
27
- return 'null';
28
- };
29
- CustomNil.prototype.toNumber = function () {
30
- return Number.NaN;
31
- };
32
- CustomNil.prototype.toTruthy = function () {
33
- return false;
34
- };
35
- CustomNil.prototype.toString = function () {
36
- return 'null';
37
- };
38
- CustomNil.prototype.valueOf = function () {
39
- return null;
40
- };
41
- CustomNil.intrinsics = new Map();
42
- return CustomNil;
43
- }(custom_type_1.CustomLiteralType));
44
- exports.default = CustomNil;
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 custom_type_1 = require("../types/custom-type");
19
+ var CustomNil = /** @class */ (function (_super) {
20
+ __extends(CustomNil, _super);
21
+ function CustomNil() {
22
+ var _this = _super !== null && _super.apply(this, arguments) || this;
23
+ _this.value = null;
24
+ return _this;
25
+ }
26
+ CustomNil.prototype.getType = function () {
27
+ return 'null';
28
+ };
29
+ CustomNil.prototype.toNumber = function () {
30
+ return Number.NaN;
31
+ };
32
+ CustomNil.prototype.toTruthy = function () {
33
+ return false;
34
+ };
35
+ CustomNil.prototype.toString = function () {
36
+ return 'null';
37
+ };
38
+ CustomNil.prototype.valueOf = function () {
39
+ return null;
40
+ };
41
+ CustomNil.intrinsics = new Map();
42
+ return CustomNil;
43
+ }(custom_type_1.CustomLiteralType));
44
+ exports.default = CustomNil;