Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nuts

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nuts

Reactive template compiler for javascript apps

  • 0.34.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

NUTS

View compiler for web apps. Work in progress

Install

npm i --save nuts

Quick start

Describe your view (myview.nuts.html):

<template>
  <span id="{ myid }">Count: {{: count }}</span>
  <button @click="increment">+1</button>
  <span (if)="odd">Odd</span>
  <span (else)>Even</span>
</template>

Compile it (will create myview.nuts.js):

$ npx nuts myview.nuts.html

Create your component controller mycomponent.js:

// import view
import { createNut } from './myview.nuts.js'

export const render = createNut(function (box) {
  box.myid = 'awesome'
  box.count = 0
  box.odd = false
  box.increment = () => {
    ++box.count
    box.odd = !box.odd
  }
})

Render the component in your app:

import { render } from './mycomponent.js'

const { elem } = render({})
document.getElementById('target').appendChild(elem)

Now your app should look like this:

<div id="target">
  <span id="awesome">Count: 0</span>
  <button>+1</button>
  <span>Odd</span>
</div>

and count will increment 1 every click on button

FAQs

Package last updated on 15 Apr 2020

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