greybel-interpreter 1.9.7 → 1.9.8

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.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { ContextForkOptions, ContextOptions, ContextState, ContextType, Debugger, FunctionState, LoopState, OperationContext, ProcessState, Scope } from './context';
2
2
  export { CPS, CPSContext } from './cps';
3
3
  export { DefaultErrorHandler, ErrorHandler } from './handler/error';
4
- export { DefaultOutputHandler, KeyEvent, PrintOptions, OutputHandler } from './handler/output';
4
+ export { DefaultOutputHandler, KeyEvent, OutputHandler, PrintOptions } from './handler/output';
5
5
  export { DefaultResourceHandler, ResourceHandler } from './handler/resource';
6
6
  export { HandlerContainer } from './handler-container';
7
7
  export { Interpreter, InterpreterOptions } from './interpreter';
@@ -1,6 +1,5 @@
1
- import { CustomValue } from './base';
2
- export declare class CustomBoolean extends CustomValue {
3
- readonly value: boolean;
1
+ import { CustomNumber } from './number';
2
+ export declare class CustomBoolean extends CustomNumber {
4
3
  constructor(value: boolean);
5
4
  getCustomType(): string;
6
5
  toJSON(): string;
@@ -9,7 +8,6 @@ export declare class CustomBoolean extends CustomValue {
9
8
  toNumber(): number;
10
9
  toInt(): number;
11
10
  toTruthy(): boolean;
12
- instanceOf(v: CustomValue): boolean;
13
11
  }
14
12
  export declare const DefaultTrue: CustomBoolean;
15
13
  export declare const DefaultFalse: CustomBoolean;
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DefaultFalse = exports.DefaultTrue = exports.CustomBoolean = void 0;
4
- const base_1 = require("./base");
5
- class CustomBoolean extends base_1.CustomValue {
4
+ const number_1 = require("./number");
5
+ class CustomBoolean extends number_1.CustomNumber {
6
6
  constructor(value) {
7
- super();
8
- this.value = !!value;
7
+ super(+value);
9
8
  }
10
9
  getCustomType() {
11
10
  return 'number';
@@ -17,7 +16,7 @@ class CustomBoolean extends base_1.CustomValue {
17
16
  return this.value.toString();
18
17
  }
19
18
  fork() {
20
- return new CustomBoolean(this.value);
19
+ return new CustomBoolean(!!this.value);
21
20
  }
22
21
  toNumber() {
23
22
  return this.value ? 1.0 : 0.0;
@@ -26,10 +25,7 @@ class CustomBoolean extends base_1.CustomValue {
26
25
  return this.value ? 1 : 0;
27
26
  }
28
27
  toTruthy() {
29
- return this.value;
30
- }
31
- instanceOf(v) {
32
- return v instanceof CustomBoolean;
28
+ return !!this.value;
33
29
  }
34
30
  }
35
31
  exports.CustomBoolean = CustomBoolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "greybel-interpreter",
3
- "version": "1.9.7",
3
+ "version": "1.9.8",
4
4
  "description": "Interpreter",
5
5
  "main": "dist/index",
6
6
  "typings": "dist/index",