12345678910111213141516171819202122232425262728 |
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.getPropertyByPath = getPropertyByPath;
- function getPropertyByPath(source, path) {
- if (typeof path === 'string' && Object.prototype.hasOwnProperty.call(source, path)) {
- return source[path];
- }
- const parsedPath = typeof path === 'string' ? path.split('.') : path;
- return parsedPath.reduce((previous, key) => {
- if (previous === undefined) {
- return previous;
- }
- return previous[key];
- }, source);
- }
|