Crates.io | formula |
lib.rs | formula |
version | 0.1.0 |
source | src |
created_at | 2022-09-05 16:45:33.299339 |
updated_at | 2022-11-11 11:28:27.91218 |
description | A parser and evaluator of spreadsheet-like formulas |
homepage | |
repository | https://github.com/omid/formula |
max_upload_size | |
id | 658946 |
size | 164,037 |
Formula is in its early stages and is not ready for production use.
So far we have the following features:
Add this library to your project with cargo add formula
or add formula = "*"
to your Cargo.toml
file.
Use it similar to the following code:
use formula::{Formula, Expr, Result};
fn main() -> Result<()> {
let formula = Formula::new("=UPPER(TRIM(' Hello '))")?;
let value = formula.parse()?;
assert_eq!(value, Expr::String("HELLO".to_string()));
Ok(())
}
Add this library to your project with npm install formula-wasm
or add formula-wasm
to your package.json
file.
Use it similar to the following code:
import { parse } from 'formula-wasm';
const value = parse('=UPPER(TRIM(" Hello "))');
console.assert(value, "HELLO");
1+1
or as argument like AND(1>3, 1<3)
or SUM(2-1, 2)
. Instead, you can use our F.
functions like AND(F.GT(1, 3), F.LT(1, 3))
or SUM(F.SUB(2, 1), 2)
F.
functions. So for example instead of 2*(1+1)
, you should use F.MUL(2, F.ADD(1, 1))
We would love to have your contribution! Please read our contributing guidelines to get started.
This project is licensed under the MIT license. See the LICENSE file for more info.