diff --git a/package.json b/package.json index de507e6..61a4bb3 100644 --- a/package.json +++ b/package.json @@ -4,9 +4,11 @@ "description": "Compares two spectra using a tree similarity", "main": "lib/index.js", "module": "src/index.js", + "types": "tree-similarity.d.ts", "files": [ "lib", - "src" + "src", + "tree-similarity.d.ts" ], "scripts": { "compile": "rollup -c", @@ -40,7 +42,6 @@ }, "dependencies": { "binary-search": "^1.3.6", - "cheminfo-types": "^1.7.2", - "num-sort": "^3.0.0" + "cheminfo-types": "^1.7.2" } } diff --git a/rollup.config.mjs b/rollup.config.mjs index d1dd155..7b0ccfe 100644 --- a/rollup.config.mjs +++ b/rollup.config.mjs @@ -4,5 +4,5 @@ export default { format: 'cjs', file: 'lib/index.js' }, - external: ['binary-search', 'num-sort'] + external: ['binary-search'] }; diff --git a/src/createTree.js b/src/createTree.js index 2aae7f0..b0905cd 100644 --- a/src/createTree.js +++ b/src/createTree.js @@ -1,10 +1,9 @@ import binarySearch from 'binary-search'; -import { numberSortAscending } from 'num-sort'; /** - * @typedef {import("../types").Tree} Tree - * @typedef {import("../types").CreateTreeOptions} CreateTreeOptions - * @typedef {import("../types").Spectrum} Spectrum + * @typedef {import("../tree-similarity").Tree} Tree + * @typedef {import("../tree-similarity").CreateTreeOptions} CreateTreeOptions + * @typedef {import("../tree-similarity").Spectrum} Spectrum */ /** @@ -31,7 +30,7 @@ function mainCreateTree(x, y, from, to, minWindow, threshold) { } // search first point - let start = binarySearch(x, from, numberSortAscending); + let start = binarySearch(x, from, (a, b) => a - b); if (start < 0) { start = ~start; } diff --git a/src/treeSimilarity.js b/src/treeSimilarity.js index 77cc03c..6deeb5c 100644 --- a/src/treeSimilarity.js +++ b/src/treeSimilarity.js @@ -1,6 +1,6 @@ /** - * @typedef {import("../types").Tree} Tree - * @typedef {import("../types").TreeSimilarityOptions} TreeSimilarityOptions + * @typedef {import("../tree-similarity").Tree} Tree + * @typedef {import("../tree-similarity").TreeSimilarityOptions} TreeSimilarityOptions */ /** * Similarity between two nodes diff --git a/types.d.ts b/tree-similarity.d.ts similarity index 100% rename from types.d.ts rename to tree-similarity.d.ts