simple-body-validator
Version:
This package is inspired by Laravel validation, and aims to make body validation easier for Javascript developers
31 lines (30 loc) • 808 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const baseRule_1 = __importDefault(require("./baseRule"));
class In extends baseRule_1.default {
/**
* Create a new In rule instance.
*/
constructor(values) {
super();
/**
* The name of the rule.
*/
this.rule = 'in';
/**
* The accepted values.
*/
this.values = [];
this.values = values;
}
/**
* Convert the rule to a validation string.
*/
toString() {
return `${this.rule}:${this.values.join(',')}`;
}
}
exports.default = In;