Skip to content

Commit dfd3091

Browse files
committed
feat: remove MapWrapper.contains().
1 parent be7ac9f commit dfd3091

File tree

18 files changed

+28
-30
lines changed

18 files changed

+28
-30
lines changed

modules/angular2/src/change_detection/parser/locals.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export class Locals {
55
constructor(public parent: Locals, public current: Map<any, any>) {}
66

77
contains(name: string): boolean {
8-
if (MapWrapper.contains(this.current, name)) {
8+
if (this.current.has(name)) {
99
return true;
1010
}
1111

@@ -17,7 +17,7 @@ export class Locals {
1717
}
1818

1919
get(name: string) {
20-
if (MapWrapper.contains(this.current, name)) {
20+
if (this.current.has(name)) {
2121
return this.current.get(name);
2222
}
2323

@@ -32,7 +32,7 @@ export class Locals {
3232
// TODO(rado): consider removing this check if we can guarantee this is not
3333
// exposed to the public API.
3434
// TODO: vsavkin maybe it should check only the local map
35-
if (MapWrapper.contains(this.current, name)) {
35+
if (this.current.has(name)) {
3636
this.current.set(name, value);
3737
} else {
3838
throw new BaseException(

modules/angular2/src/change_detection/pipes/keyvalue_changes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export class KeyValueChanges extends Pipe {
105105
this._removeFromSeq(lastOldSeqRecord, oldSeqRecord);
106106
this._addToRemovals(oldSeqRecord);
107107
}
108-
if (MapWrapper.contains(records, key)) {
108+
if (records.has(key)) {
109109
newSeqRecord = records.get(key);
110110
} else {
111111
newSeqRecord = new KVChangeRecord(key);

modules/angular2/src/core/compiler/element_injector.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ export class ProtoElementInjector {
421421
var visitedIds: Map<number, boolean> = new Map();
422422
ListWrapper.forEach(dirBindings, dirBinding => {
423423
ListWrapper.forEach(dirBinding.resolvedHostInjectables, b => {
424-
if (MapWrapper.contains(visitedIds, b.key.id)) {
424+
if (visitedIds.has(b.key.id)) {
425425
throw new BaseException(
426426
`Multiple directives defined the same host injectable: "${stringify(b.key.token)}"`);
427427
}
@@ -730,7 +730,7 @@ export class ElementInjector extends TreeNode<ElementInjector> {
730730

731731
hasVariableBinding(name: string): boolean {
732732
var vb = this._proto.directiveVariableBindings;
733-
return isPresent(vb) && MapWrapper.contains(vb, name);
733+
return isPresent(vb) && vb.has(name);
734734
}
735735

736736
getVariableBinding(name: string): any {
@@ -891,7 +891,7 @@ export class ElementInjector extends TreeNode<ElementInjector> {
891891

892892
private _buildAttribute(dep: DirectiveDependency): string {
893893
var attributes = this._proto.attributes;
894-
if (isPresent(attributes) && MapWrapper.contains(attributes, dep.attributeName)) {
894+
if (isPresent(attributes) && attributes.has(dep.attributeName)) {
895895
return attributes.get(dep.attributeName);
896896
} else {
897897
return null;

modules/angular2/src/core/compiler/proto_view_factory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class BindingRecordsCreator {
115115
directiveMetadata: renderApi.DirectiveMetadata): DirectiveRecord {
116116
var id = boundElementIndex * 100 + directiveIndex;
117117

118-
if (!MapWrapper.contains(this._directiveRecordsMap, id)) {
118+
if (!this._directiveRecordsMap.has(id)) {
119119
this._directiveRecordsMap.set(
120120
id, new DirectiveRecord({
121121
directiveIndex: new DirectiveIndex(boundElementIndex, directiveIndex),

modules/angular2/src/core/compiler/view.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export class AppView implements ChangeDispatcher, EventDispatcher {
7373

7474
setLocal(contextName: string, value): void {
7575
if (!this.hydrated()) throw new BaseException('Cannot set locals on dehydrated view.');
76-
if (!MapWrapper.contains(this.proto.variableBindings, contextName)) {
76+
if (!this.proto.variableBindings.has(contextName)) {
7777
return;
7878
}
7979
var templateName = this.proto.variableBindings.get(contextName);

modules/angular2/src/core/testability/testability.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export class TestabilityRegistry {
7171
if (elem == null) {
7272
return null;
7373
}
74-
if (MapWrapper.contains(this._applications, elem)) {
74+
if (this._applications.has(elem)) {
7575
return this._applications.get(elem);
7676
}
7777
if (DOM.isShadowRoot(elem)) {

modules/angular2/src/di/key.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export class KeyRegistry {
5656
}
5757
token = theToken;
5858

59-
if (MapWrapper.contains(this._allKeys, token)) {
59+
if (this._allKeys.has(token)) {
6060
return this._allKeys.get(token);
6161
}
6262

modules/angular2/src/facade/collection.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ class MapWrapper {
3636
m[p[0]] = p[1];
3737
return m;
3838
});
39-
static contains(Map m, k) => m.containsKey(k);
4039
static forEach(Map m, fn(v, k)) {
4140
m.forEach((k, v) => fn(v, k));
4241
}

modules/angular2/src/facade/collection.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ export class MapWrapper {
6464
return result;
6565
}
6666
static createFromPairs(pairs: List<any>): Map<any, any> { return createMapFromPairs(pairs); }
67-
static contains<K>(m: Map<K, any>, k: K) { return m.has(k); }
6867
static forEach<K, V>(m: Map<K, V>, fn: /*(V, K) => void*/ Function) { m.forEach(<any>fn); }
6968
static size(m: Map<any, any>) { return m.size; }
7069
static delete<K>(m: Map<K, any>, k: K) { m.delete(k); }

modules/angular2/src/http/headers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export class Headers {
5353

5454
get(header: string): string { return ListWrapper.first(this._headersMap.get(header)); }
5555

56-
has(header: string) { return MapWrapper.contains(this._headersMap, header); }
56+
has(header: string) { return this._headersMap.has(header); }
5757

5858
keys() { return MapWrapper.keys(this._headersMap); }
5959

0 commit comments

Comments
 (0)