Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
283703ec78 | |||
4fc2eb6ece | |||
d647706881 | |||
9a6afa4531 | |||
039190e681 | |||
be02f01959 | |||
df0930e984 | |||
753dea9d96 | |||
ff512a0284 | |||
4eead78c55 | |||
fa262af6a4 | |||
58f7458acd |
66
.gitea/workflows/default_nottags.yaml
Normal file
66
.gitea/workflows/default_nottags.yaml
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
name: Default (not tags)
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags-ignore:
|
||||||
|
- '**'
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE: code.foss.global/host.today/ht-docker-node:npmci
|
||||||
|
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@/${{gitea.repository}}.git
|
||||||
|
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
||||||
|
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
||||||
|
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
||||||
|
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
security:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
continue-on-error: true
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Install pnpm and npmci
|
||||||
|
run: |
|
||||||
|
pnpm install -g pnpm
|
||||||
|
pnpm install -g @ship.zone/npmci
|
||||||
|
|
||||||
|
- name: Run npm prepare
|
||||||
|
run: npmci npm prepare
|
||||||
|
|
||||||
|
- name: Audit production dependencies
|
||||||
|
run: |
|
||||||
|
npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
npmci command pnpm audit --audit-level=high --prod
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
- name: Audit development dependencies
|
||||||
|
run: |
|
||||||
|
npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
npmci command pnpm audit --audit-level=high --dev
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
test:
|
||||||
|
if: ${{ always() }}
|
||||||
|
needs: security
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Test stable
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm install
|
||||||
|
npmci npm test
|
||||||
|
|
||||||
|
- name: Test build
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm install
|
||||||
|
npmci npm build
|
124
.gitea/workflows/default_tags.yaml
Normal file
124
.gitea/workflows/default_tags.yaml
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
name: Default (tags)
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
env:
|
||||||
|
IMAGE: code.foss.global/host.today/ht-docker-node:npmci
|
||||||
|
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@/${{gitea.repository}}.git
|
||||||
|
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
||||||
|
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
||||||
|
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
||||||
|
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
security:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
continue-on-error: true
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
run: |
|
||||||
|
pnpm install -g pnpm
|
||||||
|
pnpm install -g @ship.zone/npmci
|
||||||
|
npmci npm prepare
|
||||||
|
|
||||||
|
- name: Audit production dependencies
|
||||||
|
run: |
|
||||||
|
npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
npmci command pnpm audit --audit-level=high --prod
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
- name: Audit development dependencies
|
||||||
|
run: |
|
||||||
|
npmci command npm config set registry https://registry.npmjs.org
|
||||||
|
npmci command pnpm audit --audit-level=high --dev
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
test:
|
||||||
|
if: ${{ always() }}
|
||||||
|
needs: security
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
run: |
|
||||||
|
pnpm install -g pnpm
|
||||||
|
pnpm install -g @ship.zone/npmci
|
||||||
|
npmci npm prepare
|
||||||
|
|
||||||
|
- name: Test stable
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm install
|
||||||
|
npmci npm test
|
||||||
|
|
||||||
|
- name: Test build
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm install
|
||||||
|
npmci npm build
|
||||||
|
|
||||||
|
release:
|
||||||
|
needs: test
|
||||||
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
run: |
|
||||||
|
pnpm install -g pnpm
|
||||||
|
pnpm install -g @ship.zone/npmci
|
||||||
|
npmci npm prepare
|
||||||
|
|
||||||
|
- name: Release
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm publish
|
||||||
|
|
||||||
|
metadata:
|
||||||
|
needs: test
|
||||||
|
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: ${{ env.IMAGE }}
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
run: |
|
||||||
|
pnpm install -g pnpm
|
||||||
|
pnpm install -g @ship.zone/npmci
|
||||||
|
npmci npm prepare
|
||||||
|
|
||||||
|
- name: Code quality
|
||||||
|
run: |
|
||||||
|
npmci command npm install -g typescript
|
||||||
|
npmci npm install
|
||||||
|
|
||||||
|
- name: Trigger
|
||||||
|
run: npmci trigger
|
||||||
|
|
||||||
|
- name: Build docs and upload artifacts
|
||||||
|
run: |
|
||||||
|
npmci node install stable
|
||||||
|
npmci npm install
|
||||||
|
pnpm install -g @git.zone/tsdoc
|
||||||
|
npmci command tsdoc
|
||||||
|
continue-on-error: true
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -3,7 +3,6 @@
|
|||||||
# artifacts
|
# artifacts
|
||||||
coverage/
|
coverage/
|
||||||
public/
|
public/
|
||||||
pages/
|
|
||||||
|
|
||||||
# installs
|
# installs
|
||||||
node_modules/
|
node_modules/
|
||||||
@ -17,4 +16,4 @@ node_modules/
|
|||||||
dist/
|
dist/
|
||||||
dist_*/
|
dist_*/
|
||||||
|
|
||||||
# custom
|
#------# custom
|
138
.gitlab-ci.yml
138
.gitlab-ci.yml
@ -1,138 +0,0 @@
|
|||||||
# gitzone ci_default
|
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
|
||||||
|
|
||||||
cache:
|
|
||||||
paths:
|
|
||||||
- .npmci_cache/
|
|
||||||
key: '$CI_BUILD_STAGE'
|
|
||||||
|
|
||||||
stages:
|
|
||||||
- security
|
|
||||||
- test
|
|
||||||
- release
|
|
||||||
- metadata
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# security stage
|
|
||||||
# ====================
|
|
||||||
mirror:
|
|
||||||
stage: security
|
|
||||||
script:
|
|
||||||
- npmci git mirror
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
auditProductionDependencies:
|
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
|
||||||
stage: security
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci command npm install --production --ignore-scripts
|
|
||||||
- npmci command npm config set registry https://registry.npmjs.org
|
|
||||||
- npmci command npm audit --audit-level=high --only=prod --production
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
allow_failure: true
|
|
||||||
|
|
||||||
auditDevDependencies:
|
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
|
||||||
stage: security
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci command npm install --ignore-scripts
|
|
||||||
- npmci command npm config set registry https://registry.npmjs.org
|
|
||||||
- npmci command npm audit --audit-level=high --only=dev
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
allow_failure: true
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# test stage
|
|
||||||
# ====================
|
|
||||||
|
|
||||||
testStable:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm install
|
|
||||||
- npmci npm test
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
testBuild:
|
|
||||||
stage: test
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm install
|
|
||||||
- npmci command npm run build
|
|
||||||
coverage: /\d+.?\d+?\%\s*coverage/
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
release:
|
|
||||||
stage: release
|
|
||||||
script:
|
|
||||||
- npmci node install stable
|
|
||||||
- npmci npm publish
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# metadata stage
|
|
||||||
# ====================
|
|
||||||
codequality:
|
|
||||||
stage: metadata
|
|
||||||
allow_failure: true
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
script:
|
|
||||||
- npmci command npm install -g tslint typescript
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci npm install
|
|
||||||
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- priv
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
stage: metadata
|
|
||||||
script:
|
|
||||||
- npmci trigger
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
pages:
|
|
||||||
stage: metadata
|
|
||||||
script:
|
|
||||||
- npmci node install lts
|
|
||||||
- npmci command npm install -g @gitzone/tsdoc
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci npm install
|
|
||||||
- npmci command tsdoc
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
artifacts:
|
|
||||||
expire_in: 1 week
|
|
||||||
paths:
|
|
||||||
- public
|
|
||||||
allow_failure: true
|
|
53
changelog.md
Normal file
53
changelog.md
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
## 2025-05-12 - 1.1.7 - fix(build)
|
||||||
|
Fix import paths, update CI workflows and upgrade dependencies for ESM compliance
|
||||||
|
|
||||||
|
- Updated import statements to include .js extensions for NodeNext compatibility
|
||||||
|
- Upgraded dependencies: @push.rocks/smartpromise (^4.0.2), @tsclass/tsclass (^9.2.0), fuse.js (^7.1.0), leven (^4.0.0), and @push.rocks/tapbundle (^6.0.3)
|
||||||
|
- Added new workflow files for CI (default_tags.yaml and default_nottags.yaml)
|
||||||
|
- Revised test files and documentation to reflect file path and dependency changes
|
||||||
|
- Minor adjustments in package.json (scripts and metadata) and tsconfig for enhanced module resolution
|
||||||
|
|
||||||
|
## 2024-05-29 - 1.1.6 - maintenance
|
||||||
|
This release brings a series of configuration and documentation updates as well as an organizational change.
|
||||||
|
- Updated project description.
|
||||||
|
- Revised tsconfig settings.
|
||||||
|
- Updated npmextra.json with new githost details (merged from several commits).
|
||||||
|
- Switched to a new organization scheme.
|
||||||
|
(Note: A prior commit “1.1.6” from 2021 was a version bump and is omitted here.)
|
||||||
|
|
||||||
|
## 2021-10-04 - 1.1.5 - core
|
||||||
|
Core components were fixed in this update.
|
||||||
|
- fix(core): update
|
||||||
|
|
||||||
|
## 2021-10-03 - 1.1.4
|
||||||
|
This version was released as a version bump without additional significant changes.
|
||||||
|
|
||||||
|
## 2021-10-03 - 1.1.3 - core
|
||||||
|
Minor fixes were applied to core functionality.
|
||||||
|
- fix(core): update
|
||||||
|
|
||||||
|
## 2021-10-03 - 1.1.2 - core
|
||||||
|
Additional improvements and fixes to the core components.
|
||||||
|
- fix(core): update
|
||||||
|
|
||||||
|
## 2021-10-03 - 1.1.1 - core
|
||||||
|
A further core update fixing underlying issues.
|
||||||
|
- fix(core): update
|
||||||
|
|
||||||
|
## 2018-08-19 - 1.1.0 - Smartfuzzy
|
||||||
|
A fix was introduced for Smartfuzzy’s matching functionality.
|
||||||
|
- fix(Smartfuzzy.getClosestMatchForString() now returns the cloesest string directly): update
|
||||||
|
|
||||||
|
## 2018-08-19 - 1.0.3 - ObjectSorter
|
||||||
|
A new feature has been added to sort objects by likability.
|
||||||
|
- feat(ObjectSorter): now sorts objects by likability
|
||||||
|
|
||||||
|
## 2018-08-19 - 1.0.2 - package
|
||||||
|
An adjustment was made to the package name in the npm configuration.
|
||||||
|
- fix(package): npm name
|
||||||
|
|
||||||
|
## 2018-08-19 - 1.0.1 - package
|
||||||
|
Initial package fixes were applied.
|
||||||
|
- fix(package): initial
|
19
license
Normal file
19
license
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
Copyright (c) 2014 Lossless GmbH (hello@lossless.com)
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
@ -2,16 +2,32 @@
|
|||||||
"gitzone": {
|
"gitzone": {
|
||||||
"projectType": "npm",
|
"projectType": "npm",
|
||||||
"module": {
|
"module": {
|
||||||
"githost": "gitlab.com",
|
"githost": "code.foss.global",
|
||||||
"gitscope": "pushrocks",
|
"gitscope": "push.rocks",
|
||||||
"gitrepo": "smartfuzzy",
|
"gitrepo": "smartfuzzy",
|
||||||
"shortDescription": "search things easily",
|
"shortDescription": "search things easily",
|
||||||
"npmPackagename": "@pushrocks/smartfuzzy",
|
"npmPackagename": "@push.rocks/smartfuzzy",
|
||||||
"license": "MIT"
|
"license": "MIT",
|
||||||
|
"description": "A library for fuzzy matching strings against word dictionaries or arrays, with support for object and article searching.",
|
||||||
|
"keywords": [
|
||||||
|
"fuzzy matching",
|
||||||
|
"string matching",
|
||||||
|
"dictionary matching",
|
||||||
|
"search",
|
||||||
|
"text analysis",
|
||||||
|
"object sorting",
|
||||||
|
"article search",
|
||||||
|
"text similarity",
|
||||||
|
"keyword matching",
|
||||||
|
"data filtering"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"npmci": {
|
"npmci": {
|
||||||
"npmGlobalTools": [],
|
"npmGlobalTools": [],
|
||||||
"npmAccessLevel": "public"
|
"npmAccessLevel": "public"
|
||||||
|
},
|
||||||
|
"tsdoc": {
|
||||||
|
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
||||||
}
|
}
|
||||||
}
|
}
|
25847
package-lock.json
generated
25847
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
52
package.json
52
package.json
@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartfuzzy",
|
"name": "@push.rocks/smartfuzzy",
|
||||||
"version": "1.1.4",
|
"version": "1.1.7",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "fuzzy match strings against word dictionaries/arrays",
|
"description": "A library for fuzzy matching strings against word dictionaries or arrays, with support for object and article searching.",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
"typings": "dist_ts/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
"author": "Lossless GmbH",
|
"author": "Lossless GmbH",
|
||||||
@ -10,19 +10,20 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/)",
|
"test": "(tstest test/)",
|
||||||
"format": "(gitzone format)",
|
"format": "(gitzone format)",
|
||||||
"build": "(tsbuild)"
|
"build": "(tsbuild)",
|
||||||
|
"buildDocs": "tsdoc"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.27",
|
"@git.zone/tsbuild": "^2.1.27",
|
||||||
"@gitzone/tstest": "^1.0.57",
|
"@git.zone/tstest": "^1.0.57",
|
||||||
"@pushrocks/tapbundle": "^3.2.14",
|
"@push.rocks/tapbundle": "^6.0.3",
|
||||||
"@types/node": "^16.10.2"
|
"@types/node": "^22.15.17"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartpromise": "^3.1.6",
|
"@push.rocks/smartpromise": "^4.0.2",
|
||||||
"@tsclass/tsclass": "^3.0.33",
|
"@tsclass/tsclass": "^9.2.0",
|
||||||
"fuse.js": "^6.4.6",
|
"fuse.js": "^7.1.0",
|
||||||
"leven": "^3.1.0"
|
"leven": "^4.0.0"
|
||||||
},
|
},
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"last 1 chrome versions"
|
"last 1 chrome versions"
|
||||||
@ -38,5 +39,30 @@
|
|||||||
"cli.js",
|
"cli.js",
|
||||||
"npmextra.json",
|
"npmextra.json",
|
||||||
"readme.md"
|
"readme.md"
|
||||||
]
|
],
|
||||||
|
"keywords": [
|
||||||
|
"fuzzy matching",
|
||||||
|
"string matching",
|
||||||
|
"dictionary matching",
|
||||||
|
"search",
|
||||||
|
"text analysis",
|
||||||
|
"object sorting",
|
||||||
|
"article search",
|
||||||
|
"text similarity",
|
||||||
|
"keyword matching",
|
||||||
|
"data filtering"
|
||||||
|
],
|
||||||
|
"homepage": "https://code.foss.global/push.rocks/smartfuzzy#readme",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://code.foss.global/push.rocks/smartfuzzy.git"
|
||||||
|
},
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://code.foss.global/push.rocks/smartfuzzy/issues"
|
||||||
|
},
|
||||||
|
"type": "module",
|
||||||
|
"pnpm": {
|
||||||
|
"overrides": {}
|
||||||
|
},
|
||||||
|
"packageManager": "pnpm@10.10.0+sha512.d615db246fe70f25dcfea6d8d73dee782ce23e2245e3c4f6f888249fb568149318637dca73c2c5c8ef2a4ca0d5657fb9567188bfab47f566d1ee6ce987815c39"
|
||||||
}
|
}
|
||||||
|
10040
pnpm-lock.yaml
generated
Normal file
10040
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
1
readme.hints.md
Normal file
1
readme.hints.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
127
readme.md
Normal file
127
readme.md
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
# @push.rocks/smartfuzzy
|
||||||
|
|
||||||
|
fuzzy match strings against word dictionaries/arrays
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
To install `@push.rocks/smartfuzzy`, use the following npm command. It's recommended to do this in a project where TypeScript is already configured:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install @push.rocks/smartfuzzy --save
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
`@push.rocks/smartfuzzy` is a versatile library designed to help you perform fuzzy searches and sorts on arrays of strings and objects. Whether you're building a search feature, organizing data, or implementing autocomplete functionality, `@push.rocks/smartfuzzy` offers you the tools needed to achieve efficient and intuitive search results. Below are various scenarios to cover a broad set of features of the module, ensuring you can integrate it effectively into your TypeScript projects.
|
||||||
|
|
||||||
|
### Setting Up
|
||||||
|
|
||||||
|
First, ensure you import the necessary components:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { Smartfuzzy, ObjectSorter, ArticleSearch } from '@push.rocks/smartfuzzy';
|
||||||
|
```
|
||||||
|
|
||||||
|
### Basic String Matching
|
||||||
|
|
||||||
|
For scenarios where you have an array of strings and you wish to find a match for a search term:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
const myDictionary = ['Sony', 'Deutsche Bahn', 'Apple Inc.', "Trader Joe's"];
|
||||||
|
const mySmartFuzzy = new Smartfuzzy(myDictionary);
|
||||||
|
|
||||||
|
// Adding additional dictionary entries
|
||||||
|
mySmartFuzzy.addToDictionary('Microsoft');
|
||||||
|
mySmartFuzzy.addToDictionary(['Google', 'Facebook']);
|
||||||
|
|
||||||
|
// Getting the closest match
|
||||||
|
const searchResult = mySmartFuzzy.getClosestMatchForString('Appl');
|
||||||
|
console.log(searchResult); // Output: "Apple Inc."
|
||||||
|
```
|
||||||
|
|
||||||
|
This example demonstrates how to instantiate the `Smartfuzzy` class with a list of strings (dictionary) and add more entries to it. You can then use it to get the closest match for a given search string.
|
||||||
|
|
||||||
|
### Advanced Object Sorting
|
||||||
|
|
||||||
|
Imagine you are managing a list of objects, and you wish to sort them based on the resemblance of one or more of their properties to a search term:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
interface ICar {
|
||||||
|
brand: string;
|
||||||
|
model: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const carList: ICar[] = [
|
||||||
|
{ brand: 'BMW', model: 'M3' },
|
||||||
|
{ brand: 'Mercedes Benz', model: 'E-Class' },
|
||||||
|
{ brand: 'Volvo', model: 'XC90' },
|
||||||
|
];
|
||||||
|
|
||||||
|
const carSorter = new ObjectSorter<ICar>(carList);
|
||||||
|
|
||||||
|
// Search and sort based on brand similarity
|
||||||
|
const searchResults = carSorter.sort('Benz', ['brand']);
|
||||||
|
console.log(searchResults); // Results will be sorted by relevance to 'Benz'
|
||||||
|
```
|
||||||
|
|
||||||
|
This scenario shows how to use `ObjectSorter` for sorting an array of objects based on how closely one of their string properties matches a search term. This is particularly useful for filtering or autocomplete features where relevance is key.
|
||||||
|
|
||||||
|
### Searching Within Articles
|
||||||
|
|
||||||
|
If your application involves searching through articles or similar textual content, `ArticleSearch` allows for a weighted search across multiple fields:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { IArticle } from '@tsclass/tsclass/content';
|
||||||
|
|
||||||
|
const articles: IArticle[] = [
|
||||||
|
{
|
||||||
|
title: 'History of Berlin',
|
||||||
|
content: 'Berlin has a rich history...',
|
||||||
|
tags: ['history', 'Berlin'],
|
||||||
|
timestamp: Date.now(),
|
||||||
|
featuredImageUrl: null,
|
||||||
|
url: null,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Tourism in Berlin',
|
||||||
|
content: 'Discover the vibrant city of Berlin...',
|
||||||
|
tags: ['travel', 'Berlin'],
|
||||||
|
timestamp: Date.now(),
|
||||||
|
featuredImageUrl: null,
|
||||||
|
url: null,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const articleSearch = new ArticleSearch(articles);
|
||||||
|
|
||||||
|
// Perform a search across titles, content, and tags
|
||||||
|
const searchResult = await articleSearch.search('rich history');
|
||||||
|
console.log(searchResult); // Array of matches with relevance to 'rich history'
|
||||||
|
```
|
||||||
|
|
||||||
|
The `ArticleSearch` class showcases how to implement a search feature across a collection of articles with prioritization across different fields (e.g., title, content, tags). This ensures more relevant search results and creates a better experience for users navigating through large datasets or content libraries.
|
||||||
|
|
||||||
|
### Conclusion
|
||||||
|
|
||||||
|
`@push.rocks/smartfuzzy` offers a robust set of functionalities for integrating fuzzy searching and sorting capabilities into your TypeScript applications. By following the examples demonstrated, you can effectively utilize the module to enhance user experience where text search is a critical component of the application.
|
||||||
|
|
||||||
|
Remember to always consider the specific requirements of your project when implementing these features, as adjustments to configurations such as threshold levels and keys to search on can significantly impact the effectiveness of your search functionality.
|
||||||
|
|
||||||
|
## License and Legal Information
|
||||||
|
|
||||||
|
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
|
||||||
|
|
||||||
|
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
### Trademarks
|
||||||
|
|
||||||
|
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
|
||||||
|
|
||||||
|
### Company Information
|
||||||
|
|
||||||
|
Task Venture Capital GmbH
|
||||||
|
Registered at District court Bremen HRB 35230 HB, Germany
|
||||||
|
|
||||||
|
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
|
||||||
|
|
||||||
|
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
85
readme.plan.md
Normal file
85
readme.plan.md
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
# SmartFuzzy Improvement Plan
|
||||||
|
|
||||||
|
## Current Status
|
||||||
|
- ESM imports/exports fixed with .js extensions
|
||||||
|
- Basic fuzzy matching functionality works
|
||||||
|
- Tests run individually with tsx but fail with pnpm test
|
||||||
|
- Using older versions of dependencies
|
||||||
|
|
||||||
|
## Improvement Plan
|
||||||
|
|
||||||
|
### 1. Fix Testing Infrastructure
|
||||||
|
|
||||||
|
#### 1.1 Fix Test Runner Configuration
|
||||||
|
- [ ] Investigate why `pnpm test` fails while individual tests run with `tsx` succeed
|
||||||
|
- [ ] Check if `tsrun` command is properly installed and available (current error shows "tsrun: command not found")
|
||||||
|
- [ ] Examine the `tstest` configuration in package.json and update if needed
|
||||||
|
- [ ] Verify that `@git.zone/tstest` dependency is properly installed and configured
|
||||||
|
- [ ] Consider updating the test script to use `tsx` directly if `tstest` continues to be problematic
|
||||||
|
|
||||||
|
#### 1.2 Update Test Syntax and Standards
|
||||||
|
- [ ] Convert all tests from chai-style syntax (`expect().to.be`) to SmartExpect syntax (`expect().toBeInstanceOf()`)
|
||||||
|
- [ ] Implement consistent test structure across all test files
|
||||||
|
- [ ] Add proper setup and teardown patterns where needed
|
||||||
|
- [ ] Replace console.log statements with proper assertions to validate results
|
||||||
|
- [ ] Add descriptive error messages to assertions to improve test debugging
|
||||||
|
|
||||||
|
#### 1.3 Expand Test Coverage
|
||||||
|
- [ ] Add tests for empty dictionaries and edge cases
|
||||||
|
- [ ] Test with extremely large dictionaries to verify performance
|
||||||
|
- [ ] Add tests for unicode/special character handling
|
||||||
|
- [ ] Test with very similar strings to validate fuzzy matching accuracy
|
||||||
|
- [ ] Add tests for error conditions and input validation
|
||||||
|
- [ ] Implement tests for all public APIs and features
|
||||||
|
|
||||||
|
#### 1.4 Test Automation and CI
|
||||||
|
- [ ] Add test coverage reporting
|
||||||
|
- [ ] Set up continuous integration for automated testing
|
||||||
|
- [ ] Add performance regression tests
|
||||||
|
- [ ] Create test fixtures for consistent test data
|
||||||
|
- [ ] Add browser-based tests for web compatibility
|
||||||
|
|
||||||
|
### 2. Code Quality Improvements
|
||||||
|
- [ ] Add proper TypeScript documentation comments to all public methods
|
||||||
|
- [ ] Implement consistent error handling
|
||||||
|
- [ ] Add input validation for all public methods
|
||||||
|
- [ ] Standardize method naming conventions (e.g., get* vs find*)
|
||||||
|
|
||||||
|
### 3. Feature Enhancements
|
||||||
|
- [ ] Add configurable threshold options for matching
|
||||||
|
- [ ] Implement stemming/lemmatization support for better text matching
|
||||||
|
- [ ] Add language-specific matching options
|
||||||
|
- [ ] Support for weighted matching across multiple fields
|
||||||
|
- [ ] Add batch processing capabilities for large datasets
|
||||||
|
|
||||||
|
### 4. Performance Optimizations
|
||||||
|
- [ ] Implement caching for repeated searches
|
||||||
|
- [ ] Optimize indexing for large dictionaries
|
||||||
|
- [ ] Add benchmarking tests to measure performance improvements
|
||||||
|
|
||||||
|
### 5. Dependencies and Build System
|
||||||
|
- [ ] Update to latest versions of dependencies
|
||||||
|
- [ ] Ensure proper tree-shaking for browser bundle
|
||||||
|
- [ ] Add browser-specific build configuration
|
||||||
|
- [ ] Implement proper ES module / CommonJS dual package setup
|
||||||
|
|
||||||
|
### 6. Documentation
|
||||||
|
- [ ] Create comprehensive API documentation
|
||||||
|
- [ ] Add usage examples for common scenarios
|
||||||
|
- [ ] Create benchmarks comparing to other fuzzy matching libraries
|
||||||
|
- [ ] Document performance characteristics and optimization strategies
|
||||||
|
|
||||||
|
### 7. Developer Experience
|
||||||
|
- [ ] Add VS Code debugging configuration
|
||||||
|
- [ ] Implement changelog generation
|
||||||
|
- [ ] Set up automated release process
|
||||||
|
- [ ] Add contribution guidelines
|
||||||
|
|
||||||
|
## Priority Order
|
||||||
|
1. Fix testing infrastructure (critical)
|
||||||
|
2. Code quality improvements (high)
|
||||||
|
3. Documentation (high)
|
||||||
|
4. Feature enhancements (medium)
|
||||||
|
5. Performance optimizations (medium)
|
||||||
|
6. Dependencies and build system (medium)
|
||||||
|
7. Developer experience (low)
|
@ -1,6 +1,6 @@
|
|||||||
import { expect, tap } from '@pushrocks/tapbundle';
|
import { expect, tap } from '@push.rocks/tapbundle';
|
||||||
import * as tsclass from '@tsclass/tsclass';
|
import * as tsclass from '@tsclass/tsclass';
|
||||||
import * as smartfuzzy from '../ts/index';
|
import * as smartfuzzy from '../ts/index.js';
|
||||||
|
|
||||||
tap.test('should sort objects', async () => {
|
tap.test('should sort objects', async () => {
|
||||||
const articleArray: tsclass.content.IArticle[] = [
|
const articleArray: tsclass.content.IArticle[] = [
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
import { expect, tap } from '@pushrocks/tapbundle';
|
import { expect, tap } from '@push.rocks/tapbundle';
|
||||||
import * as smartfuzzy from '../ts/index';
|
import * as smartfuzzy from '../ts/index.js';
|
||||||
|
|
||||||
tap.test('should sort objects', async () => {
|
tap.test('should sort objects', async () => {
|
||||||
class Car {
|
class Car {
|
||||||
constructor(public brand: string) {}
|
constructor(public brand: string) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
let testObjectSorter: smartfuzzy.ObjectSorter<Car>;
|
const testObjectSorter = new smartfuzzy.ObjectSorter<Car>([
|
||||||
|
|
||||||
testObjectSorter = new smartfuzzy.ObjectSorter([
|
|
||||||
new Car('BMW'),
|
new Car('BMW'),
|
||||||
new Car('Mercedes Benz'),
|
new Car('Mercedes Benz'),
|
||||||
new Car('Volvo'),
|
new Car('Volvo'),
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { expect, tap } from '@pushrocks/tapbundle';
|
import { expect, tap } from '@push.rocks/tapbundle';
|
||||||
import * as smartfuzzy from '../ts/index';
|
import * as smartfuzzy from '../ts/index.js';
|
||||||
|
|
||||||
let testSmartfuzzy: smartfuzzy.Smartfuzzy;
|
let testSmartfuzzy: smartfuzzy.Smartfuzzy;
|
||||||
|
|
||||||
@ -10,7 +10,7 @@ tap.test('should create an instance of Smartfuzzy', async () => {
|
|||||||
'Apple Inc.',
|
'Apple Inc.',
|
||||||
"Trader Joe's",
|
"Trader Joe's",
|
||||||
]);
|
]);
|
||||||
expect(testSmartfuzzy).to.be.instanceof(smartfuzzy.Smartfuzzy);
|
expect(testSmartfuzzy).toBeInstanceOf(smartfuzzy.Smartfuzzy);
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should compute a score', async () => {
|
tap.test('should compute a score', async () => {
|
||||||
|
8
ts/00_commitinfo_data.ts
Normal file
8
ts/00_commitinfo_data.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* autocreated commitinfo by @push.rocks/commitinfo
|
||||||
|
*/
|
||||||
|
export const commitinfo = {
|
||||||
|
name: '@push.rocks/smartfuzzy',
|
||||||
|
version: '1.1.7',
|
||||||
|
description: 'A library for fuzzy matching strings against word dictionaries or arrays, with support for object and article searching.'
|
||||||
|
}
|
@ -1,3 +1,3 @@
|
|||||||
export * from './smartfuzzy.articlesearch';
|
export * from './smartfuzzy.articlesearch.js';
|
||||||
export * from './smartfuzzy.classes.smartfuzzy';
|
export * from './smartfuzzy.classes.smartfuzzy.js';
|
||||||
export * from './smartfuzzy.classes.objectsorter';
|
export * from './smartfuzzy.classes.objectsorter.js';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import * as plugins from './smartfuzzy.plugins';
|
import * as plugins from './smartfuzzy.plugins.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* an article search that searches articles in a weighted manner
|
* an article search that searches articles in a weighted manner
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import * as plugins from './smartfuzzy.plugins';
|
import * as plugins from './smartfuzzy.plugins.js';
|
||||||
|
|
||||||
export class ObjectSorter<T> {
|
export class ObjectSorter<T> {
|
||||||
public objectDictionary: T[];
|
public objectDictionary: T[];
|
||||||
@ -7,7 +7,7 @@ export class ObjectSorter<T> {
|
|||||||
this.objectDictionary = objectDictionaryArg;
|
this.objectDictionary = objectDictionaryArg;
|
||||||
}
|
}
|
||||||
|
|
||||||
sort(stringArg: string, objectKeysArg: string[]): plugins.fuseJs.FuseResult<T>[] {
|
sort(stringArg: string, objectKeysArg: string[]): Array<{ item: T; refIndex: number; score?: number }> {
|
||||||
const fuseOptions = {
|
const fuseOptions = {
|
||||||
shouldSort: true,
|
shouldSort: true,
|
||||||
threshold: 0.6,
|
threshold: 0.6,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import * as plugins from './smartfuzzy.plugins';
|
import * as plugins from './smartfuzzy.plugins.js';
|
||||||
|
|
||||||
export let standardExport = 'Hi there! :) This is an exported string';
|
export let standardExport = 'Hi there! :) This is an exported string';
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// @pushrocks scope
|
// @pushrocks scope
|
||||||
import * as smartpromise from '@pushrocks/smartpromise';
|
import * as smartpromise from '@push.rocks/smartpromise';
|
||||||
|
|
||||||
export { smartpromise };
|
export { smartpromise };
|
||||||
|
|
||||||
|
16
tsconfig.json
Normal file
16
tsconfig.json
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"useDefineForClassFields": false,
|
||||||
|
"target": "ES2022",
|
||||||
|
"module": "NodeNext",
|
||||||
|
"moduleResolution": "NodeNext",
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"verbatimModuleSyntax": true,
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {}
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"dist_*/**/*.d.ts"
|
||||||
|
]
|
||||||
|
}
|
17
tslint.json
17
tslint.json
@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": ["tslint:latest", "tslint-config-prettier"],
|
|
||||||
"rules": {
|
|
||||||
"semicolon": [true, "always"],
|
|
||||||
"no-console": false,
|
|
||||||
"ordered-imports": false,
|
|
||||||
"object-literal-sort-keys": false,
|
|
||||||
"member-ordering": {
|
|
||||||
"options":{
|
|
||||||
"order": [
|
|
||||||
"static-method"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"defaultSeverity": "warning"
|
|
||||||
}
|
|
Reference in New Issue
Block a user