{"$schema":"https://json.schemastore.org/package","name":"didyoumean2","version":"7.0.4","description":"a library for matching human-quality input to a list of potential matches using the Levenshtein distance algorithm","keywords":["closest","compare","comparison","didyoumean","diff","difference","distance","edit","find","fuzzy","leven","levenshtein","match","matching","similar","similarity","string","suggest","suggestion","text","typescript","word"],"homepage":"https://github.com/foray1010/didyoumean2","bugs":{"url":"https://github.com/foray1010/didyoumean2/issues"},"repository":{"type":"git","url":"git+https://github.com/foray1010/didyoumean2.git"},"license":"MIT","author":{"name":"foray1010"},"sideEffects":false,"type":"module","exports":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.ts","default":"./dist/index.cjs"}},"main":"./dist/index.cjs","typings":"./dist/index.d.ts","scripts":{"build":"yarn clean:build && tsc --project tsconfig.build.json && rollup --configPlugin \"babel={ babelHelpers: 'runtime', extensions: ['.js', '.ts'] }\" -c","ci":"yarn build && npm-run-all -p 'lint:*' 'type:*' && yarn test && size-limit","clean:build":"shx rm -rf dist/ build/dts/","lint":"npm-run-all -p 'lint:*'","lint:js":"eslint .","lint:md":"yarn remark .","prettier":"prettier --ignore-path=node_modules/@foray1010/prettier-config/prettierignore","remark":"remark --frail --ignore-path=node_modules/@foray1010/remark-preset/remarkignore --ignore-path-resolve-from=cwd --silently-ignore","test":"jest","type:check":"tsc","type:coverage":"type-coverage --strict --at-least 99 --detail --ignore-catch"},"dependencies":{"@babel/runtime":"^7.24.8","fastest-levenshtein":"^1.0.16","lodash.deburr":"^4.1.0"},"devDependencies":{"@babel/core":"7.25.2","@commitlint/cli":"19.5.0","@commitlint/config-conventional":"19.5.0","@foray1010/babel-preset":"10.0.0","@foray1010/eslint-config":"13.0.1","@foray1010/jest-preset":"5.1.0","@foray1010/prettier-config":"11.0.1","@foray1010/remark-preset":"10.0.1","@foray1010/tsconfig":"13.0.0","@rollup/plugin-babel":"6.0.4","@rollup/plugin-commonjs":"26.0.1","@rollup/plugin-node-resolve":"15.2.3","@size-limit/preset-small-lib":"11.1.5","@types/jest":"29.5.13","@types/lodash.deburr":"4.1.9","eslint":"9.10.0","ignore-sync":"7.0.1","jest":"29.7.0","lint-staged":"15.2.10","node-notifier":"10.0.1","npm-run-all2":"6.2.3","prettier":"3.3.3","remark-cli":"12.0.1","rollup":"4.21.3","rollup-plugin-dts":"6.1.1","shx":"0.3.4","size-limit":"11.1.5","type-coverage":"2.29.1","typescript":"5.6.2"},"packageManager":"yarn@4.5.0","engines":{"node":"^18.12.0 || >=20.9.0"},"_id":"didyoumean2@7.0.4","gitHead":"9264dcc237b3d1f224e3c793d43617c346e4bf95","_nodeVersion":"18.20.4","_npmVersion":"10.8.2","dist":{"integrity":"sha512-+yW4SNY7W2DOWe2Jx5H4c2qMTFbLGM6wIyoDPkAPy66X+sD1KfYjBPAIWPVsYqMxelflaMQCloZDudELIPhLqA==","shasum":"fa9f63c0435823aa5e3f08aab25fd0328f47576b","tarball":"http://registry-npm.ywwl.com/didyoumean2/download/didyoumean2-7.0.4.tgz","fileCount":10,"unpackedSize":77199,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDl3ZuoRG0+/v+i+VDN5ONrld4MDuRVCBFo1Y5G2TPw3AiEAvOz1TiBY1fP5xnjDpm07FMvnOGPyooj4iHgioqQ/u24="}],"size":14249,"noattachment":false,"key":"/didyoumean2/-/didyoumean2-7.0.4.tgz"},"_npmUser":{"name":"foray1010","email":"carmine-0-bulrush@icloud.com"},"directories":{},"maintainers":[{"name":"foray1010","email":"carmine-0-bulrush@icloud.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/didyoumean2_7.0.4_1726588813605_0.24527639047714778"},"_hasShrinkwrap":false,"readme":"# didyoumean2\n\n[![Build Status](https://img.shields.io/circleci/project/foray1010/didyoumean2/master.svg)](https://circleci.com/gh/foray1010/didyoumean2/tree/master)\n[![codecov.io](https://img.shields.io/codecov/c/github/foray1010/didyoumean2.svg)](https://codecov.io/gh/foray1010/didyoumean2)\n\n[![node](https://img.shields.io/node/v/didyoumean2.svg)](https://www.npmjs.com/package/didyoumean2)\n[![npm](https://img.shields.io/npm/dm/didyoumean2.svg)](https://www.npmjs.com/package/didyoumean2)\n[![npm](https://img.shields.io/npm/l/didyoumean2.svg)](https://www.npmjs.com/package/didyoumean2)\n\n`didyoumean2` is a library for matching human-quality input to a list of potential matches using the [Levenshtein distance algorithm](https://en.wikipedia.org/wiki/Levenshtein_distance).\nIt is inspired by [didyoumean.js](https://github.com/dcporter/didyoumean.js).\n\n## Why reinventing the wheel\n\n1. Based on [fastest-levenshtein](https://github.com/ka-weihe/fastest-levenshtein), the fastest JS implementation of the [Levenshtein distance algorithm](https://en.wikipedia.org/wiki/Levenshtein_distance)\n\n1. ~100% faster than [didyoumean.js](https://github.com/dcporter/didyoumean.js)\n\n1. Well tested with 100% coverage\n\n1. Static type checking with [TypeScript](https://github.com/Microsoft/TypeScript)\n\n1. More control on what kind of matches you want to return\n\n1. Support matching object's `path` instead of just `key`\n\n## Installation\n\n```sh\nnpm install didyoumean2\n```\n\n```js\nconst didYouMean = require('didyoumean2').default\n// or if you are using TypeScript or ES module\nimport didYouMean from 'didyoumean2'\n\n// you can also access to Enums via:\nconst {\n  default: didYouMean,\n  ReturnTypeEnums,\n  ThresholdTypeEnums,\n} = require('didyoumean2')\n// or\nimport didYouMean, { ReturnTypeEnums, ThresholdTypeEnums } from 'didyoumean2'\n```\n\n## Development Setup\n\nWe are using [corepack](https://nodejs.org/api/corepack.html) to manage the `yarn` version\n\n```bash\ncorepack enable\n```\n\n## Usage\n\n```js\ndidYouMean(input, matchList[, options])\n```\n\n- `input {string}`: A string that you are not sure and want to match with `matchList`\n\n- `matchList {Object[]|string[]}`: A List for matching with `input`\n\n- `options {Object}`(optional): An options that allows you to modify the behavior\n\n- `@return {Array|null|Object|string}`: A list of or single matched result(s), return object if `match` is `{Object[]}`\n\n### Options\n\n#### `caseSensitive {boolean}`\n\n- default: `false`\n\n- Perform case-sensitive matching\n\n#### `deburr {boolean}`\n\n- default: `true`\n\n- Perform [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) insensitive matching\n\n- Refer to [lodash \\_.deburr](https://lodash.com/docs#deburr) for how it works\n\n#### `matchPath {Array}`\n\n- default: `[]`\n\n- If your `matchList` is an array of object, you must use `matchPath` to point to the string that you want to match\n\n- Refer to [ramda R.path](https://ramdajs.com/docs/#path) for how to define the path, e.g. `['obj', 'array', 0, 'key']`\n\n#### `returnType {string}`\n\n- default: `ReturnTypeEnums.FIRST_CLOSEST_MATCH`\n\n| returnType                            | Description                                                       |\n| ------------------------------------- | ----------------------------------------------------------------- |\n| `ReturnTypeEnums.ALL_CLOSEST_MATCHES` | Return all matches with the closest value to the `input` in array |\n| `ReturnTypeEnums.ALL_MATCHES`         | Return all matches in array                                       |\n| `ReturnTypeEnums.ALL_SORTED_MATCHES`  | Return all matches in array, sorted from closest to furthest      |\n| `ReturnTypeEnums.FIRST_CLOSEST_MATCH` | Return first match from `ReturnTypeEnums.ALL_CLOSEST_MATCHES`     |\n| `ReturnTypeEnums.FIRST_MATCH`         | Return first match (**FASTEST**)                                  |\n\n#### `threshold {integer|number}`\n\n- depends on `thresholdType`\n\n- type: `{number}` (`similarity`) or `{integer}` (`edit-distance`)\n\n- default: `0.4` (`similarity`) or `20` (`edit-distance`)\n\n- If the result is larger (`similarity`) or smaller (`edit-distance`) than or equal to the `threshold`, that result is matched\n\n#### `thresholdType {string}`\n\n- default: `ThresholdTypeEnums.SIMILARITY`\n\n| thresholdType                      | Description                                                                                                                                      |\n| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |\n| `ThresholdTypeEnums.EDIT_DISTANCE` | Refer to [Levenshtein distance algorithm](https://en.wikipedia.org/wiki/Levenshtein_distance), must be `integer`, lower value means more similar |\n| `ThresholdTypeEnums.SIMILARITY`    | `l = max(input.length, matchItem.length), similarity = (l - editDistance) / l`, `number` from `0` to `1`, higher value means more similar        |\n\n#### `trimSpaces {boolean}`\n\n- default: `true`\n\n- Remove noises when matching\n\n- Trim all starting and ending spaces, and concatenate all continuous spaces to one space\n\n## Test\n\n**_Before all:_**\n\n```sh\nnpm install -g yarn\nyarn install\n```\n\nUnit test and coverage:\n\n```sh\nyarn test\n```\n\nLinter:\n\n```sh\nyarn lint\n```\n","publish_time":1726588813927,"_cnpm_publish_time":1726588813927,"dist-tags":{"latest":"7.0.4","prerelease":"2.0.0-1"}}