Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

metric-lcs

nickdeis388.8kMIT1.0.3TypeScript support: included

Zero dependency Metric Longest Common Subsequence implementation in js

metriclcs, metric-lcs, edit-distance, longest common subsequence, metric longest common subsequence

readme

Build Status

metric-lcs

Zero dependency Metric Longest Common Subsequence implementation in js.

Usage

npm i metric-lcs

import metriclcs from "metric-lcs";
console.log(metriclcs("ABDEF", "ABDIF")); //.8

or

const metriclcs = require("metric-lcs");
console.log(metriclcs("ABDEF", "ABDIF")); //.8

Use case

Longest Common Subsequence is used with diff, so the metric version of it is suitable for comparing larger strings or for comparing likely subsets of strings since it ignores edit distance and lowers the cost of insertion.

Thanks

Special thanks to tdebatty for java-string-similarity, which I used as a reference implementation.

changelog

CHANGELOG

1.0.3

Major

  • This package has been out long enough for 1.0.0 release

Minor

  • Typescript typings
  • Move to node:test framework
  • Add build pipeline

Patch

  • Proper multi-target exporting
  • Staging tests for js, mjs, typescript