define('ember-validators/length', ['exports', 'ember-validators/utils/validation-error'], function (exports, _validationError) {
  'use strict';

  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  exports.default = validateLength;


  /**
   *  @class Length
   *  @module Validators
   */

  /**
   * @method validate
   * @param {Any} value
   * @param {Object} options
   * @param {Boolean} options.allowNone If true, skips validation if the value is null or undefined. __Default: true__
   * @param {Boolean} options.allowBlank If true, skips validation if the value is empty
   * @param {Boolean} options.useBetweenMessage If true, uses the between error message when `max` and `min` are both set
   * @param {Number} options.is The exact length the value can be
   * @param {Number} options.min The minimum length the value can be
   * @param {Number} options.max The maximum length the value can be
   * @param {Object} model
   * @param {String} attribute
   */
  function validateLength(value, options) {
    var _EmberGetProperties = Ember.getProperties(options, ['allowNone', 'allowBlank', 'useBetweenMessage', 'is', 'min', 'max']),
        _EmberGetProperties$a = _EmberGetProperties.allowNone,
        allowNone = _EmberGetProperties$a === undefined ? true : _EmberGetProperties$a,
        allowBlank = _EmberGetProperties.allowBlank,
        useBetweenMessage = _EmberGetProperties.useBetweenMessage,
        is = _EmberGetProperties.is,
        min = _EmberGetProperties.min,
        max = _EmberGetProperties.max;

    if (Ember.isNone(value)) {
      return allowNone ? true : (0, _validationError.default)('invalid', value, options);
    }

    if (allowBlank && Ember.isEmpty(value)) {
      return true;
    }

    var length = Ember.get(value, 'length');

    if (!Ember.isNone(is) && is !== length) {
      return (0, _validationError.default)('wrongLength', value, options);
    }

    if (useBetweenMessage && !Ember.isNone(min) && !Ember.isNone(max) && (length < min || length > max)) {
      return (0, _validationError.default)('between', value, options);
    }

    if (!Ember.isNone(min) && min > length) {
      return (0, _validationError.default)('tooShort', value, options);
    }

    if (!Ember.isNone(max) && max < length) {
      return (0, _validationError.default)('tooLong', value, options);
    }

    return true;
  }
});