Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // In obj put the object that holds all the translations
- // Term is the string to search by
- let findTranslation = (obj, term) =>
- Object.keys(obj)
- .filter(word => obj[word].startsWith(term))
- .map(key => ({[key]: obj[key]}))
- let findTranslationAnyMatch = (obj, term) =>
- Object.keys(obj)
- .filter(word => obj[word].toLowerCase().includes(term.toLowerCase()))
- .map(key => ({[key]: obj[key]}))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement