How to use the aurelia-validation.Validation function in aurelia-validation

To help you get started, we’ve selected a few aurelia-validation examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SpoonX / aurelia-orm / dist / commonjs / entity.js View on Github external
});
exports.Entity = undefined;

var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };

var _dec, _dec2, _class;

var _aureliaValidation = require('aurelia-validation');

var _aureliaDependencyInjection = require('aurelia-dependency-injection');

var _ormMetadata = require('./orm-metadata');

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var Entity = exports.Entity = (_dec = (0, _aureliaDependencyInjection.transient)(), _dec2 = (0, _aureliaDependencyInjection.inject)(_aureliaValidation.Validation), _dec(_class = _dec2(_class = function () {
  function Entity(validator) {
    _classCallCheck(this, Entity);

    this.define('__meta', _ormMetadata.OrmMetadata.forTarget(this.constructor)).define('__cleanValues', {}, true);

    if (!this.hasValidation()) {
      return this;
    }

    return this.define('__validator', validator);
  }

  Entity.prototype.getTransport = function getTransport() {
    return this.getRepository().getTransport();
  };