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 - npm Package Compare versions

Comparing version
1.0.5
to
1.0.6
+4
-4
index.js

@@ -5,3 +5,3 @@ 'use strict';

var result = '',
index = 0;
index = 0;

@@ -11,4 +11,4 @@ // According to latest jsperf tests, there's no need to cache array length

var item = delta[i],
operation = item[0],
value = item[1];
operation = item[0],
value = item[1];

@@ -20,3 +20,3 @@ if (operation == -1) {

// KEEP
result += original.slice(index, index += value);
result += original.slice(index, (index += value));
} else {

@@ -23,0 +23,0 @@ // INSERT

{
"name": "textdiff-patch",
"version": "1.0.5",
"version": "1.0.6",
"description": "Apply lean text diff delta patches created by textdiff-create.",

@@ -27,5 +27,5 @@ "main": "index.js",

"devDependencies": {
"mocha": "^5.2.0",
"mocha": "^9.2.0",
"should": "^13.2.3"
}
}
# textdiff-patch
[![NPM version][npm-image]][npm-url]
[![Dependency Status][david-image]][david-url]
[![Build Status][travis-image]][travis-url]

@@ -52,4 +51,2 @@ [![License][license-image]][license-url]

[npm-url]: https://npmjs.org/package/textdiff-patch
[david-image]: https://img.shields.io/david/icflorescu/textdiff-patch.svg?style=flat-square
[david-url]: https://david-dm.org/icflorescu/textdiff-patch
[license-image]: http://img.shields.io/npm/l/textdiff-patch.svg?style=flat-square

@@ -56,0 +53,0 @@ [license-url]: LICENSE

'use strict';
require('should');
var fs = require('fs'),
applyDelta = require('../');
applyDelta = require('../');
var v1 = fs.readFileSync(__dirname + '/v1.txt', 'utf8').slice(0, -2),
v2 = fs.readFileSync(__dirname + '/v2.txt', 'utf8').slice(0, -2),
deltas = {
v1_to_v2: require('./delta-v1-to-v2.json'),
v2_to_v1: require('./delta-v2-to-v1.json'),
v1_to_v1: [[0, v1.length]],
v1_to_empty: [[-1, v1.length]],
empty_to_v1: [[1, v1]],
empty_to_empty: []
};
v2 = fs.readFileSync(__dirname + '/v2.txt', 'utf8').slice(0, -2),
deltas = {
v1_to_v2: require('./delta-v1-to-v2.json'),
v2_to_v1: require('./delta-v2-to-v1.json'),
v1_to_v1: [[0, v1.length]],
v1_to_empty: [[-1, v1.length]],
empty_to_v1: [[1, v1]],
empty_to_empty: [],
};
describe('Should correctly apply delta patches for:', function () {
it('v1 -> v2', function () {
(applyDelta(v1, deltas.v1_to_v2)).should.equal(v2);
applyDelta(v1, deltas.v1_to_v2).should.equal(v2);
});
it('v2 -> v1', function () {
(applyDelta(v2, deltas.v2_to_v1)).should.equal(v1);
applyDelta(v2, deltas.v2_to_v1).should.equal(v1);
});
it('v1 -> v1', function () {
(applyDelta(v1, deltas.v1_to_v1)).should.equal(v1);
applyDelta(v1, deltas.v1_to_v1).should.equal(v1);
});
it('v1 -> empty', function () {
(applyDelta(v1, deltas.v1_to_empty)).should.equal('');
applyDelta(v1, deltas.v1_to_empty).should.equal('');
});
it('empty -> v1', function () {
(applyDelta('', deltas.empty_to_v1)).should.equal(v1);
applyDelta('', deltas.empty_to_v1).should.equal(v1);
});
it('empty -> empty', function () {
(applyDelta('', deltas.empty_to_empty)).should.equal('');
applyDelta('', deltas.empty_to_empty).should.equal('');
});
});

Sorry, the diff of this file is not supported yet