package
An essential diffing algorithm for µhtml
npm install udomdiffGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 1 packages.
25.3 kB
Includes dependencies.

Social Media Photo by Christopher Rusev on Unsplash
An essential diffing algorithm for µhtml.
futureNodes = udomdiff(
parentNode, // where changes happen
[...currentNodes], // Array of current items/nodes
[...futureNodes], // Array of future items/nodes (returned)
get(node, toDoWhat), // a callback to retrieve the node
before // the anchored node to insertBefore
);get and how does it work?You can find all info from domdiff, as it's exactly the same concept:
get(node, 1) to retrieve the node that's being appendedget(node, 0) to get the node to use for an insertBefore operationget(node, -0) to get the node to use for an insertAfter operationget(node, -1) to retrieve the node that's being removedIf you don't care about any of those second arguments values, const get = o => o; is a valid get too.
https://unpkg.com/udomdiffimport udomdiff from 'https://unpkg.com/udomdiff/esm/index.js'const udomdiff = require('udomdiff'); ( or require('udomdiff/cjs') )import udomdiff from 'udomdiff'; ( or from 'udomdiff/esm' )