JavaScript implementation of formulas for humans.
yarn add formule
npm install formule
<script src="https://unpkg.com/formule/dist/formule.umd.js"></script>
The base of the natural logarithm.
Types
number
Syntax
e
Examples
e // 2.718281828459045
The ratio of a circle's circumference to its diameter.
Types
number
Syntax
pi
Examples
pi // 3.141592653589793
Concatenates its arguments and returns the result.
Types
Input: any
Output: string
Syntax
concat(...text)
Examples
concat('Hello', 'World') // HelloWorld
Format a date using format string.
Types
Input: string
Output: string
Syntax
formatDate(date, format)
Examples
formatDate(now(), 'YYYY-MM-DD') // 1999-11-06
Inserts the first argument between the rest and returns their concatenation.
Types
Input: any
Output: string
Syntax
join(...text)
Examples
join('-', 1, 2, 3) // 1-2-3
Returns the current date and time.
Types
string
Syntax
now()
Examples
now() // Nov 6, 1999
Parses a number from string, boolean or date.
Types
Input: string
boolean
number
Date
Output: number
Syntax
toNumber(text)
Examples
toNumber(false) // 0
MIT
elaurent.org · GitHub emersonlaurentino · Twitter @elaurent_