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

nanomorph

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nanomorph

Hyper fast diffing algorithm for real DOM nodes

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.4K
decreased by-16.01%
Maintainers
1
Weekly downloads
 
Created
Source

nanomorph stability

npm version build status test coverage downloads js-standard-style

Hyper fast diffing algorithm for real DOM nodes :zap:

Usage

const nanomorph = require('nanomorph')
const bel = require('bel')

var tree = bel`<div>hello people</div>`
tree = nanomorph(bel`<div>nanananana-na-no</div>`, tree)
tree = nanomorph(`<div>teeny, tiny, tin bottle</div>`, tree)

Appending to the DOM

const updateDom = require('nanomorph/update-dom')
const bel = require('bel')

// create the initial tree, save it and append to DOM
const tree = bel`<div>hello people</div>`
const update = updateDom(tree)
document.body.appendChild(tree)

// now each consecutive update will be rendered on the DOM
update(bel`<div>hello people</div>`, tree)
update(bel`<div>nanananana-na-no</div>`, tree)

API

tree = nanomorph(newTree, oldTree)

Diff a tree of HTML elements against another tree of HTML elements and create a patched result that can be applied on the DOM.

FAQ

Why are you building this?

Experimentin' is fun - all this is is a take on seeing how small we can get with real DOM node diffing. And if we can make some good heuristics happen for efficient tree updates (Merkle trees, anyone?) that'd be nice.

Should I use this right now?

No, probably not but if you do it'll probably be the fastest thing ever. Seriously, I doubt this could be made a lot faster than it is right now, unless we're talking edge cases. But yeah, alright go ahead if you like.

Installation

$ npm install nanomorph

See Also

License

MIT

Keywords

FAQs

Package last updated on 07 Aug 2016

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