"use strict";
/*!
 * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
 * Licensed under the MIT License.
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.getMapTreeField = void 0;
/**
 * Get a field from `node`, optionally modifying the tree to create it if missing.
 */
function getMapTreeField(node, key, createIfMissing) {
    const field = node.fields.get(key);
    if (field !== undefined) {
        return field;
    }
    // Handle missing field:
    if (createIfMissing === false) {
        return [];
    }
    const newField = [];
    node.fields.set(key, newField);
    return newField;
}
exports.getMapTreeField = getMapTreeField;
//# sourceMappingURL=mapTree.js.map