Formula is in its early stages and is not ready for production use.
So far we have the following features:
- 18 date time functions
- 26 text functions
- 26 math functions
- 7 logical functions
- 2 web functions
- plus all arithmetic and comparison operators
Add this library to your project withcargo add formula
or addformula = "*"
to yourCargo.toml
file.
Use it similar to the following code:
useformula::{Formula,Expr,Result};
fnmain()->Result<()>{
letformula =Formula::new("=UPPER(TRIM(' Hello '))")?;
letvalue = formula.parse()?;
assert_eq!(value,Expr::String("HELLO".to_string()));
Ok(())
}
Add this library to your project withnpm install formula-wasm
or addformula-wasm
to yourpackage.json
file.
Use it similar to the following code:
import{parse}from'formula-wasm';
constvalue=parse('=UPPER(TRIM( "Hello" ))');
console.assert(value,"HELLO");
- We don't support all existing functions in the world, but we would like to add more of them, like Excel functions, Google Sheets functions, and so on
- At the moment, we don't support table data. It means you need to extract table data and pass theirs values to this library
- We do not support simple formulas like
1+1
or as argument likeAND(1>3, 1<3)
orSUM(2-1, 2)
.Instead, you can use ourF.
functions likeAND(F.GT(1, 3), F.LT(1, 3))
orSUM(F.SUB(2, 1), 2)
- We still do not support parentheses to change the order of operations, but you can use our
F.
functions. So for example instead of2*(1+1)
,you should useF.MUL(2, F.ADD(1, 1))
We would love to have your contribution! Please read ourcontributing guidelinesto get started.
This project is licensed under the MIT license. See theLICENSEfile for more info.