Skip to content

Commit

Permalink
default value for getValueAtPath
Browse files Browse the repository at this point in the history
  • Loading branch information
tborychowski committed Jun 19, 2024
1 parent 78fd303 commit edb7d5d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ export function deepCopy (o) {
/**
* Get a value from an object for a given path
* @param obj {object}
* @param path {string} - e.g. child[4]['some name][2].property
* @param path {string} - e.g. child[4]['some name'][2].property
* @param defaultValue {*}
* @returns {*}
*/
export function getValueAtPath (obj, path, defaultValue) {
export function getValueAtPath (obj, path, defaultValue = null) {
try {
return path
.replace(/^\./, '') // strip a leading dot
Expand Down

0 comments on commit edb7d5d

Please sign in to comment.