function flip(pxls, vertical = false, [width, height]) {
  return Object.entries(pxls).reduce((o, [key, val]) => {
    let [x, y] = key.split(",").map(Number);
    let pos = [!vertical ? width - x - 1 : x, !vertical ? y : height - y - 1];
    o[pos] = val;
    return o;
  }, {});
}
/**
 * flip - rotate pxls about the center
 * pxls
 * vertical - <true> flip about the vertical axis (otherwise the horizontal)
 * dimensions - [width, height]
 */
rotate pxls about the center
pxls
vertical -  flip about the vertical axis (otherwise the horizontal)
dimensions - [width, height]
rotate pxls about the center pxls vertical - flip about the vertical axis ( otherwise the horizontal ) dimensions - [ width height ]
function flip(pxls, vertical = false, [width, height]) {
  return Object.entries(pxls).reduce((o, [key, val]) => {
    let [x, y] = key.split(",").map(Number);
    let pos = [!vertical ? width - x - 1 : x, !vertical ? y : height - y - 1];
    o[pos] = val;
    return o;
  }, {});
}
function flip ( pxls , vertical = false , [ width , height ] ) { return Object . entries ( pxls ) . reduce ( ( o , [ key , val ] ) => { let [ x , y ] = key . split ( "," ) . map ( Number ) ; let pos = [ ! vertical ? width - x - 1 : x , ! vertical ? y : height - y - 1 ] ; o [ pos ] = val ; return o ; } , { } ) ; }
flip - rotate pxls about the center
 pxls
 vertical - <true> flip about the vertical axis (otherwise the horizontal)
 dimensions - [width, height]
flip - rotate pxls about the center pxls vertical - <true > flip about the vertical axis ( otherwise the horizontal ) dimensions - [ width height ]