1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 * Find Placeholders in the template and save them along with their
11 function findPlaceholders(template, constructor, path = [], placeholders = []) {
12 if (!template || typeof template != "object") {
16 if (template instanceof constructor) {
17 placeholders.push({ placeholder: template, path: [...path] });
21 for (const name in template) {
23 findPlaceholders(template[name], constructor, path, placeholders);
30 exports.findPlaceholders = findPlaceholders;
33 * Get the value at a given path, or undefined if not found.
35 function getPath(obj, path) {
36 for (const name of path) {
44 exports.getPath = getPath;