# Code coverage report for lib/utils/uniq.js

## Statements: 100% (9 / 9) Branches: 100% (4 / 4) Functions: 100% (1 / 1) Lines: 100% (8 / 8) Ignored: none

All files » lib/utils/ » uniq.js

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    141
    141

    141
    132
    132

    132
    2

    141
     module.exports = function (ary) {
      var occurences = {}, clone = ary.concat();

      for (var i = clone.length; i--;) {
        var item = clone[i];
        if (!occurences[item]) occurences[item] = 0;

        if (++occurences[item] > 1) {
          clone.splice(i, 1);
        }
      }

      return clone;
    }