Esri / Esri/adlib

Hierarchies with unmatched settings terminate early

Open
#53 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
9
Forks
5
PR merge metrics
No merged PRs in 30d

Description

When hierarchies are present and a match fails, processing terminates. E.g., in
```js
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();
```
adlib produces
```js
myOrg
https://www.arcgis.com/sharing/rest/content/items/28989a5ecc2d4b2fbf62ac0f5075b7ff/data
organization.name
```
--only the first `organization.name` is replaced.

If the defaults are removed,
```js
myOrg
{{organization.nonexistantproperty.sharedTheme.logo.small}}
myOrg
```
is produced as expected.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.