Skip to content
On this page

partition

Split the given array into those that match the conditions and those that don't.

Example

partition([1, 2, 3, 4, 5], (x) => x % 2 === 0) // => [[2, 4], [1, 3, 5]]

Playground

const { partition } = require('rhodash')
partition([1, 2, 3, 4, 5], (x) => x % 2 === 0) // => [[2, 4], [1, 3, 5]]