New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

textdiff-patch

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

textdiff-patch

Apply lean text diff delta patches created by textdiff-create.

latest
Source
npmnpm
Version
1.1.10
Version published
Weekly downloads
187
-36.82%
Maintainers
1
Weekly downloads
 
Created
Source

textdiff-patch

NPM version License Downloads Sponsor the author

textdiff-patch

This is a simple module for applying lean text diff delta patches created by textdiff-create.

❤️🇺🇦

See below.

Usage

Assuming you've correctly installed the npm module with npm i textdiff-patch [--save|--save-dev]:

const applyPatch = require('textdiff-patch');

const v1 = 'The sleepy brown fox';
const delta = [
      [0, 4],
      [-1, 6],
      [1, 'quick'],
      [0, 10],
      [1, ' jumps over the lazy dog']
    ];

const v2 = applyPatch(v1, delta);

console.log(v2);

The script will produce the following output:

The quick brown fox jumps over the lazy dog

Additional info

Have a look at textdiff-create for more info.

Credits & support

If you find this piece of software useful, please star the repo, spread the word, sponsor my work and feel free to endorse me on LinkedIn:

Ionut-Cristian Florescu on LinkedIn

Stand with Ukraine

On 24th of February 2022 Russia unlawfully invaded Ukraine. This is an unjustified, unprovoked attack on the sovereignty of a neighboring country, but also an open affront to international peace and stability that has the potential to degenerate into a nuclear event threatening the very existence of humanity. I am a Romanian (EU) citizen, but I stand with Ukraine and I am doing everything in my power to stop this madness. Here's how you can show your support.

LICENSE

Released under ISC.

Keywords

diff

FAQs

Package last updated on 20 Apr 2024

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