@thi.ng/diff
    TypeScript icon, indicating that this package has built-in type declarations

    5.1.3 • Public • Published

    diff

    npm version npm downloads Twitter Follow

    This project is part of the @thi.ng/umbrella monorepo.

    About

    Customizable diff implementations for arrays (sequential) & objects (associative), with or without linear edit logs.

    Status

    STABLE - used in production

    Search or submit any issues for this package

    Installation

    yarn add @thi.ng/diff

    ES module import:

    <script type="module" src="https://cdn.skypack.dev/@thi.ng/diff"></script>

    Skypack documentation

    For Node.js REPL:

    # with flag only for < v16
    node --experimental-repl-await
    
    > const diff = await import("@thi.ng/diff");
    

    Package sizes (gzipped, pre-treeshake): ESM: 1.13 KB

    Dependencies

    API

    Generated API docs

    import { diffArray } from "@thi.ng/diff";
    
    // diff w/ default diff mode
    diffArray([1, 2, 3], [1, 2, 4], "full");
    // {
    //     distance: 2,
    //     adds: { 2: 4 },
    //     dels: { 2: 3 },
    //     const: { 0: 1, 1: 2 },
    //     linear: [0, 0, 1,  0, 1, 2,  -1, 2, 3,  1, 2, 4]
    // }

    Authors

    Karsten Schmidt

    If this project contributes to an academic publication, please cite it as:

    @misc{thing-diff,
      title = "@thi.ng/diff",
      author = "Karsten Schmidt",
      note = "https://thi.ng/diff",
      year = 2016
    }

    License

    © 2016 - 2021 Karsten Schmidt // Apache Software License 2.0

    Install

    npm i @thi.ng/diff

    DownloadsWeekly Downloads

    54

    Version

    5.1.3

    License

    Apache-2.0

    Unpacked Size

    33.8 kB

    Total Files

    12

    Last publish

    Collaborators

    • thi.ng