Skip to content

Instantly share code, notes, and snippets.

@ryanve
Created April 19, 2020 05:17
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 ryanve/70b1edf9937d7ce569ad4dc8466e1be0 to your computer and use it in GitHub Desktop.
Save ryanve/70b1edf9937d7ce569ad4dc8466e1be0 to your computer and use it in GitHub Desktop.
Create fresh pure new array from the indexes of an array or object based on the length
function pure(like) {
var fresh = []
var i = ~~like.length
while (i-->0) fresh[i] = like[i]
return fresh
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment