picocalc 0.0.3 → 0.0.4
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.mts +2 -2
- package/dist/index.mjs +5 -5
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -7,7 +7,7 @@ interface PrecisionOptions {
|
|
|
7
7
|
}
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/lib/errors.d.ts
|
|
10
|
-
declare class
|
|
10
|
+
declare class PicocalcError extends Error {
|
|
11
11
|
pos?: number;
|
|
12
12
|
constructor(name: string, message: string, pos?: number);
|
|
13
13
|
}
|
|
@@ -21,4 +21,4 @@ interface CalculateOptions extends PrecisionOptions {
|
|
|
21
21
|
*/
|
|
22
22
|
declare function calculate(expression: string, options?: CalculateOptions): string;
|
|
23
23
|
//#endregion
|
|
24
|
-
export {
|
|
24
|
+
export { PicocalcError, calculate };
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "bigint.bitlength";
|
|
2
2
|
//#region src/lib/errors.ts
|
|
3
|
-
var
|
|
3
|
+
var PicocalcError = class extends Error {
|
|
4
4
|
pos;
|
|
5
5
|
constructor(name, message, pos) {
|
|
6
6
|
if (pos === void 0) super(message);
|
|
@@ -9,7 +9,7 @@ var PicocalcErrror = class extends Error {
|
|
|
9
9
|
this.name = name;
|
|
10
10
|
}
|
|
11
11
|
};
|
|
12
|
-
var InterpreterError = class extends
|
|
12
|
+
var InterpreterError = class extends PicocalcError {
|
|
13
13
|
constructor(message, pos) {
|
|
14
14
|
super("InterpreterError", message, pos);
|
|
15
15
|
}
|
|
@@ -806,7 +806,7 @@ function evaluate(tokens, options = {}) {
|
|
|
806
806
|
}
|
|
807
807
|
//#endregion
|
|
808
808
|
//#region src/lib/lexer.ts
|
|
809
|
-
var LexerError = class extends
|
|
809
|
+
var LexerError = class extends PicocalcError {
|
|
810
810
|
constructor(message, pos) {
|
|
811
811
|
super("LexerError", message, pos);
|
|
812
812
|
}
|
|
@@ -952,7 +952,7 @@ function isBinaryOperator(token) {
|
|
|
952
952
|
function isUnaryContext(last) {
|
|
953
953
|
return !isOperand(last);
|
|
954
954
|
}
|
|
955
|
-
var ParserError = class extends
|
|
955
|
+
var ParserError = class extends PicocalcError {
|
|
956
956
|
constructor(message, pos) {
|
|
957
957
|
super("ParserError", message, pos);
|
|
958
958
|
}
|
|
@@ -1099,4 +1099,4 @@ function calculate(expression, options) {
|
|
|
1099
1099
|
return formatResult(evaluate(parse(tokenize(expression, options)), options), options);
|
|
1100
1100
|
}
|
|
1101
1101
|
//#endregion
|
|
1102
|
-
export {
|
|
1102
|
+
export { PicocalcError, calculate };
|