flip
Flip the value of a boolean without having to reference it twice.
Quick Example:
import { flip } from "tsafe/flip";
const obj = {
is_: false,
};
flip(obj, "is_");
//obj.is_ is now set to trueIn more detail:
const obj = {
innerObj: {
is_: false,
x: 44,
y: 33,
},
};
obj.innerObj.is_ = !obj.innerObj.is_;
Last updated
Was this helpful?