Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function mapToKeyValueArray(data) {
var entryArray = [];
collection_1.StringMapWrapper.forEach(data, function (value, name) { entryArray.push([name, value]); });
// We need to sort to get a defined output order
// for tests and for caching generated artifacts...
collection_1.ListWrapper.sort(entryArray, function (entry1, entry2) { return lang_1.StringWrapper.compare(entry1[0], entry2[0]); });
var keyValueArray = [];
entryArray.forEach(function (entry) { keyValueArray.push([entry[0], entry[1]]); });
return keyValueArray;
}
function createViewTopLevelStmts(view, targetStatements) {
async_1.ObservableWrapper.subscribe(this._channelSource, function (msg) {
var listeners = null;
if (collection_1.StringMapWrapper.contains(msg, 'event')) {
var type = msg['event']['type'];
if (lang_1.StringWrapper.equals(type, "popstate")) {
listeners = _this._popStateListeners;
}
else if (lang_1.StringWrapper.equals(type, "hashchange")) {
listeners = _this._hashChangeListeners;
}
if (listeners !== null) {
var e = event_deserializer_1.deserializeGenericEvent(msg['event']);
// There was a popState or hashChange event, so the location object thas been updated
_this._location = _this._serializer.deserialize(msg['location'], serialized_types_1.LocationType);
listeners.forEach(function (fn) { return fn(e); });
}
}
});
}
AppView.prototype.init = function (rootNodesOrAppElements, allNodes, disposables, appElements) {
this.rootNodesOrAppElements = rootNodesOrAppElements;
this.allNodes = allNodes;
this.disposables = disposables;
this.appElements = appElements;
var localsMap = new collection_1.Map();
collection_1.StringMapWrapper.forEach(this.proto.templateVariableBindings, function (templateName, _) { localsMap.set(templateName, null); });
for (var i = 0; i < appElements.length; i++) {
var appEl = appElements[i];
var providerTokens = [];
if (lang_1.isPresent(appEl.proto.protoInjector)) {
for (var j = 0; j < appEl.proto.protoInjector.numberOfProviders; j++) {
providerTokens.push(appEl.proto.protoInjector.getProviderAtIndex(j).key.token);
}
}
collection_1.StringMapWrapper.forEach(appEl.proto.directiveVariableBindings, function (directiveIndex, name) {
if (lang_1.isBlank(directiveIndex)) {
localsMap.set(name, appEl.nativeElement);
}
else {
localsMap.set(name, appEl.getDirectiveAtIndex(directiveIndex));
}
});
this.renderer.setElementDebugInfo(appEl.nativeElement, new api_1.RenderDebugInfo(appEl.getInjector(), appEl.getComponent(), providerTokens, localsMap));
}
var parentLocals = null;
if (this.proto.type !== view_type_1.ViewType.COMPONENT) {
parentLocals =
lang_1.isPresent(this.containerAppElement) ? this.containerAppElement.parentView.locals : null;
}
if (this.proto.type === view_type_1.ViewType.COMPONENT) {
// Note: the render nodes have been attached to their host element
CompileDirectiveMetadata.create = function (_a) {
var _b = _a === void 0 ? {} : _a, type = _b.type, isComponent = _b.isComponent, dynamicLoadable = _b.dynamicLoadable, selector = _b.selector, exportAs = _b.exportAs, changeDetection = _b.changeDetection, inputs = _b.inputs, outputs = _b.outputs, host = _b.host, lifecycleHooks = _b.lifecycleHooks, providers = _b.providers, viewProviders = _b.viewProviders, queries = _b.queries, viewQueries = _b.viewQueries, template = _b.template;
var hostListeners = {};
var hostProperties = {};
var hostAttributes = {};
if (lang_1.isPresent(host)) {
collection_1.StringMapWrapper.forEach(host, function (value, key) {
var matches = lang_1.RegExpWrapper.firstMatch(HOST_REG_EXP, key);
if (lang_1.isBlank(matches)) {
hostAttributes[key] = value;
}
else if (lang_1.isPresent(matches[1])) {
hostProperties[matches[1]] = value;
}
else if (lang_1.isPresent(matches[2])) {
hostListeners[matches[2]] = value;
}
});
}
var inputsMap = {};
if (lang_1.isPresent(inputs)) {
inputs.forEach(function (bindConfig) {
// canonical syntax: `dirProp: elProp`
function buildMap(values) {
var res = collection_1.StringMapWrapper.create();
for (var i = 0; i < keys.length; ++i) {
collection_1.StringMapWrapper.set(res, keys[i], values[i]);
}
return res;
}
switch (keys.length) {
NgFormControl.prototype._isControlChanged = function (changes) {
return collection_1.StringMapWrapper.contains(changes, "form");
};
NgFormControl = __decorate([
Serializer.prototype.objectToMap = function (obj, type, data) {
var _this = this;
if (lang_1.isPresent(type)) {
var map = new collection_1.Map();
collection_1.StringMapWrapper.forEach(obj, function (val, key) { map.set(key, _this.deserialize(val, type, data)); });
return map;
}
else {
return collection_1.MapWrapper.createFromStringMap(obj);
}
};
Serializer.prototype._serializeLocation = function (loc) {
function Headers(headers) {
var _this = this;
if (headers instanceof Headers) {
this._headersMap = headers._headersMap;
return ;
}
this._headersMap = new collection_1.Map();
if (lang_1.isBlank(headers)) {
return ;
}
collection_1.StringMapWrapper.forEach(headers, function(v, k) {
_this._headersMap.set(k, collection_1.isListLikeIterable(v) ? v : [v]);
});
}
Headers.fromResponseHeaderString = function(headersString) {
DirectiveResolver.prototype._merge = function (dm, inputs, outputs, host, queries, directiveType) {
var mergedInputs = lang_1.isPresent(dm.inputs) ? collection_1.ListWrapper.concat(dm.inputs, inputs) : inputs;
var mergedOutputs;
if (lang_1.isPresent(dm.outputs)) {
dm.outputs.forEach(function (propName) {
if (collection_1.ListWrapper.contains(outputs, propName)) {
throw new exceptions_1.BaseException("Output event '" + propName + "' defined multiple times in '" + lang_1.stringify(directiveType) + "'");
}
});
mergedOutputs = collection_1.ListWrapper.concat(dm.outputs, outputs);
}
else {
mergedOutputs = outputs;
}
var mergedHost = lang_1.isPresent(dm.host) ? collection_1.StringMapWrapper.merge(dm.host, host) : host;
var mergedQueries = lang_1.isPresent(dm.queries) ? collection_1.StringMapWrapper.merge(dm.queries, queries) : queries;
if (dm instanceof metadata_1.ComponentMetadata) {
return new metadata_1.ComponentMetadata({
selector: dm.selector,
inputs: mergedInputs,
outputs: mergedOutputs,
host: mergedHost,
exportAs: dm.exportAs,
moduleId: dm.moduleId,
queries: mergedQueries,
changeDetection: dm.changeDetection,
providers: dm.providers,
viewProviders: dm.viewProviders
});
}
else {
return new metadata_1.DirectiveMetadata({
DynamicSegment.prototype.generate = function(params) {
if (!collection_1.StringMapWrapper.contains(params.map, this.name)) {
throw new exceptions_1.BaseException("Route generator for '" + this.name + "' was not included in parameters passed.");
}
return normalizeString(params.get(this.name));
};
return DynamicSegment;