
Research
SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains
An emerging npm supply chain attack that infects repos, steals CI secrets, and targets developer AI toolchains for further compromise.
diff-match-patch-typescript
Advanced tools
TypeScript port of google/diff-match-patch.
npm i diff-match-patch-typescript
import { DiffMatchPatch, DiffOperation } from "diff-match-patch-typescript";
const dmp = new DiffMatchPatch();
// Diff
const diffs = dmp.diff_main("Hello World", "Hello TypeScript");
// [
// [DiffOperation.DIFF_EQUAL, "Hello "],
// [DiffOperation.DIFF_DELETE, "World"],
// [DiffOperation.DIFF_INSERT, "TypeScript"]
// ]
// Match
const position = dmp.match_main("Hello World", "World", 0); // 6
// Patch
const patches = dmp.patch_make("Hello World", "Hello TypeScript");
const [newText, results] = dmp.patch_apply(patches, "Hello World");
// newText: "Hello TypeScript"
// results: [true]
| Property | Type | Default | Description |
|---|---|---|---|
diffTimeout | number | 1.0 | Seconds to compute a diff before giving up (0 = infinity). |
diffEditCost | number | 4 | Cost of an empty edit operation. |
matchThreshold | number | 0.5 | Threshold for match (0.0 = perfect, 1.0 = loose). |
matchDistance | number | 1000 | How far to search for a match. |
patchDeleteThreshold | number | 0.5 | Threshold for patch deletion matching. |
patchMargin | number | 4 | Chunk size for context length. |
FAQs
TypeScript port of diff-match-patch.
We found that diff-match-patch-typescript 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
An emerging npm supply chain attack that infects repos, steals CI secrets, and targets developer AI toolchains for further compromise.

Company News
Socket is proud to join the OpenJS Foundation as a Silver Member, deepening our commitment to the long-term health and security of the JavaScript ecosystem.

Security News
npm now links to Socket's security analysis on every package page. Here's what you'll find when you click through.