Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default factory(function Basic({ middleware: { icache } }) {
const options = getOptions();
function getFilteredOptions(value: string | undefined) {
let matching: TimeUnits[] = [];
if (value) {
matching = options.filter((option) => {
const { hour, minute = 0 } = option;
const hours = hour >= 10 ? hour : `0${hour}`;
const minutes = minute >= 10 ? minute : `0${minute}`;
return `${hours}:${minutes}`.indexOf(value) === 0;
});
}
return matching.length ? matching : options;
}