How I can search in the nested array of strings?
See original GitHub issueHere is my data:
[
[
'test1',
'test2',
'test3-match',
],
[
'test11',
'test12-match',
'test13',
],
[
'test21',
'test22',
'test23',
],
]
How I can search this array? I need to return only subarrays that include any matches.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:6 (1 by maintainers)
Top Results From Across the Web
search array of string through nested array of data [duplicate]
I need to implement a search query on a nested array of data. The user can input multiple search strings separated by a...
Read more >Nested Array: Filter on a String [] /Map doesn't return results as ...
Here is the object structure. I should be able to search by carrier Name or provider first/last Name. And If I search by...
Read more >Nested field type | Elasticsearch Guide [8.5] | Elastic
The nested type is a specialised version of the object data type that allows arrays of objects to be indexed in a way...
Read more >Querying arrays with complex types and nested structures
The following examples illustrate how to search a dataset for a keyword within an element inside an array, using the regexp_like function. It...
Read more >Array.prototype.flat() - JavaScript - MDN Web Docs
However, its elements must be arrays if they are to be flattened. Examples. Flattening nested arrays. const arr1 = [ ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t think
fuse.js
can understand the structure of your array as it is, but I was able to search it by transforming it first.For example, given your array of arrays, of type
string[][]
:You can map them first, to type
{ foo: string[] }[]
, e.g.:… and then feed that to
fuse.js
, like so:The results would look like this:
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days