Code coverage report for src/Common/Assert/Min.js

Statements: 100% (8 / 8)      Branches: 100% (2 / 2)      Functions: 100% (1 / 1)      Lines: 100% (8 / 8)      Ignored: none     

All files » src/Common/Assert/ » Min.js
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    1                             1   23 23   23 8     15       1  
'use strict';
 
var _           = require("lodash"),
    Type        = require("../Type"),
    Safe        = require("../Safe"),
    Exception   = require("../Exception/Exception");
 
/**
 *
 * Test the min length of any kind of object
 *
 * @throws {Exception}
 *
 * @param {*} val
 * @return {*}
 *
 */
var Min = function(val, min){
 
    min = Safe.number(min);
    var length = Safe.length(val);
 
    if(length < min){
        throw new Exception("VALIDATION_MIN", { value: min });
    }
 
    return val;
 
};
 
module.exports = Min;