From 270d07d39ecc841e01f559f240ae1ce7b3030b61 Mon Sep 17 00:00:00 2001 From: Adam Zerella <1501560+azerella@users.noreply.github.com> Date: Thu, 7 Jul 2022 14:08:53 +0930 Subject: [PATCH 1/2] update(math-expression-evaluator): v1.3 --- types/math-expression-evaluator/index.d.ts | 26 ++++++++++++++++++- .../math-expression-evaluator-tests.ts | 11 ++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/types/math-expression-evaluator/index.d.ts b/types/math-expression-evaluator/index.d.ts index 61ac6bdb175758..c04409995b5779 100644 --- a/types/math-expression-evaluator/index.d.ts +++ b/types/math-expression-evaluator/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for math-expression-evaluator 1.2 +// Type definitions for math-expression-evaluator 1.3 // Project: https://github.com/bugwheels94/math-expression-evaluator // Definitions by: DefinitelyTyped +// Definitions by: Adam Zerella // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface Token { @@ -9,13 +10,36 @@ interface Token { value?: string|((a: number, b?: number) => number) | undefined; show: string; preced?: number | undefined; + numberOfArguments?: number; } +type TokenName = + | 'FUNCTION_WITH_ONE_ARG' + | 'NUMBER' + | 'BINARY_OPERATOR_HIGH_PRECENDENCE' + | 'CONSTANT' + | 'OPENING_PARENTHESIS' + | 'CLOSING_PARENTHESIS' + | 'DECIMAL' + | 'POSTFIX_FUNCTION_WITH_ONE_ARG' + | 'FUNCTION_WITH_N_ARGS' + | 'BINARY_OPERATOR_LOW_PRECENDENCE' + | 'BINARY_OPERATOR_PERMUTATION' + | 'COMMA' + | 'EVALUATED_FUNCTION' + | 'EVALUATED_FUNCTION_PARAMETER' + | 'SPACE'; + +type TokenTypes = { + [K in TokenName]: number; +}; + declare class Mexp { static lex(inp: string, tokens?: Token[]): Mexp; formulaEval(): Mexp; toPostfix(): Mexp; postfixEval(pair?: object): number|string; + static tokenTypes: TokenTypes; static eval(exp: string, tokens?: Token[], pair?: object): string; static eval(exp: string, mexp?: object): string; static addToken(tokens: Token[]): void; diff --git a/types/math-expression-evaluator/math-expression-evaluator-tests.ts b/types/math-expression-evaluator/math-expression-evaluator-tests.ts index 5af0a9d761bc06..514f387e8dcbc2 100644 --- a/types/math-expression-evaluator/math-expression-evaluator-tests.ts +++ b/types/math-expression-evaluator/math-expression-evaluator-tests.ts @@ -30,6 +30,17 @@ Mexp.addToken([{ preced: 11, token: "mexp" }]); + +Mexp.addToken([{ + type: Mexp.tokenTypes.FUNCTION_WITH_N_ARGS, + token: 'maxof5', + show: 'maxof5', + numberOfArguments: 5, + value: function (a, b) { + return Math.max.apply(Math, [a, b]) + }, +}]); + Mexp.lex("mexp3").toPostfix().postfixEval(); Mexp.lex('mexp3').toPostfix(); From a012c0d86d1b4cae8e799bfdd6ef6693d5478809 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 7 Jul 2022 04:39:40 +0000 Subject: [PATCH 2/2] Bump peter-evans/create-pull-request from 4.0.3 to 4.0.4 Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 4.0.3 to 4.0.4. - [Release notes](https://github.com/peter-evans/create-pull-request/releases) - [Commits](https://github.com/peter-evans/create-pull-request/compare/v4.0.3...v4.0.4) --- updated-dependencies: - dependency-name: peter-evans/create-pull-request dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/ghostbuster.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ghostbuster.yml b/.github/workflows/ghostbuster.yml index d27d116b634ad8..757cb932ac6f22 100644 --- a/.github/workflows/ghostbuster.yml +++ b/.github/workflows/ghostbuster.yml @@ -47,7 +47,7 @@ jobs: fi - if: ${{ inputs.skipPR != 'true' }} - uses: peter-evans/create-pull-request@v4.0.3 + uses: peter-evans/create-pull-request@v4.0.4 with: token: ${{ secrets.GITHUB_TOKEN }} commit-message: "Remove contributors with deleted accounts #no-publishing-comment"