lib/array-tools.js
function spliceWhile (array, index, test) {
  for (var i = 0; i < array.length; i++) {
    if (!testValue(array[i], test)) break
  }
  var spliceArgs = [ index, i ]
  spliceArgs = spliceArgs.concat(arrayify(arguments).slice(3))
  return array.splice.apply(array, spliceArgs)
}
function spliceWhile (array, index, test) {
  for (var i = 0; i < array.length; i++) {
    if (!testValue(array[i], test)) break
  }
  var spliceArgs = [ index, i ]
  spliceArgs = spliceArgs.concat(arrayify(arguments).slice(3))
  return array.splice.apply(array, spliceArgs)
}
function spliceWhile ( array , index , test ) { for ( var i = 0 ; i < array . length ; i ++ ) { if ( ! testValue ( array [ i ] , test ) ) break } var spliceArgs = [ index , i ] spliceArgs = spliceArgs . concat ( arrayify ( arguments ) . slice ( 3 ) ) return array . splice . apply ( array , spliceArgs ) }
Splice items from the input array until the matching test fails. Returns an array containing the items removed.

@param array {Array} - the input array
@param index {number} - the position to begin splicing from
@param test {any} - the sequence of items passing this test will be removed
@param [elementN] {...*} - elements to add to the array in place
@returns {Array}
@category chainable
@static
@example
> function under10(n){ return n < 10; }
> numbers = [ 1, 2, 4, 6, 12 ]

> a.spliceWhile(numbers, 0, under10)
[ 1, 2, 4, 6 ]
> numbers
[ 12 ]

> countries = [ "Egypt", "Ethiopia", "France", "Argentina" ]

> a.spliceWhile(countries, 0, /^e/i)
[ 'Egypt', 'Ethiopia' ]
> countries
[ 'France', 'Argentina' ]
Splice items from the input array until the matching test fails . Returns an array containing the items removed .