API Docs for: 0.2.0
Show:

Ember.Validator Class

Extends Ember.Object
Module: Ember.Validator

Methods

_createResultMessage

(
  • errorKey
  • rule
)
private

Creates the error message.

Parameters:

  • errorKey String
  • rule Ember.Validator.Rule

_formatMessage

(
  • rule
  • propertyFormat
  • messageFormats
)
String private

Formats the message based on the errorKey and messageFormats. The errorKey is always set as the first argument

Related: propertyFormat, messageFormats

Parameters:

  • rule Ember.Validator.Rule
  • propertyFormat String
  • messageFormats Array

Returns:

String:

The formatted string

_generateResult

(
  • context
  • rules
  • key
)
private

Responsible for running validation rules and adding the error to an instance of Ember.Validator.Error.

Result generation will stop at the first failed validation per key.

Parameters:

  • context Object
    • The object doing the validation
  • rules Array
    • rule names defined as strings
  • key String
    • the current property being validated

_getRuleObj

(
  • context
  • key
  • ruleName
)
Object private

Looks for a rule object defined as custom or defined in {@link Ember.Validator.Rules}. Any custom rules with the same name in {@link Ember.Validator.Rules} are merged.

Parameters:

  • context String
  • key String
  • ruleName String

Returns:

Object:
  • The rule object

_getRulesForKey

(
  • key
)
private

Looks for rules property in the errorKey set in validations

Parameters:

  • key String

Properties

trim

Boolean

Option to trim whitespace from string values before validation.

Default: true

trimApply

Boolean

Option to set the trimmed value on the object. Trim must be true for this to work.

Default: true