Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
A super fast diffing utility for HTML and Plaintext
This work is based on htmldiff.net. Originally, I forked htmldiff-javascript (which is a fork of htmldiff-js), but now the code has almost completely deviated. A summary of the changes:
npm install diffblazer
import { diff } from 'diffblazer'
const oldHtml = '<p>hello world</p>'
const newHtml = '<p>hello world!</p>'
diff(oldHtml, newHtml)
// Output: <p>hello world<ins class='diffins'>!</ins></p>
Aside from marking differences using HTML tags, you can also specify your own markers. This can be anything:
import { diff } from 'diffblazer'
const oldText = 'hello world'
const newText = 'hello beautiful world'
diff(oldText, newText, {
markers: {
insert: {
start: '**',
end: '**',
},
},
})
// Output: hello **beautiful** world
✓ benches/html-diff.bench.ts (2) 1212ms
✓ benchmark (2) 1210ms
name hz min max mean p75 p99 p995 p999 rme samples
· diffblazer 5,980.63 0.1440 2.2266 0.1672 0.1657 0.3724 0.4760 0.9363 ±1.30% 2991 fastest
· node-htmldiff 615.75 1.3015 3.3126 1.6240 1.6930 3.0620 3.2030 3.3126 ±2.60% 308
BENCH Summary
diffblazer - benches/html-diff.bench.ts > benchmark
9.71x faster than node-htmldiff
To run these benchmarks yourself:
npm run bench
If you'd like to contribute to this project, you can do so in the following ways:
Before you open a PR, make sure to run the tests, like so:
npm run test
Copyright © 2024 Abdullah Atta under MIT. Read full text here.
FAQs
A super fast diffing utility for HTML and Plaintext
We found that diffblazer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.