Created
July 31, 2015 00:05
-
-
Save bendc/1ff4c9639b21f1ad735f to your computer and use it in GitHub Desktop.
Cross-browser cloneSet function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const cloneSet = (() => | |
new Set(new Set().add(1)).has(1) | |
? set => new Set(set) | |
: set => { | |
const clone = new Set(); | |
set.forEach(item => clone.add(item)); | |
return clone; | |
})(); |
Author
bendc
commented
Jul 31, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment