container.ts
Version:
Modular application framework
54 lines • 2.07 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var validate_1 = require("../validate");
var NodeValidate = require("./NodeValidate");
var BufferField = /** @class */ (function (_super) {
__extends(BufferField, _super);
function BufferField(options) {
if (options === void 0) { options = {}; }
var _this = _super.call(this) || this;
_this.options = options;
return _this;
}
BufferField.prototype.validate = function (value) {
return NodeValidate.isBuffer(value, this.options);
};
BufferField.prototype.format = function (value) {
return value.toString(this.options.encoding);
};
return BufferField;
}(validate_1.Field));
exports.BufferField = BufferField;
var FileField = /** @class */ (function (_super) {
__extends(FileField, _super);
function FileField() {
return _super !== null && _super.apply(this, arguments) || this;
}
FileField.prototype.validate = function (value) {
return NodeValidate.isFile(value);
};
return FileField;
}(validate_1.Field));
exports.FileField = FileField;
var DirectoryField = /** @class */ (function (_super) {
__extends(DirectoryField, _super);
function DirectoryField() {
return _super !== null && _super.apply(this, arguments) || this;
}
DirectoryField.prototype.validate = function (value) {
return NodeValidate.isDirectory(value);
};
return DirectoryField;
}(validate_1.Field));
exports.DirectoryField = DirectoryField;
//# sourceMappingURL=Field.js.map