• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stackpress / lib / 21355728094

26 Jan 2026 11:16AM UTC coverage: 79.327% (-0.2%) from 79.564%
21355728094

push

github

cblanquera
version bump

494 of 682 branches covered (72.43%)

Branch coverage included in aggregate %.

945 of 1132 relevant lines covered (83.48%)

26.76 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

53.33
/src/data/ReadonlyMap.ts
1
import DataMap from './Map.js';
2

3
export default class ReadonlyMap<K = any, V = any> {
4
  //map of map
5
  protected _map: DataMap<K, V>;
6

7
  /**
8
   * Returns the size of the map
9
   */
10
  public get size() {
11
    return this._map.size;
4✔
12
  }
13

14
  /**
15
   * Sets the initial values of the map
16
   */
17
  constructor(init?: [K, V][]) {
18
    this._map = new DataMap<K, V>(init);
54✔
19
  }
20

21
  /**
22
   * Returns the map as entries
23
   */
24
  public entries() {
25
    return this._map.entries();
1✔
26
  }
27

28
  /**
29
   * Filters the data map (returns a new DataMap instance)
30
   */
31
  public filter(callback: (
32
    value: V, 
33
    key?: K, 
34
    map?: DataMap<K, V>
35
  ) => boolean) {
36
    return this._map.filter(callback);
×
37
  }
38

39
  /**
40
   * Finds the first entry that matches the callback
41
   */
42
  public find(callback: (
43
    value: V, 
44
    key?: K, 
45
    map?: DataMap<K, V>
46
  ) => boolean) {
47
    return this._map.find(callback);
×
48
  }
49

50
  /**
51
   * Finds the first key that matches the callback
52
   */
53
  public findKey(callback: (
54
    value: V, 
55
    key?: K, 
56
    map?: DataMap<K, V>
57
  ) => boolean) {
58
    return this._map.findKey(callback);
×
59
  }
60

61
  /**
62
   * Finds the first value that matches the callback
63
   */
64
  public findValue(callback: (
65
    value: V, 
66
    key?: K, 
67
    map?: DataMap<K, V>
68
  ) => boolean) {
69
    return this._map.findValue(callback);
×
70
  }
71

72
  /**
73
   * Iterates over the map
74
   */
75
  public forEach(
76
    iterator: (value: V, key: K, set: Map<K, V>) => void, 
77
    arg?: unknown
78
  ) {
79
    return this._map.forEach(iterator, arg);
1✔
80
  }
81

82
  /**
83
   * Returns the value of the map
84
   */
85
  public get(key: K) {
86
    return this._map.get(key);
12✔
87
  }
88

89
  /**
90
   * Returns whether the map has the value
91
   */
92
  public has(key: K) {
93
    return this._map.has(key);
2✔
94
  }
95

96
  /**
97
   * Returns the keys of the map
98
   */
99
  public keys() {
100
    return this._map.keys();
2✔
101
  }
102

103
  /**
104
   * Maps the data map values to a new data map
105
   */
106
  public map<T>(callback: (
107
    value: V, 
108
    key?: K, 
109
    map?: DataMap<K, V>) => T
110
  ) {
111
    return this._map.map(callback);
×
112
  }
113

114
  /**
115
   * Returns the data map as a plain object
116
   */
117
  public toObject() {
118
    return this._map.toObject();
×
119
  }
120

121
  /**
122
   * Returns the data map as a JSON string
123
   */
124
  public toString(
125
    replacer?: (key: string, value: any) => any, 
126
    space?: string | number
127
  ) {
128
    return this._map.toString(replacer, space);
×
129
  }
130

131
  /**
132
   * Returns the values of the map
133
   */
134
  public values() {
135
    return this._map.values();
1✔
136
  }   
137
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc