Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
params!.length === 1
);
if (DEBUG && hash) {
let keys = hash[0];
let extra = keys.filter(k => k !== 'model');
assert(
'You can only pass a `model` argument to the {{mount}} helper, ' +
'e.g. {{mount "profile-engine" model=this.profile}}. ' +
`You passed ${extra.join(',')}.`,
extra.length === 0
);
}
let expr: WireFormat.Expressions.Helper = [WireFormat.Ops.Helper, '-mount', params || [], hash];
builder.dynamicComponent(expr, null, [], null, false, null, null);
return true;
}
export function outletMacro(
_name: string,
params: Option,
hash: Option,
builder: OpcodeBuilder
) {
let expr: WireFormat.Expressions.Helper = [WireFormat.Ops.Helper, '-outlet', params || [], hash];
builder.dynamicComponent(expr, null, [], null, false, null, null);
return true;
}
dynamic(name: string, value: FunctionExpression) {
this.buffer.push([Ops.DynamicAttr, name, [Ops.ClientSideExpression, ClientSide.Ops.FunctionExpression, value], null]);
}
}
dynamicAttr(name: str, namespace: str) {
let value = this.popValue();
this.push([Ops.DynamicAttr, name, value, namespace]);
}
staticAttr(name: str, namespace: str) {
let value = this.popValue();
this.push([Ops.StaticAttr, name, value, namespace]);
}
static(name: string, value: string) {
this.buffer.push([Ops.StaticAttr, name, value, null]);
}
append(trusted: boolean) {
this.push([Ops.Append, this.popValue(), trusted]);
}
arg(path: string[]) {
this.template.block.named.add(path[0]);
this.pushValue([Ops.Arg, path]);
}
block(path: Path, template: number, inverse: number) {
let params = this.popValue();
let hash = this.popValue();
let blocks = this.template.block.blocks;
assert(typeof template !== 'number' || blocks[template] !== null, 'missing block in the compiler');
assert(typeof inverse !== 'number' || blocks[inverse] !== null, 'missing block in the compiler');
this.push([Ops.Block, path, params, hash, blocks[template], blocks[inverse]]);
}
closeElement(tag: str) {
if (tag.indexOf('-') !== -1) {
let component = this.endComponent();
this.push([Ops.Component, tag, component]);
} else {
this.push([Ops.CloseElement]);
}
}