UNPKG

custom-automapper

Version:

A powerful, type-safe object mapping library for TypeScript and NestJS

18 lines 604 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getPropertyByPath = getPropertyByPath; exports.setPropertyByPath = setPropertyByPath; function getPropertyByPath(obj, path) { return path.split('.').reduce((acc, key) => acc?.[key], obj); } function setPropertyByPath(obj, path, value) { const keys = path.split('.'); const lastKey = keys.pop(); const target = keys.reduce((acc, key) => { if (!acc[key]) acc[key] = {}; return acc[key]; }, obj); target[lastKey] = value; } //# sourceMappingURL=property-path.util.js.map