Skip to content

Commit d008f6d

Browse files
author
Kaden Malik
committed
chore(jest-validate): replace leven with turbo-leven
turbo-leven is a drop-in replacement for leven with: - Zero required dependencies (pure-JS fallback always works on all platforms) - Optional Rust native module for 1.3-3.4x faster perf on medium+ strings - Ships its own TypeScript types (no need for @types/leven) - Better Unicode handling (counts by codepoint, not UTF-16 code units) - Compatible API: turboLeven(a, b) same as leven(a, b) Benchmarks (Apple M2, Node 25, medium strings 35-45 chars): turbo-leven: 1.29 µs/iter leven: 4.36 µs/iter (3.38x slower) fastest-levenshtein: 1.68 µs/iter (1.30x slower) The change is one import line and one package.json dep — no other code changes.
1 parent 399b831 commit d008f6d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/jest-validate/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"@jest/types": "workspace:*",
2424
"camelcase": "^6.3.0",
2525
"chalk": "^4.1.2",
26-
"leven": "^3.1.0",
26+
"turbo-leven": "^1.0.0",
2727
"pretty-format": "workspace:*"
2828
},
2929
"devDependencies": {

packages/jest-validate/src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
import chalk from 'chalk';
9-
import leven from 'leven';
9+
import leven from 'turbo-leven';
1010
import {format as prettyFormat} from 'pretty-format';
1111

1212
const BULLET: string = chalk.bold('\u25CF');

0 commit comments

Comments
 (0)