all files / lib/helpers/ refCount.js

100% Statements 15/15
100% Branches 4/4
100% Functions 3/3
100% Lines 15/15
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          46× 45×       47× 47×   44×     50×    
"use strict";
 
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.add = add;
exports.remove = remove;
exports.count = count;
var modals = [];
 
function add(element) {
  if (modals.indexOf(element) === -1) {
    modals.push(element);
  }
}
 
function remove(element) {
  var index = modals.indexOf(element);
  if (index === -1) {
    return;
  }
  modals.splice(index, 1);
}
 
function count() {
  return modals.length;
}