UNPKG

typedash

Version:

modern, type-safe collection of utility functions

27 lines (23 loc) 578 B
'use strict'; // src/functions/hasKey/hasKey.ts function hasKey(value, key) { if (typeof value !== "object" || value == null) { return false; } return key in value; } // src/functions/isArray/isArray.ts var isArray = Array.isArray; // src/functions/get/get.ts function get(object, path) { const keys = isArray(path) ? path : path.split("."); return keys.reduce((value, key) => { if (hasKey(value, key)) { return value[key]; } return void 0; }, object); } exports.get = get; //# sourceMappingURL=out.js.map //# sourceMappingURL=index.cjs.map