function fill(pxls, position, color, [width, height]) {
  let init = pxls[position];
  return bfs(
    position,
    ([x, y]) => [
      [x, y - 1],
      [x, y + 1],
      [x - 1, y],
      [x + 1, y],
    ],
    ([x, y]) =>
      x >= 0 && x < width && y >= 0 && y < height && pxls[[x, y]] === init
  ).reduce((o, pos) => {
    o[pos] = color;
    return o;
  }, Object.assign({}, pxls));
}
/**
 * fill - fill the contiguous area about the position with the color
 * pxls
 * position
 * color
 * dimensions - [width, height]
 */
fill the contiguous area about the position with the color
pxls
position
color
dimensions - [width, height]
fill the contiguous area about the position with the color pxls position color dimensions - [ width height ]
function fill(pxls, position, color, [width, height]) {
  let init = pxls[position];
  return bfs(
    position,
    ([x, y]) => [
      [x, y - 1],
      [x, y + 1],
      [x - 1, y],
      [x + 1, y],
    ],
    ([x, y]) =>
      x >= 0 && x < width && y >= 0 && y < height && pxls[[x, y]] === init
  ).reduce((o, pos) => {
    o[pos] = color;
    return o;
  }, Object.assign({}, pxls));
}
function fill ( pxls , position , color , [ width , height ] ) { let init = pxls [ position ] ; return bfs ( position , ( [ x , y ] ) => [ [ x , y - 1 ] , [ x , y + 1 ] , [ x - 1 , y ] , [ x + 1 , y ] , ] , ( [ x , y ] ) => x >= 0 && x < width && y >= 0 && y < height && pxls [ [ x , y ] ] === init ) . reduce ( ( o , pos ) => { o [ pos ] = color ; return o ; } , Object . assign ( { } , pxls ) ) ; }
fill - fill the contiguous area about the position with the color
 pxls
 position
 color
 dimensions - [width, height]
fill - fill the contiguous area about the position with the color pxls position color dimensions - [ width height ]