@kui-shell/plugin-wskflow
Version:
Visualizations for Composer apps
69 lines • 2.13 kB
JavaScript
/*
* Copyright 2019 The Kubernetes Authors
*
* 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.
*/
export function isLiteral(ast) {
return ast.type === 'literal' || ast.type === 'value';
}
export function isConditional(ast) {
return ast.type === 'if';
}
export function isWhile(ast) {
return ast.type === 'while' || ast.type === 'while_nosave';
}
export function isDoWhile(ast) {
return ast.type === 'dowhile' || ast.type === 'dowhile_nosave';
}
export function isTry(ast) {
return ast.type === 'try';
}
export function isAction(ast) {
return ast.type === 'action';
}
export function isFunction(ast) {
return ast.type === 'function';
}
export function isFinally(ast) {
return ast.type === 'finally';
}
export function isOn(ast) {
return ast.type === 'on';
}
export function isRetryOrRepeat(ast) {
return ast.type === 'retry' || ast.type === 'repeat';
}
export function isLet(ast) {
return ast.type === 'let';
}
export function isSequence(ast) {
return ast.type === 'sequence' || ast.type === 'seq';
}
export function isRetain(ast) {
return ast.type === 'retain';
}
export function isComponentBearing(ast) {
const cb = ast;
return typeof cb.components === 'object';
}
export function isComponentArrayBearing(ast) {
const cb = ast;
return Array.isArray(cb.components) && cb.components.length > 0;
}
export function isParallelLike(ast) {
return ast.type === 'parallel' || ast.type === 'par' || ast.type === 'map' || ast.type === 'forall';
}
export function isMapLike(ast) {
return ast.type === 'map' || ast.type === 'forall';
}
//# sourceMappingURL=ast.js.map