@react-hookz/web
Version:
React hooks done right, for browser and SSR.
24 lines (23 loc) • 1.06 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.truthyOrArrayPredicate = exports.truthyAndArrayPredicate = exports.isStrictEqual = exports.isBrowser = exports.noop = void 0;
var noop = function () { };
exports.noop = noop;
exports.isBrowser = typeof window !== 'undefined' &&
typeof navigator !== 'undefined' &&
typeof document !== 'undefined';
/**
* You should only be reaching for this function when you're attempting to prevent multiple
* redefinitions of the same function. In-place strict equality checks are more performant.
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
var isStrictEqual = function (prev, next) { return prev === next; };
exports.isStrictEqual = isStrictEqual;
var truthyAndArrayPredicate = function (conditions) {
return conditions.every(Boolean);
};
exports.truthyAndArrayPredicate = truthyAndArrayPredicate;
var truthyOrArrayPredicate = function (conditions) {
return conditions.some(Boolean);
};
exports.truthyOrArrayPredicate = truthyOrArrayPredicate;