UNPKG

ractive-ez-combobox

Version:
30 lines (24 loc) 679 B
const utils = { prop1(path) { return (obj) => obj ? obj[path] : null; }, prop(path) { const chain = path.split("."); if (chain.length == 1) return utils.prop1(path); return (obj) => { for (var i = 0; i < chain.length; i++) { if (obj) obj = obj[chain[i]]; } return obj; } }, compare(a, b) { return a == b; }, filter(text, value) { return (typeof(text) == "string") && (typeof(value) == "string") && (value.toLowerCase().indexOf(text.toLowerCase()) == 0); } }; export default utils;