affinirum 1.2.5 → 1.2.7
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/dst/Affinirum.d.ts +7 -0
- package/dst/Affinirum.js +10 -0
- package/dst/cjs/Affinirum.js +10 -0
- package/dst/cjs/constant/notation/AN.js +2 -2
- package/dst/constant/notation/AN.js +2 -2
- package/package.json +1 -1
package/dst/Affinirum.d.ts
CHANGED
|
@@ -54,6 +54,13 @@ export declare class Affinirum {
|
|
|
54
54
|
@returns Calculated value.
|
|
55
55
|
*/
|
|
56
56
|
evaluate(values?: Record<string, Value>): Value;
|
|
57
|
+
/**
|
|
58
|
+
Produces string in Affinirum Notation.
|
|
59
|
+
@param value Value to format.
|
|
60
|
+
@param whitespace Optional white space characters for readability.
|
|
61
|
+
@returns String formatted in Affinirum Notation.
|
|
62
|
+
*/
|
|
63
|
+
static format(value: Value, whitespace?: string): string;
|
|
57
64
|
protected _list(state: ParserState, scope: StaticScope): Node;
|
|
58
65
|
protected _unit(state: ParserState, scope: StaticScope): Node;
|
|
59
66
|
protected _coalescence(state: ParserState, scope: StaticScope): Node;
|
package/dst/Affinirum.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { formatAN } from "./constant/notation/AN.js";
|
|
1
2
|
import { funcOr, funcAnd, funcNot } from "./constant/Boolean.js";
|
|
2
3
|
import { funcAdd } from "./constant/Aggregable.js";
|
|
3
4
|
import { funcAt, funcHas } from "./constant/Iterable.js";
|
|
@@ -117,6 +118,15 @@ export class Affinirum {
|
|
|
117
118
|
throw e;
|
|
118
119
|
}
|
|
119
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
Produces string in Affinirum Notation.
|
|
123
|
+
@param value Value to format.
|
|
124
|
+
@param whitespace Optional white space characters for readability.
|
|
125
|
+
@returns String formatted in Affinirum Notation.
|
|
126
|
+
*/
|
|
127
|
+
static format(value, whitespace) {
|
|
128
|
+
return formatAN(value, whitespace);
|
|
129
|
+
}
|
|
120
130
|
_list(state, scope) {
|
|
121
131
|
const frame = state.starts();
|
|
122
132
|
const subnodes = [];
|
package/dst/cjs/Affinirum.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Affinirum = void 0;
|
|
4
|
+
const AN_js_1 = require("./constant/notation/AN.js");
|
|
4
5
|
const Boolean_js_1 = require("./constant/Boolean.js");
|
|
5
6
|
const Aggregable_js_1 = require("./constant/Aggregable.js");
|
|
6
7
|
const Iterable_js_1 = require("./constant/Iterable.js");
|
|
@@ -120,6 +121,15 @@ class Affinirum {
|
|
|
120
121
|
throw e;
|
|
121
122
|
}
|
|
122
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
Produces string in Affinirum Notation.
|
|
126
|
+
@param value Value to format.
|
|
127
|
+
@param whitespace Optional white space characters for readability.
|
|
128
|
+
@returns String formatted in Affinirum Notation.
|
|
129
|
+
*/
|
|
130
|
+
static format(value, whitespace) {
|
|
131
|
+
return (0, AN_js_1.formatAN)(value, whitespace);
|
|
132
|
+
}
|
|
123
133
|
_list(state, scope) {
|
|
124
134
|
const frame = state.starts();
|
|
125
135
|
const subnodes = [];
|
|
@@ -33,8 +33,8 @@ const formatAN = (value, whitespace) => {
|
|
|
33
33
|
return `[${lines.join(",")}${suffix}]`;
|
|
34
34
|
}
|
|
35
35
|
if (typeof value === "object") {
|
|
36
|
-
const [prefix, suffix] = whitespace ? ["\n" + whitespace, "\n"] : ["", ""];
|
|
37
|
-
const lines = Object.entries(value).map(([k, v]) => `${prefix}"${k}"
|
|
36
|
+
const [prefix, suffix, separator] = whitespace ? ["\n" + whitespace, "\n", ": "] : ["", "", ":"];
|
|
37
|
+
const lines = Object.entries(value).map(([k, v]) => `${prefix}"${k}"${separator}${(0, exports.formatAN)(v, whitespace).split("\n").join(prefix)}`);
|
|
38
38
|
return `[${lines.join(",")}${suffix}]`;
|
|
39
39
|
}
|
|
40
40
|
return "function";
|
|
@@ -30,8 +30,8 @@ export const formatAN = (value, whitespace) => {
|
|
|
30
30
|
return `[${lines.join(",")}${suffix}]`;
|
|
31
31
|
}
|
|
32
32
|
if (typeof value === "object") {
|
|
33
|
-
const [prefix, suffix] = whitespace ? ["\n" + whitespace, "\n"] : ["", ""];
|
|
34
|
-
const lines = Object.entries(value).map(([k, v]) => `${prefix}"${k}"
|
|
33
|
+
const [prefix, suffix, separator] = whitespace ? ["\n" + whitespace, "\n", ": "] : ["", "", ":"];
|
|
34
|
+
const lines = Object.entries(value).map(([k, v]) => `${prefix}"${k}"${separator}${formatAN(v, whitespace).split("\n").join(prefix)}`);
|
|
35
35
|
return `[${lines.join(",")}${suffix}]`;
|
|
36
36
|
}
|
|
37
37
|
return "function";
|