Created
October 31, 2017 12:45
-
-
Save getanwar/c445b2213b8865b13892a76e8b65b9ea to your computer and use it in GitHub Desktop.
Helper functions for VanillaJS
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
/* | |
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