Skip to content

Instantly share code, notes, and snippets.

@ascott
Last active March 23, 2017 02:07
Show Gist options
  • Save ascott/48f5b93ef90b00fa343892d39a5a85bf to your computer and use it in GitHub Desktop.
Save ascott/48f5b93ef90b00fa343892d39a5a85bf to your computer and use it in GitHub Desktop.
get long list of options to test select performance
// get long list of options to test select performance
function getFakeTableOptions(numOptions) {
let counter = 0;
let options = [];
const prefixes = ['foo', 'bar', 'baz', 'zeb', 'alpha', 'beta', 'xylo', 'superfragilistic',
'quick', 'brown', 'fox', 'jumped', 'over', 'lazy', 'dog', 'yak', 'cucumber'];
while (counter < numOptions) {
const label = `${prefixes[Math.floor(Math.random() * prefixes.length)]}--${counter}`;
options.push({ label: label, value: label });
counter++;
}
return options;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment