1 | import { StringMapWrapper } from '../src/facade/collection';
|
2 | import { isBlank, isPresent } from '../src/facade/lang';
|
3 | export class TouchMap {
|
4 | constructor(map) {
|
5 | this.map = {};
|
6 | this.keys = {};
|
7 | if (isPresent(map)) {
|
8 | StringMapWrapper.forEach(map, (value , key ) => {
|
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 | }
|
25 | export function normalizeString(obj) {
|
26 | if (isBlank(obj)) {
|
27 | return null;
|
28 | }
|
29 | else {
|
30 | return obj.toString();
|
31 | }
|
32 | }
|
33 |
|
\ | No newline at end of file |