Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// `instruction` corresponds to the root router
while (isPresent(router.parent) && isPresent(instruction.child)) {
router = router.parent;
instruction = instruction.child;
}
if (isBlank(instruction.component) || isBlank(this.currentInstruction.component) ||
this.currentInstruction.component.routeName != instruction.component.routeName) {
return false;
}
let paramEquals = true;
if (isPresent(this.currentInstruction.component.params)) {
StringMapWrapper.forEach(instruction.component.params, (value, key) => {
if (this.currentInstruction.component.params[key] !== value) {
paramEquals = false;
}
});
}
return paramEquals;
}
_createDirectivePropertyAsts(directiveProperties, boundProps, targetBoundDirectiveProps) {
if (isPresent(directiveProperties)) {
var boundPropsByName = new Map();
boundProps.forEach(boundProp => {
var prevValue = boundPropsByName.get(boundProp.name);
if (isBlank(prevValue) || prevValue.isLiteral) {
// give [a]="b" a higher precedence than a="b" on the same element
boundPropsByName.set(boundProp.name, boundProp);
}
});
StringMapWrapper.forEach(directiveProperties, (elProp, dirProp) => {
var boundProp = boundPropsByName.get(elProp);
// Bindings are optional, so this binding only needs to be set up if an expression is given.
if (isPresent(boundProp)) {
targetBoundDirectiveProps.push(new BoundDirectivePropertyAst(dirProp, boundProp.name, boundProp.expression, boundProp.sourceSpan));
}
});
}
}
_createElementPropertyAsts(elementName, props, directives) {
_createDirectiveHostPropertyAsts(elementName, hostProps, sourceSpan, targetPropertyAsts) {
if (isPresent(hostProps)) {
StringMapWrapper.forEach(hostProps, (expression, propName) => {
var exprAst = this._parseBinding(expression, sourceSpan);
targetPropertyAsts.push(this._createElementPropertyAst(elementName, propName, exprAst, sourceSpan));
});
}
}
_createDirectiveHostEventAsts(hostListeners, sourceSpan, targetEventAsts) {
_createDirectiveHostPropertyAsts(elementName, hostProps, sourceSpan, targetPropertyAsts) {
if (isPresent(hostProps)) {
StringMapWrapper.forEach(hostProps, (expression, propName) => {
var exprAst = this._parseBinding(expression, sourceSpan);
targetPropertyAsts.push(this._createElementPropertyAst(elementName, propName, exprAst, sourceSpan));
});
}
}
_createDirectiveHostEventAsts(hostListeners, sourceSpan, targetEventAsts) {
maps.forEach((map) => { StringMapWrapper.forEach(map, (value, key) => { result[key] = value; }); });
return result;
_createDirectiveHostPropertyAsts(elementName, hostProps, sourceSpan, targetPropertyAsts) {
if (isPresent(hostProps)) {
StringMapWrapper.forEach(hostProps, (expression, propName) => {
var exprAst = this._parseBinding(expression, sourceSpan);
targetPropertyAsts.push(this._createElementPropertyAst(elementName, propName, exprAst, sourceSpan));
});
}
}
_createDirectiveHostEventAsts(hostListeners, sourceSpan, targetEventAsts) {
function _mergeMaps(target: Map, config: Map): void {
StringMapWrapper.forEach(config, (v, k) => MapWrapper.set(target, k, v));
}
return instruction.resolveComponent().then((_) => {
var unsettledInstructions = [];
if (isPresent(instruction.component)) {
instruction.component.reuse = false;
}
if (isPresent(instruction.child)) {
unsettledInstructions.push(this._settleInstruction(instruction.child));
}
StringMapWrapper.forEach(instruction.auxInstruction, (instruction, _) => {
unsettledInstructions.push(this._settleInstruction(instruction));
});
return PromiseWrapper.all(unsettledInstructions);
});
}
maps.forEach((map) => { StringMapWrapper.forEach(map, (value, key) => { result[key] = value; }); });
return result;
function _mergeMaps(target: Map, config: {[key: string]: Function}): void {
StringMapWrapper.forEach(config, (v: Function, k: string) => target.set(k, v));
}