fxparser

1.0.1 • Public • Published

F(x) parser

Library provides a Parser class that evaluates excel and mathematical formulas.

  1. Installation
  2. Implementation
    1. Html
    2. js
  3. Features
  4. API

Installation

$ npm install fxparser --save

Implementation

Html

 
<script src="/node_modules/fx-parser/dist/fxparser.min.js"></script>
 
var parser = new fxParser.Parser();
 
parser.parse('SUM(1, 3, 9)');
 
// It returns `Object {error: null, result: 13}`
 

js

 
var FxParser = require('fxparser').Parser;
 
var parser = new FxParser();
 
parser.parse('SUM(1, 3, 9)');
 
// It returns `Object {error: null, result: 13}`
 

Features

It supports:

  • Any numbers, negative and positive as float or integer;
  • Arithmetic operations like +, -, /, *, %, ^;
  • Logical operations like AND(), OR(), NOT(), XOR();
  • Comparison operations like =, >, >=, <, <=, <>;
  • All JavaScript Math constants like PI(), E(), LN10(), LN2(), LOG10E(), LOG2E(), SQRT1_2(), SQRT2();
  • String operations like & (concatenation eq. parser.parse('-(2&5)'); will return -25);
  • Relative and absolute cell coordinates like A1, $A1, A$1, $A$1;
  • Build-in variables like TRUE, FALSE, NULL
  • Custom variables;
  • Custom functions/formulas;
  • Node and Browser environment.

API

$ node runthistest.js

Readme

Keywords

Package Sidebar

Install

npm i fxparser

Weekly Downloads

164

Version

1.0.1

License

MIT

Unpacked Size

830 kB

Total Files

51

Last publish

Collaborators

  • mmayorivera