Quantumbraid's picture
download
raw
721 Bytes
/* eslint-disable no-param-reassign */
import type * as React from "react";
export function assignRef<T>(
ref:
| ((value: T | null) => void)
| React.MutableRefObject<T | null>
| null
| undefined,
value: T | null,
): void {
if (ref == null) return;
if (typeof ref === "function") {
ref(value);
} else {
ref.current = value;
}
}
export function mergeRefs<T = any>(
refs: Array<React.MutableRefObject<T> | React.LegacyRef<T>>,
): React.RefCallback<T> {
return (value) => {
refs.forEach((ref) => {
if (typeof ref === "function") {
ref(value);
} else if (ref != null) {
(ref as React.MutableRefObject<T | null>).current = value;
}
});
};
}

Xet Storage Details

Size:
721 Bytes
·
Xet hash:
c661b0cf50d231d9a1f0621432e2023c4fcf97f5bd33fe9268649d9d847c6fba

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.