boxbox

in boxbox

Usage no npm install needed!

<script type="module">
  import boxbox from 'https://cdn.skypack.dev/boxbox';
</script>

README

node travis-ci

Node.js BoxBox

Micromodule

Example

npm i boxbox

const
  boxbox = require('boxbox')

let box = new boxbox()

box.add('plus', (a, b) => a+b)
box.add('sum', (...x) => x.reduce(box.box['plus'], 0))

console.log(box.box['sum'](1, 2, 3))

const
  box = require('boxbox')()

box.add('initDemo', { init: () => {
    let x = boxbox('x', (x) => x*x)
    return (a, b) => Math.sqrt(x.x(a)+x.x(b))
  }})

console.log(box['initDemo'](3, 4))

const
  boxbox = require('boxbox')

let x = boxbox()

x.add('script', 'fold/script.js', 'utf8')
x.add('interval', () => {
    setInterval(box.restart, 7777, 'script')
  })

x.box['interval']()

BoxBox Server

npm i boxbox.server

const
  boxbox = require('boxbox.server')

let box = boxbox('boxName', {
  post: (req, res) => {
    res.end('ok')
  }
})
.server('serverName')