# 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
    149

    149
    134
    134

    134
    2

    149
     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;
    };