Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jofaval/robust-search
Allows for a robust string comparison with almost matching options
https://github.com/jofaval/robust-search
jofaval open-source robust search
Last synced: 26 days ago
JSON representation
Allows for a robust string comparison with almost matching options
- Host: GitHub
- URL: https://github.com/jofaval/robust-search
- Owner: jofaval
- License: isc
- Created: 2021-12-04T14:10:41.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-01-04T00:55:25.000Z (almost 3 years ago)
- Last Synced: 2024-10-13T06:34:10.444Z (about 1 month ago)
- Topics: jofaval, open-source, robust, search
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/robust-search
- Size: 59.6 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Robust Search #
[![Available in English](https://img.shields.io/badge/lang-en-blue.svg)](/doc/en/)
[![Disponible en Castellano](https://img.shields.io/badge/lang-es-red.svg)](/doc/es/)[![npm version](https://badge.fury.io/js/robust-search.svg)](http://badge.fury.io/js/robust-search)\
[![NPM](https://nodei.co/npm/robust-search.png?downloads=true)](https://nodei.co/npm/robust-search/)Package details at: [robust-search](https://www.npmjs.com/package/robust-search) or https://www.npmjs.com/package/robust-search
## Description
It's a robust and flexible search component.
### Objective
It allows for an almost match, i.e., "Jenna" wouldn't equal "jena", but now it can.
So it's objective it's to give more tools to compare, taking into account user's human mistakes## Usage
For the complete documentation, [click here](/doc/en/)### Install
#### Browser
```html```
#### Node.js
```bash
npm i --save-dev robust-search
```### Import
Without this, it won't work
````javascript
import {
equal,
different,
almost,
unalike,
isMatch,
search,
exclude,
contains
} from "robust-search"
````
### String.prototype.equal
Is a `string` the same as another?
````javascript
// String equal
"test".equal("test") // returns true// String equal
"test".equal("tset") // returns false
````
### String.prototype.diff, or different
Is a `string` not the same as another?
````javascript
// String not equal
"test".diff("tset") // returns true
````
### String.prototype.almost
Is a `string` almost same as another?
````javascript
// String almost
"test".almost("tset") // returns true
````
### String.prototype.unalike
Is a `string` not quite the same as another?
````javascript
// String unalike
"test".unalike("tset") // returns false
````
### String.prototype.isMatch
This will use all of the above to check for a match
````javascript
// String isMatch (does an almost or equal)
"test".isMatch("tset") // returns true
````
### String.prototype.contains
Does it contain the `substring` given? Sort of an `includes`
````javascript
// String contains
"test".contains("est") // returns true
// String doesn't contain
"test".contains("tset") // returns false
````
### search
Searchs using the above methods inside an `array`
````javascript
// String search
search([ "test", "hello", "world!" ], "test") // returns ["test"]
````
### exclude
Searchs for non-matches using the above methods inside an `array`
````javascript
// String exclude
exclude([ "test", "hello", "world!" ], "test") // returns ["hello", "world!"]
````