Open cneumann opened 4 years ago
This was a really annoying one to figure out. Please don't modify arguments unless you really need to (or at least document it) :slightly_smiling_face:
FYI the sneaky modification seems to be in src/io/rgb/index.js
:
input.format.rgb = (...args) => {
const rgba = unpack(args, 'rgba');
if (rgba[3] === undefined) rgba[3] = 1;
return rgba;
};
This code may be assuming the return from unpack()
is a copy of the args and safe to modify, but in the case of an array it just returns it as-is.
In this snippet:
the input array
inRGB
is modified, a fourth element with value 1 is added as well as_clipped
and_unclipped
properties. I'm not sure if that is expected or intended, but I found it surprising and think a warning in the documentation would be good.A workaround is to spread the input array: