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

Package detail

typer-diff

techboy-coder2.6kMIT1.1.1TypeScript support: included

typer-diff is a library to diff two strings, useful for showing for typing games or for showing differences between two strings. It is a simple library that is easy to use and has no dependencies. It is also very fast and lightweight.

diff, typer, monkeytype, typing

readme

Typer Diff

Typer Diff Demo

typer-diff is a library to diff two strings, useful for showing for typing games (like monkeytype) or for showing differences between two strings. It is a simple library that is easy to use and has no dependencies. It is also very fast and lightweight.

Check out a demo at typer-diff.vercel.app.

Usage

Usage:

import { diff } from "typer-diff";

// ...
return diff(text.original, text.text);
// ...

Types:

type DiffItem = {
    value: string;
    type: "correct" | "extra" | "missing" | "wrong" | "untouched" | "spacer";
};
type DiffResult = {
    diff: DiffItem[];
    end: boolean;
};
declare const diff: (originalText: string, typedText: string) => DiffResult;

export { type DiffItem, type DiffResult, diff };

changelog

typer-diff

1.1.1

Patch Changes

  • e216117: fix docs

1.1.0

Minor Changes

  • 1b8c7c7: Docs

1.0.3

Patch Changes

  • 96c815e: typo

1.0.2

Patch Changes

  • c3fa793: add tests

1.0.1

Patch Changes

  • 515b678: update readme

1.0.0

Major Changes

  • acd8403: Docs more or less ready

Patch Changes

  • e8ea4db: try adding web docs

0.2.0

Minor Changes

  • 9986f50: Added docs

0.1.0

Minor Changes

  • d1951f1: Algo was ignoring empty text

Patch Changes

  • 2cb65a7: Add readme

0.0.4

Patch Changes

  • a30ea0f: test change