Skip to content

Commit

Permalink
fix: enhance number operator
Browse files Browse the repository at this point in the history
  • Loading branch information
Adi Fatkhurozi committed Jul 10, 2023
1 parent f814844 commit 4ae31bc
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/createParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ export function createParser(props: ExpressionParserConstructor = {}) {
random: () => Math.random(),
floor: (_, value: number) => Math.floor(value),
abs: (_, value: number) => Math.abs(value),
precision: (_, value: number, precision: number) => +value.toPrecision(precision),
fixed: (_, value: number, fractionDigits: number) => +value.toFixed(fractionDigits),
// STRING ==================================================================================
split: (_, value: string, arg: string) => value.split(arg),
upper: (_, value: string) => value.toUpperCase(),
Expand Down

0 comments on commit 4ae31bc

Please sign in to comment.