src/expression/transform/filter.transform.js
function _filter (x, callback) {
  // figure out what number of arguments the callback function expects
  const args = maxArgumentCount(callback)

  return filter(x, function (value, index, array) {
    // invoke the callback function with the right number of arguments
    if (args === 1) {
      return callback(value)
    } else if (args === 2) {
      return callback(value, [index + 1])
    } else { // 3 or -1
      return callback(value, [index + 1], array)
    }
  })
}
function _filter (x, callback) {
  // figure out what number of arguments the callback function expects
  const args = maxArgumentCount(callback)

  return filter(x, function (value, index, array) {
    // invoke the callback function with the right number of arguments
    if (args === 1) {
      return callback(value)
    } else if (args === 2) {
      return callback(value, [index + 1])
    } else { // 3 or -1
      return callback(value, [index + 1], array)
    }
  })
}
function _filter ( x , callback ) { // figure out what number of arguments the callback function expects const args = maxArgumentCount ( callback ) return filter ( x , function ( value , index , array ) { // invoke the callback function with the right number of arguments if ( args === 1 ) { return callback ( value ) } else if ( args === 2 ) { return callback ( value , [ index + 1 ] ) } else { // 3 or -1 return callback ( value , [ index + 1 ] , array ) } } ) }
Filter values in a callback given a callback function

!!! Passes a one-based index !!!

@param {Array} x
@param {Function} callback
@return {Array} Returns the filtered array
@private
Filter values in a callback given a callback function