UNPKG

965 BJavaScriptView Raw
1import { StringMapWrapper } from '../src/facade/collection';
2import { isBlank, isPresent } from '../src/facade/lang';
3export class TouchMap {
4 constructor(map) {
5 this.map = {};
6 this.keys = {};
7 if (isPresent(map)) {
8 StringMapWrapper.forEach(map, (value /** TODO #9100 */, key /** TODO #9100 */) => {
9 this.map[key] = isPresent(value) ? value.toString() : null;
10 this.keys[key] = true;
11 });
12 }
13 }
14 get(key) {
15 StringMapWrapper.delete(this.keys, key);
16 return this.map[key];
17 }
18 getUnused() {
19 var unused = {};
20 var keys = StringMapWrapper.keys(this.keys);
21 keys.forEach(key => unused[key] = StringMapWrapper.get(this.map, key));
22 return unused;
23 }
24}
25export function normalizeString(obj) {
26 if (isBlank(obj)) {
27 return null;
28 }
29 else {
30 return obj.toString();
31 }
32}
33//# sourceMappingURL=utils.js.map
\No newline at end of file