From 99f7ceddcd2ce99a8e2439b3a04e5a3ba236c64a Mon Sep 17 00:00:00 2001 From: Amine El Baghdadi <75886237+NoobJsPerson@users.noreply.github.com> Date: Sat, 15 May 2021 17:58:10 +0000 Subject: update interpolate.js --- interpolate.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/interpolate.js b/interpolate.js index 36cf2f8..443450e 100644 --- a/interpolate.js +++ b/interpolate.js @@ -3,11 +3,11 @@ const regex = /\${[^{]+}/g; export default function interpolate(template, variables, fallback) { return template.replace(regex, (match) => { const path = match.slice(2, -1).trim(); - return getObjPath(path, variables, fallback); + return getObjPath(path, variables); }); } //get the specified property or nested property of an object -function getObjPath(path, obj, fallback = '') { - return path.split('.').reduce((res, key) => res[key] || fallback, obj); +function getObjPath(path, obj) { + return path.split('.').reduce((res, key) => res[key], obj); } \ No newline at end of file -- cgit v1.2.3