'use strict';

exports.__esModule = true;
exports.default = validate;

var _lodash = require('lodash.tonumber');

var _lodash2 = _interopRequireDefault(_lodash);

var _utils = require('./utils');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function validate(value, context) {
  var constraint = arguments.length <= 2 || arguments[2] === undefined ? {} : arguments[2];

  if ((0, _utils.isEmpty)(value)) return true;

  var length = value.length;

  return length <= (0, _lodash2.default)(constraint.value) || constraint.errorMessage || false;
}