Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vs-diff

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vs-diff

Diff algorithm extracted from Visual Studio Code

  • 0.0.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
18
increased by157.14%
Maintainers
1
Weekly downloads
 
Created
Source

CI GitHub license

npm version Gitpod Ready-to-Code install size npm bundle size npm downloads

vs-diff

vs-diff is a diff algorithm extracted from VS Code with the latest updates.

If you find this package useful for your projects, please consider supporting me by Patreon, KO-FI or Paypal. It's a great way to help me maintain and improve this tool in the future. Your support is truly appreciated!

KO-FI Paypal Patreon

Installation

npm

npm install vs-diff

Usage

import {
  DiffComputer,
  ICharChange,
  IDiffComputerOpts,
  ILineChange,
} from "vs-diff";

const options: IDiffComputerOpts = {
  shouldPostProcessCharChanges: true,
  shouldIgnoreTrimWhitespace: true,
  shouldMakePrettyDiff: true,
  shouldComputeCharChanges: true,
  maxComputationTime: 0
};
let diffComputer = new DiffComputer(originalLines, modifiedLines, options);
let lineChanges: ILineChange[] = diffComputer.computeDiff().changes;
console.log(lineChanges);
/*
[
  {
    "originalStartLineNumber": 14,
    "originalEndLineNumber": 0,
    "modifiedStartLineNumber": 15,
    "modifiedEndLineNumber": 15
  },
  {
    "originalStartLineNumber": 16,
    "originalEndLineNumber": 0,
    "modifiedStartLineNumber": 18,
    "modifiedEndLineNumber": 18
  }
]
*/

Feedback

If you discover a bug, or have a suggestion for a feature request, please submit an issue.

LICENSE

This extension is licensed under the MIT License

Keywords

FAQs

Package last updated on 12 Jul 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc