UNPKG

nowjs-core

Version:

NowCanDo Javascript Core [nowjs-core] is a library written by TypeScript code maintains under Apache 2.0 licence

20 lines (19 loc) 888 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const index_1 = require("../index"); const index_2 = require("./index"); exports.VALIDATOR_OBJECT_METADATA_KEY = Symbol('validation:validator:isObject'); function isObject(valueType, errorMessage) { return (target, propertyKey, descriptor) => { const original = descriptor.value; Reflect.defineMetadata(exports.VALIDATOR_OBJECT_METADATA_KEY, null, target, propertyKey); Reflect.defineMetadata(index_1.VALIDATOR_METADATA_KEY, new ObjectValidator(errorMessage), target, propertyKey); }; } exports.isObject = isObject; class ObjectValidator extends index_2.ValueTypeValidatorBase { constructor(errorMessage = 'The value of ${DisplayName} must have valu type: ${ValueType} .') { super('Object', 'object', errorMessage); } } exports.ObjectValidator = ObjectValidator;