UNPKG

aurelia-dragula

Version:
24 lines (20 loc) 592 B
"use strict"; System.register([], function (_export, _context) { "use strict"; function moveBefore(array, itemMatcherFn, siblingMatcherFn) { var removedItem = remove(array, itemMatcherFn); var nextIndex = array.findIndex(siblingMatcherFn); array.splice(nextIndex >= 0 ? nextIndex : array.length, 0, removedItem); } _export("moveBefore", moveBefore); function remove(array, matcherFn) { var index = array.findIndex(matcherFn); if (index >= 0) { return array.splice(index, 1)[0]; } } return { setters: [], execute: function () {} }; });