Published
Edited
Feb 8, 2018
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
stdlib = require( "https://unpkg.com/@stdlib/stdlib@0.0.32/dist/stdlib-flat.min.js" )
Insert cell
Insert cell
Insert cell
Insert cell
collection = [ 'beep', 'boop', 'foo', 'bar' ]
Insert cell
Insert cell
filter = [ true, true, false, true ]
Insert cell
Insert cell
groups = stdlib.bifurcate( collection, filter )
Insert cell
Insert cell
groups[ 0 ]
Insert cell
groups[ 1 ]
Insert cell
Insert cell
indices = stdlib.bifurcate( collection, { 'returns': 'indices' }, filter )
Insert cell
Insert cell
groups2 = stdlib.bifurcate( collection, { 'returns': '*' }, filter )
Insert cell
Insert cell
Insert cell
function predicate( v, i ) {
if ( v[ 0 ] === 'b' ) {
return true;
}
return false;
}
Insert cell
Insert cell
groups3 = stdlib.bifurcateBy( collection, predicate )
Insert cell
groups3[ 0 ]
Insert cell
groups3[ 1 ]
Insert cell
Insert cell
indices2 = stdlib.bifurcateBy( collection, { 'returns': 'indices' }, predicate )
Insert cell
Insert cell
groups4 = stdlib.bifurcateBy( collection, { 'returns': '*' }, predicate )
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more