data-search-module
v1.0.11
Published
javascript module for using levenshtein distance to search objects for a string
Downloads
3
Readme
Data Search Module
Introduction
This module's intended use, is to sift through an array of objects and search it for a value that matches a string.
Installation
npm i --save data-search-module
usage
const searchDataFilter = require('data-search-module');
const dataToSearch=[
{
someDate:'1',
someMoreData:{
someNestedData:2
}
},
{
someDate:'1',
someMoreData:{
someNestedData:2
}
},
{
someDate:'1',
someMoreData:{
someNestedData:2
}
},
];
const searchFor = '1'
const searchResult = await searchDataFilter(searchFor, dataToSearch)
console.log(searchResult)
Guide Lines
- parameters
- searchFor : item to be searched for, must be of type string
- dataToSearch: item to be searched in, must be of type objects array
- a 60% levesthein distance will result in a match