UNPKG

selecton

Version:

Selecton.js combines a searchbar and a dropdown menu with nested child lists.

29 lines (16 loc) 449 B
export default function(keyArr, arr){ var sorted = []; keyArr.forEach(function(key) { var found = false; arr = arr.filter(function(item) { if(!found && item.key === key) { delete item._temporarilyHighlighted_; sorted.push(item); found = true; return false; } return true; }); }); return sorted; }