Skip to content

Commit

Permalink
Move currently unused methods to extended class
Browse files Browse the repository at this point in the history
  • Loading branch information
lionel-rowe committed Sep 15, 2024
1 parent 2348c0c commit 49baceb
Show file tree
Hide file tree
Showing 12 changed files with 1,204 additions and 1,126 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# Diff-Match-Patch Unicode [![JSR](https://jsr.io/badges/@clearlylocal/diff-match-patch-unicode)](https://jsr.io/@clearlylocal/diff-match-patch-unicode)

Modern JS/TS and Unicode-friendly version of [diff-match-patch](https://github.com/google/diff-match-patch).
Modern JS/TS and Unicode-friendly version of [Neil Fraser](https://github.com/NeilFraser)’s [`diff-match-patch`](https://github.com/google/diff-match-patch).

## Usage

### `diff`

```ts
diff(str1: string, str2: string, options?: Partial<DiffOptions>): Diff[]
diff(before: string, after: string, options?: Partial<DiffOptions>): Diff[]
```

Diff two strings. Unicode-aware by default, including non-BMP characters.
Diff two strings. Fully Unicode-aware by default.

Pass a `segmenter` option to customize the units of calculation for the diff (char, line, word, grapheme, sentence, etc).

### Example
#### Example

```ts
import { Differ, segmenters } from '@clearlylocal/diff-match-patch-unicode'
Expand Down
6 changes: 3 additions & 3 deletions deno.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
"exports": {
".": "./src/mod.ts",
"./Differ": "./src/Differ.ts",
"./Diff": "./src/Diff.ts"
"./Diff": "./src/Diff.ts",
"./utils": "./src/utils.ts"
},
"tasks": {
"test": "deno test --doc src tests",
"test-watch": "deno test --doc --watch src tests"
"test": "deno test --doc src tests"
},
"imports": {
"@clearlylocal/diff-match-patch-unicode": "./src/mod.ts",
Expand Down
1 change: 1 addition & 0 deletions src/Diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export class Diff {
}

type CustomInspect = (this: Diff, _: unknown, opts: { colors: boolean }) => string

/**
* Actually always yields a single DiffOperation then a single string, but TS currently can't express that in an
* iterator type.
Expand Down
Loading

0 comments on commit 49baceb

Please sign in to comment.