calcujson
TypeScript icon, indicating that this package has built-in type declarations

0.3.1 • Public • Published

CalcuJSON

A standard for transmitting computable expressions in JSON formatted text.

Installation

yarn add calcujson
npm i calcujson

Usage

import CalcuJSON from 'calcujson'
const parse = CalcuJSON()

const data = {
  type: 'add',
  items: [
    { type: 'num', value: 1 },
    { type: 'num', value: 2, desc: 'II' },
    { type: 'num', value: 3, desc: 'three' },
  ]
}

const computation = parse(data)

console.log(computation.evaluate()) // >>> 6
console.log(computation.desc) // >>> 1 + II + three

Readme

Keywords

none

Package Sidebar

Install

npm i calcujson

Weekly Downloads

1

Version

0.3.1

License

MIT

Unpacked Size

23.2 kB

Total Files

24

Last publish

Collaborators

  • fergcb