Code coverage report for random/randHex.js

Statements: 100% (10 / 10)      Branches: 100% (4 / 4)      Functions: 100% (3 / 3)      Lines: 100% (9 / 9)     

All files » random/ » randHex.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 201   1         1 53 53 53 317   53     1      
define(['./choice'], function (choice) {
 
    var _chars = '0123456789abcdef'.split('');
 
    /**
     * Returns a random hexadecimal string
     */
    function randHex(size){
        size = size && size > 0? size : 6;
        var str = '';
        while (size--) {
            str += choice(_chars);
        }
        return str;
    }
 
    return randHex;
 
});