// 'use strict';// Resolves property names or property paths defined with period-delimited// strings or arrays of strings. Property names that are found on the source// object are used directly (even if they include a period).// Nested property names that include periods, within a path, are only// understood in array paths.functiongetPropertyByPath(source,path){if(typeofpath==='string'&&source.hasOwnProperty(path)){returnsource[path];}constparsedPath=typeofpath==='string'?path.split('.'):path;returnparsedPath.reduce((previous,key)=>{if(previous===undefined){returnprevious;}returnprevious[key];},source);}module.exports=getPropertyByPath;