New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

formula

Package Overview
Dependencies
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

formula

Formula compiler and function library

  • 2.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
404
decreased by-31.06%
Maintainers
1
Weekly downloads
 
Created
Source

Circle CI

formula

A formula parser and function library for browsers and Node.js.

Install

npm install --save formula
// import the the entire library
var f = require('formula')

// import specific files
var isArray = require('formula/fn/isarray')

Usage

var { run, 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')

Optionally, may load specific functions to reduce bundle size.

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

Runtime Dependencies

formula depends on a modern JavaScript runtime.

Load polyfills for old browsers:

require('core-js/fn/array/filter');
require('core-js/fn/array/map');
require('core-js/fn/array/reduce');
require('core-js/fn/object/assign');
require('core-js/fn/object/keys');
require('core-js/fn/number/is-nan');

Keywords

FAQs

Package last updated on 29 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc