src/utils/index.js
// Each coordinate within the transfer function must be between (0,0) and (1,1)
Each coordinate within the transfer function must be between (0,0) and (1,1)
Each coordinate within the transfer function must be between ( 0 0 ) and ( 1 1 )
function validateTransferFunction(transferFunction) {
  transferFunction.forEach((point) => {
    if (point.x === undefined || point.x < 0 || point.x > 1)
      throw new Error(
        `Error: ${point.x} in ${point} out of range. ` +
          `x coordinate must be between 0 and 1 (inclusive)`
      );
    if (point.y === undefined || point.y < 0 || point.y > 1)
      throw new Error(
        `Error: ${point.y} in ${point} out of range. ` +
          `y coordinate must be between 0 and 1 (inclusive)`
      );
  });
}
function validateTransferFunction ( transferFunction ) { transferFunction . forEach ( ( point ) => { if ( point . x === undefined || point . x < 0 || point . x > 1 ) throw new Error ( ` ${ point . x } ${ point } ` + ` ` ) ; if ( point . y === undefined || point . y < 0 || point . y > 1 ) throw new Error ( ` ${ point . y } ${ point } ` + ` ` ) ; } ) ; }
Each coordinate within the transfer function must be between (0,0) and (1,1)
Each coordinate within the transfer function must be between ( 0 0 ) and ( 1 1 )