Skip to content

Instantly share code, notes, and snippets.

@getanwar
Created October 31, 2017 12:45
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 getanwar/c445b2213b8865b13892a76e8b65b9ea to your computer and use it in GitHub Desktop.
Save getanwar/c445b2213b8865b13892a76e8b65b9ea to your computer and use it in GitHub Desktop.
Helper functions for VanillaJS
/*
Funciton Type: Array Function
Usage: Helps to clone an item next to it.
*/
Array.prototype.pushAfter = function(index, item) {
var deepClone = JSON.parse(JSON.stringify(item));
this.splice(index + 1, 0, deepClone);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment