There was an error while loading. Please reload this page.
Segregate entries by test result.
Similar: partition, partitionAs. Similar: partition, chunk.
function partition(x, ft) // x: an object // ft: test function (v, k, x)
const object = require('extra-object'); var x = {a: 1, b: 2, c: 3, d: 4}; object.partition(x, v => v % 2 == 0); // → [ { b: 2, d: 4 }, { a: 1, c: 3 } ] var x = {a: 1, b: 2, c: 3, d: 4, e: 5}; object.partition(x, v => v % 2 == 1); // → [ { a: 1, c: 3, e: 5 }, { b: 2, d: 4 } ]