Sha256: e2595170bd1534fe74afc352cf737bce0e9a322b4b94507cd70b9fd8b1d167be

Contents?: true

Size: 422 Bytes

Versions: 1

Compression:

Stored size: 422 Bytes

Contents

ValidationError = require "hoarder/validator/error/validation_error"

#
# @author - Tim Shelburne <tim@musiconelive.com>
#
# 
#
class MaxLengthConstraint
  canHandle: (type)->
    type is "maxLength"

  handle: (element, context)->
    if element.value.length <= context.value
      return []
    else
      return [ new ValidationError "The maximum length of this field is #{context.value}." ]

return MaxLengthConstraint

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hoarder-js-0.0.1 assets/scripts/coffee/hoarder/validator/constraints/max_length_constraint.coffee