GitHub

Project status

npm npm downloads

build build push package

check types lint test

code coverage

deploy web documentation web documentation

Open in CodeSandbox

Use case

You need utilities for:

  • Primitive types
    • Arrays
    • Functions
    • Numbers
    • Objects
    • Strings
    • Date and time
  • Mutual exclusion
    • Lock management
    • Semaphore management
  • Backend
    • CLIs
    • Filesystem
    • Processes
  • Frontend
    • Cookies
    • DOM
    • Data-Transfer
  • JSON-based Expressions
  • Logging
  • Scopes
  • Testing
  • Typescript
  • URLs

Content

Installation

You can install via package manager, simply download the compiled version as zip file here and inject or request via cdn in HTML:

npm install clientnode
import {createDomNodes, evaluateExpression} from 'cientnode'
// ...
<div id="first-example-playground"></div>
import {
    fadeIn, fadeOut, createDomNodes
} from 'https://unpkg.com/clientnode@latest/dist/bundle/index.js'
const domNode = createDomNodes('<p>some content to animate</p>')
const endless = () => {
    fadeIn(domNode)
        .then(() => fadeOut(domNode))
        .then(endless)
}
endless()
document.querySelector('#first-example-playground').appendChild(domNode)

The compiled bundle supports AMD, commonjs, commonjs2 and variable injection into given context (UMD) as export format: You can use a module bundler if you want.

Usage

Execute a JSON based expression:

<div id="second-example-playground"></div>
import {
    evaluateExpression
} from 'https://unpkg.com/clientnode@latest/dist/bundle/index.js'
document.querySelector('#second-example-playground').innerText =
    evaluateExpression(
        {
            $operator: '+',
            operand1: 2,
            operand2: {$select: 'some.data.in.scope'}
        },
        {some: {data: {in: {scope: 3}}}}
    )

Read the original on github.com ↗