ember-source
Version:
A JavaScript framework for creating ambitious web applications
41 lines (35 loc) • 1.45 kB
JavaScript
import { o as opcodes } from '../../shared-chunks/opcodes-CplRyHl_.js';
export { W as WellKnownAttrNames, a as WellKnownTagNames } from '../../shared-chunks/well-known-_EVO9RaV.js';
const resolution = {
Strict: 0,
ResolveAsComponentOrHelperHead: 1,
ResolveAsHelperHead: 5,
ResolveAsModifierHead: 6,
ResolveAsComponentHead: 7
};
function is(variant) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return function (value) {
return Array.isArray(value) && value[0] === variant;
};
}
// Statements
const isFlushElement = is(opcodes.FlushElement);
function isAttribute(val) {
return val[0] === opcodes.StaticAttr || val[0] === opcodes.DynamicAttr || val[0] === opcodes.TrustingDynamicAttr || val[0] === opcodes.ComponentAttr || val[0] === opcodes.StaticComponentAttr || val[0] === opcodes.TrustingComponentAttr || val[0] === opcodes.AttrSplat || val[0] === opcodes.Modifier;
}
function isStringLiteral(expr) {
return typeof expr === 'string';
}
function getStringFromValue(expr) {
return expr;
}
function isArgument(val) {
return val[0] === opcodes.StaticArg || val[0] === opcodes.DynamicArg;
}
function isHelper(expr) {
return Array.isArray(expr) && expr[0] === opcodes.Call;
}
// Expressions
const isGet = is(opcodes.GetSymbol);
export { opcodes as SexpOpcodes, resolution as VariableResolutionContext, getStringFromValue, is, isArgument, isAttribute, isFlushElement, isGet, isHelper, isStringLiteral };