🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@cocalc/diff-match-patch

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cocalc/diff-match-patch

Diff-Match-Patch in typescript with full budget and surrogate pairs support

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
2
Created
Source

Diff-Match-Patch in Typescript with full budget and surrogate pairs support

Javascript diff-match-patch, made suitable for use in production:

  • Modern typescript with unit tests, thanks to diff-match-patch-typescript.
  • Full unicode support, thanks to PR 80
  • I added full diffTimeout support, which is only partially implemented elsewhere, and is critical for production use (since otherwise your server or browser can be easily stuck at 100% for minutes). See big.test.ts.
  • Modern api for creating dmp object (still backward compatible).

Installation

See https://www.npmjs.com/package/@cocalc/diff-match-patch

pnpm i @cocalc/diff-match-patch

Usage

import { DiffMatchPatch } from "@cocalc/diff-match-patch";
const dmp = new DiffMatchPatch({ diffTimeout:0.5 });
const patch = dmp.patch_make("ello", "hello world");
console.log(JSON.stringify(patch));
// [{"diffs":[[1,"h"],[0,"ello"],[1," world"]],"start1":0,"start2":0,"length1":4,"length2":11}]
dmp.patch_apply(patch, "ello");
// [ 'hello world', [ true ] ]

Documentation

Official Repository.

Keywords

diff-match-patch-typescript

FAQs

Package last updated on 07 Oct 2025

Did you know?

Socket

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.

Install

Related posts