Rename eval to evaluate

eval is a JS keyword
This commit is contained in:
Sam Nolan 2022-04-11 11:18:38 +10:00
parent d6c541036f
commit 6565d97f53
4 changed files with 6 additions and 4 deletions

View File

@ -4,7 +4,7 @@ open Jest
open Expect open Expect
let expectEvalToBe = (expr: string, answer: string) => let expectEvalToBe = (expr: string, answer: string) =>
Reducer.eval(expr)->ExpressionValue.toStringResult->expect->toBe(answer) Reducer.evaluate(expr)->ExpressionValue.toStringResult->expect->toBe(answer)
describe("builtin", () => { describe("builtin", () => {
// All MathJs operators and functions are available for string, number and boolean // All MathJs operators and functions are available for string, number and boolean

View File

@ -8,4 +8,4 @@ let expectParseToBe = (expr: string, answer: string) =>
Reducer.parse(expr)->Expression.toStringResult->expect->toBe(answer) Reducer.parse(expr)->Expression.toStringResult->expect->toBe(answer)
let expectEvalToBe = (expr: string, answer: string) => let expectEvalToBe = (expr: string, answer: string) =>
Reducer.eval(expr)->ExpressionValue.toStringResult->expect->toBe(answer) Reducer.evaluate(expr)->ExpressionValue.toStringResult->expect->toBe(answer)

View File

@ -5,5 +5,5 @@ module Extra = Reducer_Extra
module Js = Reducer_Js module Js = Reducer_Js
module MathJs = Reducer_MathJs module MathJs = Reducer_MathJs
let eval = Expression.eval let evaluate = Expression.eval
let parse = Expression.parse let parse = Expression.parse

View File

@ -4,5 +4,7 @@ module Expression = Reducer_Expression
module Extra = Reducer_Extra module Extra = Reducer_Extra
module Js = Reducer_Js module Js = Reducer_Js
module MathJs = Reducer_MathJs module MathJs = Reducer_MathJs
let eval: string => result<Expression.expressionValue, ErrorValue.errorValue>
@genType
let evaluate: string => result<Expression.expressionValue, ErrorValue.errorValue>
let parse: string => result<Expression.expression, ErrorValue.errorValue> let parse: string => result<Expression.expression, ErrorValue.errorValue>