mirror of
https://github.com/robonen/tools.git
synced 2026-03-20 10:54:44 +00:00
refactor(packages/stdlib): levensthein fn replate to module export
This commit is contained in:
@@ -1 +1,2 @@
|
|||||||
|
export * from './text';
|
||||||
export * from './math';
|
export * from './math';
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import { describe, expect, it } from 'vitest';
|
import { describe, expect, it } from 'vitest';
|
||||||
import levenshteinDistance from '.';
|
import {levenshteinDistance} from '.';
|
||||||
|
|
||||||
describe('levenshteinDistance', () => {
|
describe('levenshteinDistance', () => {
|
||||||
it('should calculate edit distance between two strings', () => {
|
it('should calculate edit distance between two strings', () => {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
* @param {string} b Second string
|
* @param {string} b Second string
|
||||||
* @returns {number} The Levenshtein distance between the two strings
|
* @returns {number} The Levenshtein distance between the two strings
|
||||||
*/
|
*/
|
||||||
export default function levenshteinDistance(a: string, b: string): number {
|
export function levenshteinDistance(a: string, b: string): number {
|
||||||
// If the strings are equal, the distance is 0
|
// If the strings are equal, the distance is 0
|
||||||
if (a === b) return 0;
|
if (a === b) return 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user