1.0.13 • Published 12 months ago

fuse-search v1.0.13

Weekly downloads
-
License
ISC
Repository
github
Last release
12 months ago

fuseSearch

Description

fuseSearch is a function that utilizes fuse.js library to perform easy search operations on arrays of objects. It is designed to simplify the process of searching and filtering data.

The function performs several validations on the provided arguments to ensure their correctness and validity. These validations help maintain the integrity of the search process.

Upon completion, fuseSearch returns an array of objects in the exact same format as the input array. This ensures consistency and allows for easy integration with existing data structures and workflows.

Install

npm i fuse-search

Import

require('fuse-search');

Usage

const fuseSearch = require('fuse-search');

const query = 'John';
const data = [{name: 'John', age: 18}, {name: 'Alex', age: 21}];
const keys = ['name'];
const threshold = 0.4; 

const search = fuseSearch(query, data, keys, threshold);

console.log(search);

[output] > [{name: 'John', age: 18}];

Arguments

ArgumentRequiredTypeDescription
queryrequiredstringRepresents the query.
datarequiredarrayContains the data.
keysrequiredarraySpecifies the keys.
thresholdoptionalnumberRepresents the threshold (default: 0.6).

Repository

git@github.com:GkChris/fuse-search.git

1.0.13

12 months ago

1.0.12

12 months ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago