partition.js 326 B

1234567891011
  1. define(['./_group'], function (_group) {
  2. // Split a collection into two arrays: one whose elements all pass the given
  3. // truth test, and one whose elements all do not pass the truth test.
  4. var partition = _group(function(result, value, pass) {
  5. result[pass ? 0 : 1].push(value);
  6. }, true);
  7. return partition;
  8. });