Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
17 lines
490 B
Plaintext
17 lines
490 B
Plaintext
const invisibleValues = new Set(["none", "hidden"]);
|
|
/**
|
|
* Returns a function that, when provided a progress value between 0 and 1,
|
|
* will return the "none" or "hidden" string only when the progress is that of
|
|
* the origin or target.
|
|
*/
|
|
function mixVisibility(origin, target) {
|
|
if (invisibleValues.has(origin)) {
|
|
return (p) => (p <= 0 ? origin : target);
|
|
}
|
|
else {
|
|
return (p) => (p >= 1 ? target : origin);
|
|
}
|
|
}
|
|
|
|
export { invisibleValues, mixVisibility };
|