aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--interpolate.js6
1 files 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