constraint/abstract.js

'use strict';

/**
 * @author schukai GmbH
 */

import {Monster} from '../namespace.js';
import '../types/base.js';


/**
 * the abstract contraint defines the api for all constraints. mainly the method isValid() is defined.
 *
 * derived classes must implement the method isValid().
 *
 * @since 1.3.0
 * @copyright schukai GmbH
 * @memberOf Monster/Constraint
 */
class AbstractConstraint extends Object {

    /**
     *
     */
    constructor() {
        super();
    }

    /**
     * this method must return a promise containing the result of the check.
     *
     * @param {*} value
     * @returns {Promise}
     */
    isValid(value) {
        return Promise.reject(value);
    }
}

Monster.assignToNamespace('Monster.Constraint', AbstractConstraint);
export {Monster, AbstractConstraint}