All files / construct/domain_layer/library/structure/hash_map HashMap.bs.js

89.29% Statements 25/28
100% Branches 2/2
66.67% Functions 6/9
89.29% Lines 25/28

Press n or j to go to the next uncovered block, b, p or k for the previous block.

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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61    7x 7x 7x 7x 7x     135x               25x 25x 9x   16x         8x             7x     5x 5x               21x 5x       7x 7x 7x 7x 7x 7x 7x 7x 7x    
'use strict';
 
var Js_dict = require("bs-platform/lib/js/js_dict.js");
var Caml_option = require("bs-platform/lib/js/caml_option.js");
var ArraySt$Wonderjs = require("../ArraySt.bs.js");
var Js_null_undefined = require("bs-platform/lib/js/js_null_undefined.js");
var NullUtils$Wonderjs = require("../utils/NullUtils.bs.js");
 
function createEmpty(hintSizeOpt, param) {
  return {};
}
 
function unsafeGet(map, key) {
  return map[key];
}
 
function get(map, key) {
  var value = map[key];
  if (NullUtils$Wonderjs.isEmpty(value)) {
    return ;
  } else {
    return Caml_option.some(value);
  }
}
 
function getNullable(map, key) {
  return Js_null_undefined.fromOption(get(map, key));
}
 
function has(map, key) {
  return !NullUtils$Wonderjs.isEmpty(map[key]);
}
 
var entries = Js_dict.entries;
 
function _mutableSet(map, key, value) {
  map[key] = value;
  return map;
}
 
function _createEmpty(param) {
  return {};
}
 
function copy(map) {
  return ArraySt$Wonderjs.reduceOneParam(Js_dict.entries(map), (function (newMap, param) {
                return _mutableSet(newMap, param[0], param[1]);
              }), {});
}
 
exports.createEmpty = createEmpty;
exports.unsafeGet = unsafeGet;
exports.get = get;
exports.getNullable = getNullable;
exports.has = has;
exports.entries = entries;
exports._mutableSet = _mutableSet;
exports._createEmpty = _createEmpty;
exports.copy = copy;
/* No side effect */