@supunlakmal/hooks
Version:
A collection of reusable React hooks
26 lines • 895 B
JavaScript
export function on(object, ...args) {
var _a;
(_a = object === null || object === void 0 ? void 0 : object.addEventListener) === null || _a === void 0 ? void 0 : _a.call(object, ...args);
}
export function off(object, ...args) {
var _a;
(_a = object === null || object === void 0 ? void 0 : object.removeEventListener) === null || _a === void 0 ? void 0 : _a.call(object, ...args);
}
export const hasOwnProperty = (object, property) => Object.hasOwn(object, property);
export const yieldTrue = () => true;
export const yieldFalse = () => false;
export const basicDepsComparator = (d1, d2) => {
if (d1 === d2) {
return true;
}
if (d1.length !== d2.length) {
return false;
}
for (const [i, element] of d1.entries()) {
if (element !== d2[i]) {
return false;
}
}
return true;
};
//# sourceMappingURL=misc.js.map