(array, index)
| 17 | * @return {*} The item which was spliced (removed). |
| 18 | */ |
| 19 | var SpliceOne = function (array, index) |
| 20 | { |
| 21 | if (index >= array.length) |
| 22 | { |
| 23 | return; |
| 24 | } |
| 25 | |
| 26 | var len = array.length - 1; |
| 27 | |
| 28 | var item = array[index]; |
| 29 | |
| 30 | for (var i = index; i < len; i++) |
| 31 | { |
| 32 | array[i] = array[i + 1]; |
| 33 | } |
| 34 | |
| 35 | array.length = len; |
| 36 | |
| 37 | return item; |
| 38 | }; |
| 39 | |
| 40 | module.exports = SpliceOne; |
no outgoing calls
no test coverage detected
searching dependent graphs…