js 数组项通过条件分组
const bifurcate = (arr, filter) =>
arr.reduce((acc, val, i) => (acc[filter[i] ? 0 : 1].push(val), acc), [[], []])
// EXAMPLES
bifurcate(['beep', 'boop', 'foo', 'bar'], [true, true, false, true])
// [ ['beep', 'boop', 'bar'], ['foo'] ]