heyujie
2021-06-07 8f8155aa4c83f7c2577ac123add550766b6a7ce3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
'use strict';
 
module.exports = function () {
    var map, iterator, result;
    if (typeof Map !== 'function') return false;
    try {
        // WebKit doesn't support arguments and crashes
        map = new Map([['raz', 'one'], ['dwa', 'two'], ['trzy', 'three']]);
    } catch (e) {
        return false;
    }
    if (String(map) !== '[object Map]') return false;
    if (map.size !== 3) return false;
    if (typeof map.clear !== 'function') return false;
    if (typeof map.delete !== 'function') return false;
    if (typeof map.entries !== 'function') return false;
    if (typeof map.forEach !== 'function') return false;
    if (typeof map.get !== 'function') return false;
    if (typeof map.has !== 'function') return false;
    if (typeof map.keys !== 'function') return false;
    if (typeof map.set !== 'function') return false;
    if (typeof map.values !== 'function') return false;
 
    iterator = map.entries();
    result = iterator.next();
    if (result.done !== false) return false;
    if (!result.value) return false;
    if (result.value[0] !== 'raz') return false;
    if (result.value[1] !== 'one') return false;
 
    return true;
};