Skip to content

Instantly share code, notes, and snippets.

@songz
Created October 18, 2017 20:27
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 songz/a6192deb4b03e10de5628b69b8fd64dd to your computer and use it in GitHub Desktop.
Save songz/a6192deb4b03e10de5628b69b8fd64dd to your computer and use it in GitHub Desktop.
const isInterval = (input, ival, i=0) => {
if(i===input.length) return false;
const curInt = input[i];
if(ival[0] > curInt[0] && ival[0] < curInt[1]
|| ival[1]<curInt[1] && ival[1] > curInt[0]) return true;
return isInterval(input, ival, i+1);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment