Skip to content

Instantly share code, notes, and snippets.

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 ELLIOTTCABLE/597bfbcb6941bf4875975257bf28e8ff to your computer and use it in GitHub Desktop.
Save ELLIOTTCABLE/597bfbcb6941bf4875975257bf28e8ff to your computer and use it in GitHub Desktop.
function prots(o, rest = []) {
return o && (o = Object.getPrototypeOf(o)) === rest[0]
? rest
: rest.unshift(o) && prots(o, rest)
}
function common(a, b) {
return (b = prots(b)) && prots(a).filter((prot, i)=>
prot === b[i])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment