Comments (1)
Hi @valgeirb,
Would this work?
const objList = [
{name: 'Janice', color: 'Green', active: false},
{name: 'Fred', color: 'Orange', active: true},
{name: 'George', color: 'Blue', active: true},
{name: 'Jen', color: 'Red', active: false},
]
objList.filter(o => o.active)
:)
Then you can pass the result of that to match-sorter to match on the other properties:
const objList = [
{name: 'Janice', color: 'Green', active: false},
{name: 'Fred', color: 'Orange', active: true},
{name: 'George', color: 'Blue', active: true},
{name: 'Jen', color: 'Red', active: false},
]
matchSorter(objList.filter(o => o.active), 'jn', {keys: ['name', 'color']})
// [{name: 'Janice', color: 'Green', active: false}, {name: 'Jen', color: 'Red', active: false}]
I hope that helps!
from match-sorter.
Related Issues (20)
- Base sort should still be applied if the search string is empty HOT 3
- How to ignore caseRank while sorting? HOT 11
- Match sorter
- Issue with types for nested keys HOT 2
- Unable to import match sorter from versions 5.0.0+ HOT 1
- match fails under certain conditions when keys use different thresholds
- No matches when apostrophe mismatch HOT 1
- `matchSorter` does not accept readonly arrays. HOT 3
- What is the maximum array count for this sorter to perform well? HOT 3
- Return NO_MATCH Items in Alphabetical Order based on Keys HOT 1
- Can't figure out how to generate keys for use with recursive data HOT 3
- Question: Multiple search terms and OR results
- error TS7016: Could not find a declaration file for module 'match-sorter'. '...../node_modules/match-sorter/dist/match-sorter.cjs.js' HOT 4
- Question: ENDS WITH Do you have a match? HOT 1
- Sort array of objects by array of indexes? HOT 1
- Feature request: export `match` and `sort` functions
- feat: return matched pos HOT 2
- Defer the assignment of `matchSorter.rankings` HOT 2
- number and range filter ???
- Consider the usage of `hasOwn` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from match-sorter.