1.2.1 • Published 2 years ago

fr_arithmetic_zeng v1.2.1

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

fr_arithmetic_zeng

Can be used to calculate the four arithmetic expression of integer(+-*/())

Installation

With npm:

npm install fr_arithmetic_zeng

Usage

calcu(obj)

obj: { formula: string, data: {} }. formula:Hold characters expression.data:Store the value of the corresponding characters.

const fr = require('fr_arithmetic_zeng');
let result = fr.calcu({
             //公式
             formula: '(x+y)*z',
             //参数
             data: {
                 x: 1,
                 y: 2,
                 z: 1
             }
         });
console.log(result);    // 3

or

const fr = require('fr_arithmetic_zeng');
let result = fr.calcu({
             //公式
             formula: '(x+y)*z',
             //参数
             data: {
                 x: "31111111111111111111111111111111111111111111111111111111111111111111111111111111111111",
                 y: "31111111111111111111111111111111111111111111111111111111111111111111111111111111111111",
                 z: 1
             }
         });
console.log(result);    // 62222222222222222222222222222222222222222222222222222222222222222222222222222222222222

Returns a string representation of integer. obj Parameter is the object and the object needs to have attributes formula (String), data (object)

1.2.1

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago