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

nanomorph

Package Overview
Dependencies
Maintainers
4
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nanomorph - npm Package Compare versions

Comparing version 5.1.1 to 5.1.2

60

index.js

@@ -5,3 +5,3 @@ var assert = require('assert')

var TEXT_NODE = 3
var DEBUG = false
// var DEBUG = false

@@ -24,13 +24,13 @@ module.exports = nanomorph

function nanomorph (oldTree, newTree) {
if (DEBUG) {
console.log(
'nanomorph\nold\n %s\nnew\n %s',
oldTree && oldTree.outerHTML,
newTree && newTree.outerHTML
)
}
// if (DEBUG) {
// console.log(
// 'nanomorph\nold\n %s\nnew\n %s',
// oldTree && oldTree.outerHTML,
// newTree && newTree.outerHTML
// )
// }
assert.equal(typeof oldTree, 'object', 'nanomorph: oldTree should be an object')
assert.equal(typeof newTree, 'object', 'nanomorph: newTree should be an object')
var tree = walk(newTree, oldTree)
if (DEBUG) console.log('=> morphed\n %s', tree.outerHTML)
// if (DEBUG) console.log('=> morphed\n %s', tree.outerHTML)
return tree

@@ -41,9 +41,9 @@ }

function walk (newNode, oldNode) {
if (DEBUG) {
console.log(
'walk\nold\n %s\nnew\n %s',
oldNode && oldNode.outerHTML,
newNode && newNode.outerHTML
)
}
// if (DEBUG) {
// console.log(
// 'walk\nold\n %s\nnew\n %s',
// oldNode && oldNode.outerHTML,
// newNode && newNode.outerHTML
// )
// }
if (!oldNode) {

@@ -67,9 +67,9 @@ return newNode

function updateChildren (newNode, oldNode) {
if (DEBUG) {
console.log(
'updateChildren\nold\n %s\nnew\n %s',
oldNode && oldNode.outerHTML,
newNode && newNode.outerHTML
)
}
// if (DEBUG) {
// console.log(
// 'updateChildren\nold\n %s\nnew\n %s',
// oldNode && oldNode.outerHTML,
// newNode && newNode.outerHTML
// )
// }
var oldChild, newChild, morphed, oldMatch

@@ -83,9 +83,9 @@

newChild = newNode.childNodes[i - offset]
if (DEBUG) {
console.log(
'===\n- old\n %s\n- new\n %s',
oldChild && oldChild.outerHTML,
newChild && newChild.outerHTML
)
}
// if (DEBUG) {
// console.log(
// '===\n- old\n %s\n- new\n %s',
// oldChild && oldChild.outerHTML,
// newChild && newChild.outerHTML
// )
// }
// Both nodes are empty, do nothing

@@ -92,0 +92,0 @@ if (!oldChild && !newChild) {

{
"name": "nanomorph",
"version": "5.1.1",
"version": "5.1.2",
"description": "Hyper fast diffing algorithm for real DOM nodes",

@@ -5,0 +5,0 @@ "main": "index.js",

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