diff --git a/lib/adlib.js b/lib/adlib.js
index 1575acd..d34da94 100644
--- a/lib/adlib.js
+++ b/lib/adlib.js
@@ -93,9 +93,9 @@ export function adlib (template, settings, transforms = null) {
if (hbsEntries && hbsEntries.length) {
// console.log(`Got a ${hbsEntries.length} handlebar entries...`);
- let isStaticValue = false;
// iterate over the entries...
let values = hbsEntries.map((entry) => {
+ let isStaticValue = false;
// console.info(`Matched ${entry}...`);
// strip off the curlies and trim any leading/trailing whitespace...
let path = entry.replace(/{|}/g, '').trim();
diff --git a/test/adlib.tape.js b/test/adlib.tape.js
index f18e683..1b5506a 100644
--- a/test/adlib.tape.js
+++ b/test/adlib.tape.js
@@ -893,3 +893,40 @@ test('Adlib::Hierarchies:: last choice can be timestamp', (t) => {
t.equal(result.val, 1469803210000, 'should return as a number');
t.end();
})
+
+test('Adlib::Hierarchies:: missing value does not stop processing', (t) => {
+ let template = {
+ msg: '{{organization.name}}
{{organization.nonexistantproperty.sharedTheme.logo.small}}
{{organization.name}}',
+ }
+
+ var settings = {
+ organization: {
+ name: "myOrg"
+ }
+ };
+
+ let result = adlib(template, settings)
+
+ t.plan(1);
+ t.equal(result.msg, 'myOrg
{{organization.nonexistantproperty.sharedTheme.logo.small}}
myOrg');
+ t.end();
+})
+
+test('Adlib::Hierarchies:: missing value with defaults does not stop processing', (t) => {
+ let template = {
+ msg: '{{organization.name||My Community}}
{{organization.nonexistantproperty.sharedTheme.logo.small||https://www.arcgis.com/sharing/rest/content/items/28989a5ecc2d4b2fbf62ac0f5075b7ff/data}}
{{organization.name||My Community}}',
+ }
+
+ var settings = {
+ organization: {
+ name: "myOrg"
+ }
+ };
+
+ let result = adlib(template, settings)
+
+ t.plan(1);
+ t.equal(result.msg, 'myOrg
https://www.arcgis.com/sharing/rest/content/items/28989a5ecc2d4b2fbf62ac0f5075b7ff/data
myOrg');
+ t.end();
+})
+