From edb7d5d5741cd6291df61c4c2db5fa6c079143bb Mon Sep 17 00:00:00 2001 From: Dziad Borowy Date: Wed, 19 Jun 2024 09:49:59 +0100 Subject: [PATCH] default value for getValueAtPath --- src/utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils.js b/src/utils.js index dc55dc1..90d50e2 100644 --- a/src/utils.js +++ b/src/utils.js @@ -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