JSPM

  • Created
  • Published
  • Downloads 908
  • Score
    100M100P100Q102883F
  • License MIT

Formula compiler and function library

Package Exports

  • formula
  • formula/fn/isfunction
  • formula/fn/isobject
  • formula/fn/parsequery

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (formula) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Circle CI

Formula expressions and functions for JavaScript.

Install with npm

# install with npm
npm install --save formula

# install with yarn
yarn add formula

General Usage

// ES6 import statements
import { run } from 'formula'

// CommonJS
var { and, eq, len, gt, lt, isnumber, isText, isEmail, isEmpty, lower, proper, text, date}
= require('formula')

run("a + b", { a: 2, b: 2})
isnumber(1),
isText('this is'),
isEmail('me@gmail.com'),
isEmpty(''),
gt(2, 1),
lt(1, 2),
and(true, false, true),
eq(len('foo'), 3),
eq(lower('HAPPY'), 'happy'),
eq(proper('happy'), 'Happy'),
eq(text(4200.00, "$#,###.00"), '$4,200.00'),
eq(text(date(2000, 2, 1), "m-d-yyyy"), '2-1-2000')

Reduce bundle sizes

Require specific functions to reduce bundle size with tools like webpack.

var isNumber = require('formula/fn/isnumber')
var proper = require('formula/fn/proper')

Browser ready build

There is a browser ready build in the dist folder. You can include with a