Security News
NIST Misses 2024 Deadline to Clear NVD Backlog
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
@swimlane/dom-diff
Advanced tools
This library acts as a base project for diffing chunks of dom or HTML for semantic equality.
Used in:
getDiffableHTML
Takes a snippet of HTML and returns a semantically similar diffable HTML snippet.
import { getDiffableHTML } from '@swimlane/dom-diff';
const h = `
<head></head>
<div z="1" a="2" x>
<h1 z="3">Hello</h1>
<h2>World</h2>
<svg>SVG ignored</svg>
<script>scripts also ignored</script>
<style>styles also ignored</style>
<!-- comments ignored too -->
</div>`;
getDiffableHTML(h, {
ignoreAttributes: [{ tags: ['h1'], attributes: ['z'] }]
});
// <div
// a="2"
// x
// z="1"
// >
// <h1>
// Hello
// </h1>
// <h2>
// World
// </h2>
// </div>
dom
Template tag that takes a snippet of HTML and returns a regular expression.
Follows rules defined in https://github.com/Hypercubed/lit-regex
import { dom } from '@swimlane/dom-diff';
dom`<h1>Hello ${/[\w-]+/}</h1>`;
// /^<h1>\n Hello [\w-]+\n<\/h1>$/
diff
Takes a regular expression generated by dom
and a string generated from getDiffableHTML
returning a representation of the difference.
import { diff, dom, getDiffableHTML } from '@swimlane/dom-diff';
const h = getDiffableHTML('<div>Hello 123</div>');
const r = dom`<div>Hello ${/[a-zA-Z]+/}</div>`;
diff(r, h);
// <div>
// - Hello \${/[a-zA-Z]+/}
// + Hello 123
// </div>
git checkout main
)git pull origin main
)CHANGELOG.md
to determine next version (X.Y.Z
)npm run np
) and follow the promptsDistributed under the MIT License. See LICENSE for more information.
@swimlane/dom-diff
is a Swimlane open-source project; we
believe in giving back to the open-source community by sharing some of the
projects we build.
Swimlane is an automated cyber security operations and incident response platform that enables cyber security teams to leverage threat intelligence, speed up incident response and automate security operations.
FAQs
diffing chunks of dom or HTML for semantic equality
The npm package @swimlane/dom-diff receives a total of 650 weekly downloads. As such, @swimlane/dom-diff popularity was classified as not popular.
We found that @swimlane/dom-diff demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 40 open source maintainers collaborating on the project.
Did you know?
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.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.