Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
public queryStates(query: string): State[] {
query = query.toLowerCase();
if (query) {
const letters = query.split('').map(l => `${l}.*`).join('');
const regex = new RegExp(letters, 'ig');
return this.states.filter(s => !!;
} else {
// if no query, return first 10 states
return STATES.slice(0, 10);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment