update tsconfig
This commit is contained in:
parent
039190e681
commit
9a6afa4531
@ -7,14 +7,27 @@
|
|||||||
"gitrepo": "smartfuzzy",
|
"gitrepo": "smartfuzzy",
|
||||||
"shortDescription": "search things easily",
|
"shortDescription": "search things easily",
|
||||||
"npmPackagename": "@push.rocks/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"
|
||||||
},
|
},
|
||||||
"tsdocs": {
|
"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"
|
"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"
|
||||||
}
|
}
|
||||||
}
|
}
|
14
package.json
14
package.json
@ -2,7 +2,7 @@
|
|||||||
"name": "@push.rocks/smartfuzzy",
|
"name": "@push.rocks/smartfuzzy",
|
||||||
"version": "1.1.6",
|
"version": "1.1.6",
|
||||||
"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",
|
||||||
@ -38,5 +38,17 @@
|
|||||||
"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"
|
||||||
]
|
]
|
||||||
}
|
}
|
1
readme.hints.md
Normal file
1
readme.hints.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
134
readme.md
134
readme.md
@ -1,39 +1,117 @@
|
|||||||
# @pushrocks/smartfuzzy
|
# @push.rocks/smartfuzzy
|
||||||
search things easily
|
|
||||||
|
|
||||||
## Availabililty and Links
|
fuzzy match strings against word dictionaries/arrays
|
||||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartfuzzy)
|
|
||||||
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartfuzzy)
|
|
||||||
* [github.com (source mirror)](https://github.com/pushrocks/smartfuzzy)
|
|
||||||
* [docs (typedoc)](https://pushrocks.gitlab.io/smartfuzzy/)
|
|
||||||
|
|
||||||
## Status for master
|
## Install
|
||||||
|
|
||||||
Status Category | Status Badge
|
To install `@push.rocks/smartfuzzy`, use the following npm command. It's recommended to do this in a project where TypeScript is already configured:
|
||||||
-- | --
|
|
||||||
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartfuzzy/badges/master/pipeline.svg)](https://lossless.cloud)
|
```bash
|
||||||
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartfuzzy/badges/master/coverage.svg)](https://lossless.cloud)
|
npm install @push.rocks/smartfuzzy --save
|
||||||
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartfuzzy)](https://lossless.cloud)
|
```
|
||||||
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartfuzzy)](https://lossless.cloud)
|
|
||||||
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
|
|
||||||
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
|
||||||
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
|
|
||||||
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/smartfuzzy)](https://lossless.cloud)
|
|
||||||
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartfuzzy)](https://lossless.cloud)
|
|
||||||
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartfuzzy)](https://lossless.cloud)
|
|
||||||
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Use TypeScript for best in class intellisense.
|
`@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.
|
||||||
|
|
||||||
## Contribution
|
### Setting Up
|
||||||
|
|
||||||
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
|
First, ensure you import the necessary components:
|
||||||
|
|
||||||
For further information read the linked docs at the top of this readme.
|
```typescript
|
||||||
|
import {
|
||||||
|
Smartfuzzy,
|
||||||
|
ObjectSorter,
|
||||||
|
ArticleSearch
|
||||||
|
} from '@push.rocks/smartfuzzy';
|
||||||
|
```
|
||||||
|
|
||||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
### Basic String Matching
|
||||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
|
||||||
|
|
||||||
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)
|
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.
|
||||||
|
Loading…
Reference in New Issue
Block a user