Skip to content

Instantly share code, notes, and snippets.

View mxlje's full-sized avatar
🌩️

Max Lielje mxlje

🌩️
View GitHub Profile
@mxlje
mxlje / underscore.move.js
Last active August 26, 2015 17:53 — forked from kjantzer/underscore.move.js
Underscore.js Mixin: Move - takes array and moves item at index and moves to another index; great for use with jQuery.sortable()
/*
_.move - takes array and moves item at index and moves to another index; great for use with jQuery.sortable()
*/
_.mixin({
move: function (array, fromIndex, toIndex) {
array.splice(toIndex, 0, array.splice(fromIndex, 1)[0] );
return array;
}