UNPKG

type-fns

Version:

A set of types, type checks, and type guards for simpler, safer, and easier to read code.

30 lines 832 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.hasMetadata = void 0; /** * these are the keys most commonly used metadata keys */ const typicalMetadataKeys = [ 'id', 'uuid', 'createdAt', 'updatedAt', 'deletedAt', 'effectiveAt', ]; /** * for an object of type T, asserts that the object HasMetadata<T, K> for all listed metadata keys K * * by default, the following keys are considered to be metadata: * - `id` * - `uuid` * - `createdAt` * - `updatedAt` * - `deletedAt` * - `effectiveAt` * * see more information about the `HasMetadata` type in its jsdoc on-hover documentation */ const hasMetadata = (obj, keys = typicalMetadataKeys) => keys.every((key) => obj[key] !== undefined); exports.hasMetadata = hasMetadata; //# sourceMappingURL=hasMetadata.js.map