We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1cb161d commit fb3ca5eCopy full SHA for fb3ca5e
src/simple-map.js
@@ -1,13 +1,10 @@
1
export class SimpleMap {
2
constructor () {
3
+ this.size = 0;
4
this.keys = [];
5
this.values = [];
6
}
7
- get size () {
8
- return this.keys.length;
9
- }
10
-
11
get (key) {
12
const index = this.keys.indexOf(key);
13
@@ -17,6 +14,7 @@ export class SimpleMap {
17
14
set (key, value) {
18
15
this.keys.push(key);
19
16
this.values.push(value);
+ this.size = this.keys.length;
20
21
return value;
22
tests/simple-map.js
@@ -1,7 +1,9 @@
import {
expect
} from 'chai';
-import {SimpleMap} from './../src/simple-map';
+import {
+ SimpleMap
+} from './../src/simple-map';
const getTests = (map) => {
return () => {
0 commit comments