UNPKG

@nerdware/ddb-single-table

Version:

A schema-based DynamoDB modeling tool, high-level API, and type-generator built to supercharge single-table designs!⚡

16 lines (15 loc) 621 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.hasDefinedProperty = void 0; const ts_type_safety_utils_1 = require("@nerdware/ts-type-safety-utils"); /** * A type-guard which returns a boolean indicating whether the following are all true: * * 1. `obj` is a truthy object * 2. `obj` has the provided `key` as an own-property * 3. `obj[key]` is neither `null` nor `undefined` */ const hasDefinedProperty = (obj, key) => { return (0, ts_type_safety_utils_1.hasKey)(obj, key) && obj[key] !== null && obj[key] !== undefined; }; exports.hasDefinedProperty = hasDefinedProperty;