Created
February 6, 2023 16:18
-
-
Save Lahirutech/b4b6087e1d8b1dc4f698801babab6f5f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function searchObjectArray(players, searchString, keys) { | |
return players.filter(player => { | |
return keys.some(key => { | |
return getValueFromKey(player, key).toString().toLowerCase().includes(searchString); | |
}); | |
}); | |
} | |
function getValueFromKey(object, key) { | |
return key.split(".").reduce((o, i) => o[i], object); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment