File: validators.coffee

Defined in: src/validation

Variables Summary

URL_REGEXP =
/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/

Regular expressions from Angular.js: https://github.com/angular/angular.js

EMAIL_REGEXP =
/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/
NUMBER_REGEXP =
/^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/
kb.valid =
{
  required: function(value) {
    return !value;
  },
  url: function(value) {
    return !URL_REGEXP.test(value);
  },
  email: function(value) {
    return !EMAIL_REGEXP.test(value);
  },
  number: function(value) {
    return !NUMBER_REGEXP.test(value);
  }
}

A validator should return true if there are errors (similar to the binding check in HTML, eg. $name().required).

Method Summary

Method Details

~ (void) kb(model)

Convention is that if they end in Fn then returns a function pointer based on parameters passed.

~ (void) kb(length)

~ (void) kb(model, key, collection)

~ (void) kb(stand_in, fn, model)

~ (void) kb(stand_in, fn, model)

    Quickly fuzzy find classes, mixins, methods, file:

    Control the navigation frame:

    You can focus and blur the search input: