getPropertyByPath.js 512 B

1234567891011121314
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.getPropertyByPath = getPropertyByPath;
  6. // Resolves property names or property paths defined with period-delimited
  7. // strings or arrays of strings. Property names that are found on the source
  8. // object are used directly (even if they include a period).
  9. // Nested property names that include periods, within a path, are only
  10. // understood in array paths.
  11. function getPropertyByPath(source, path) {
  12. if (typeof path === 'stri