{{alias}}( obj, [options,] predicate ) Splits values into two groups according to a predicate function. When invoked, the predicate function is provided two arguments: - `value`: object value - `key`: object key If a predicate function returns a truthy value, a value is placed in the first group; otherwise, a value is placed in the second group. If provided an empty object with no prototype, the function returns an empty array. The function iterates over an object's own and inherited properties. Key iteration order is *not* guaranteed, and, thus, result order is *not* guaranteed. Parameters ---------- obj: Object|Array|TypedArray Input object to group. options: Object (optional) Options. options.thisArg: any (optional) Execution context. options.returns: string (optional) If `values`, values are returned; if `keys`, keys are returned; if `*`, both keys and values are returned. Default: 'values'. predicate: Function Predicate function indicating which group a value in the input object belongs to. Returns ------- out: Array|Array Group results. Examples -------- > function Foo() { this.a = 'beep'; this.b = 'boop'; return this; }; > Foo.prototype = Object.create( null ); > Foo.prototype.c = 'foo'; > Foo.prototype.d = 'bar'; > var obj = new Foo(); > function predicate( v ) { return v[ 0 ] === 'b'; }; > var out = {{alias}}( obj, predicate ) [ [ 'beep', 'boop', 'bar' ], [ 'foo' ] ] // Output group results as keys: > var opts = { 'returns': 'keys' }; > out = {{alias}}( obj, opts, predicate ) [ [ 'a', 'b', 'd' ], [ 'c' ] ] // Output group results as key-value pairs: > opts = { 'returns': '*' }; > out = {{alias}}( obj, opts, predicate ) [ [ ['a', 'beep'], ['b', 'boop'], ['d', 'bar'] ], [ ['c', 'foo' ] ] ] See Also --------