Skip to content

Instantly share code, notes, and snippets.

@RReverser
Last active February 5, 2016 23:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RReverser/1866cc73fd01606ba641 to your computer and use it in GitHub Desktop.
Save RReverser/1866cc73fd01606ba641 to your computer and use it in GitHub Desktop.
function *bitflags() {
for (let i = 1; i <= 31; i <<= 1) {
yield i;
}
throw new RangeError('Too many bitflags.');
}
const [STARTED, CLOSE_REQUESTED, PULLING, PULL_AGAIN, DISTURBED] = bitflags();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment