Skip to content

Commit a20d878

Browse files
authoredSep 13, 2020
Merge pull request #8 from sallar/master
Unify source files and use TypeScript to convert source to JS
2 parents 1f44856 + 5de6095 commit a20d878

8 files changed

+30
-158
lines changed
 

‎.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
node_modules/
22
js/data.json
33
package-lock.json
4-
data.json
4+
data.json
5+
dist
6+
coverage

‎.npmignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ js/
66
coverage/
77
data.json
88
bench.js
9-
mod.ts
9+
mod.ts
10+
tsconfig.json

‎bench.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const Benchmark = require("benchmark");
88
const fastLevenshtein = require("fast-levenshtein").get;
99
const jslevenshtein = require("js-levenshtein");
1010
const levenshteinEditDistance = require("levenshtein-edit-distance");
11-
const { distance } = require("./index.js");
11+
const { distance } = require("./dist");
1212

1313
const suite = new Benchmark.Suite();
1414

‎index.d.ts

-2
This file was deleted.

‎index.js

-147
This file was deleted.

‎package.json

+9-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"name": "fastest-levenshtein",
33
"version": "1.0.12",
44
"description": "Fastest Levenshtein distance implementation in JS.",
5-
"main": "index.js",
5+
"main": "dist/index.js",
6+
"types": "dist/index.d.ts",
67
"repository": {
78
"type": "git",
89
"url": "git+https://github.com/ka-weihe/fastest-levenshtein.git"
@@ -33,9 +34,11 @@
3334
},
3435
"homepage": "https://github.com/ka-weihe/fastest-levenshtein#README",
3536
"scripts": {
36-
"test": "jest",
37-
"test:coverage": "jest --coverage",
38-
"test:coveralls": "jest --coverage --coverageReporters=text-lcov | coveralls"
37+
"build": "rm -rf dist && tsc && for i in dist/mod.*; do mv $i \"${i/mod/index}\"; done",
38+
"prepare": "npm run build",
39+
"test": "npm run build && jest",
40+
"test:coverage": "npm run build && jest --coverage",
41+
"test:coveralls": "npm run build && jest --coverage --coverageReporters=text-lcov | coveralls"
3942
},
4043
"devDependencies": {
4144
"benchmark": "^2.1.4",
@@ -55,10 +58,11 @@
5558
"jest": "^26.1.0",
5659
"js-levenshtein": "^1.1.6",
5760
"leven": "^3.1.0",
61+
"levenshtein-edit-distance": "^2.0.5",
5862
"natural": "^2.1.5",
5963
"prettier": "^2.0.5",
6064
"talisman": "^1.1.2",
61-
"levenshtein-edit-distance": "^2.0.5"
65+
"typescript": "^4.0.2"
6266
},
6367
"engines": {
6468
"node": ">= 4.9.1"

‎test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const {distance, closest} = require("./index.js");
1+
const { distance, closest } = require("./dist");
22

33
const levenshtein = (a, b) => {
44
if (a.length === 0) return b.length;

‎tsconfig.json

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES2015",
4+
"module": "commonjs",
5+
"declaration": true,
6+
"declarationMap": true,
7+
"outDir": "./dist",
8+
"strict": true,
9+
"esModuleInterop": true,
10+
"skipLibCheck": true,
11+
"forceConsistentCasingInFileNames": true
12+
},
13+
"include": ["./mod.ts"]
14+
}

0 commit comments

Comments
 (0)
Please sign in to comment.