@adpt/core
Version:
AdaptJS core library
37 lines • 1.32 kB
JavaScript
;
/*
* Copyright 2018-2019 Unbounded Systems, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
const util_1 = require("util");
const ts_1 = require("../ts");
function stack(stackName, root, style = null) {
const stacks = ts_1.getAdaptContext().adaptStacks;
if (isNullStack(stackName))
throw new Error(`Invalid stack name "${stackName}"`);
stacks.set(stackName, { root, style });
}
exports.stack = stack;
function nullStack() {
return { root: null, style: null };
}
exports.nullStack = nullStack;
function isNullStack(s) {
if (util_1.isString(s))
return s === "(null)";
return s.root === null && s.style === null;
}
exports.isNullStack = isNullStack;
//# sourceMappingURL=stack.js.map