Simple Underscore.js mixin to insert elements into an array at specific points
InsertAt is a very simple mixin for Underscore. The idea is to provide you with an easy way to insert items into an array at a specific index. This was something I threw together for some of my work on SPIN and thought I'd share it.
The function is easy enough to use.
var a = 'figs' 'ash' 'oreo';a = _insertAta 'mooch' 2;console.loga; // ['figs', 'ash', 'mooch', 'oreo']
If you don't want to use Underscore (weirdo), you can just call the function insertAt().
To run tests, make sure you run
from within the directory to install development dependencies. Then run the following: