How to use the webiny-validation.validation.validate function in webiny-validation

To help you get started, we’ve selected a few webiny-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 webiny / webiny-js / packages-client / webiny-client-ui / src / components / Tags / index.js View on Github external
validateTag(value = null) {
        return validation.validate(value, this.props.validateTags);
    }
github webiny / webiny-js / packages / webiny-model / src / attribute.js View on Github external
async validateAttribute(value: mixed) {
        let validators = this.getValidators();
        if (typeof validators === "string") {
            try {
                await validation.validate(value, validators);
            } catch (e) {
                throw new ModelError("Invalid attribute.", ModelError.INVALID_ATTRIBUTE, {
                    message: e.message,
                    value: e.value,
                    validator: e.validator
                });
            }
        } else if (typeof validators === "function") {
            await validators(value, this);
        }
    }
github webiny / webiny-js / packages / webiny-client-ui / src / components / Tags / index.js View on Github external
validateTag(value = null) {
        if (typeof this.props.validate === "string") {
            return validation.validate(value, this.props.validateTags);
        }
    }
github webiny / webiny-js / packages-utils / webiny-model / src / attribute.js View on Github external
async validateAttribute(value: mixed) {
        let validators = this.getValidators();
        if (typeof validators === "string") {
            try {
                await validation.validate(value, validators);
            } catch (e) {
                throw new ModelError("Invalid attribute.", ModelError.INVALID_ATTRIBUTE, {
                    message: e.message,
                    value: e.value,
                    validator: e.validator
                });
            }
        } else if (typeof validators === "function") {
            await validators(value, this);
        }
    }
github webiny / webiny-js / packages / webiny-app-ui / src / components / Tags / index.js View on Github external
validateTag(value = null) {
        if (typeof this.props.validate === "string") {
            return validation.validate(value, this.props.validateTags);
        }
    }

webiny-validation

A simple data validation library, packed with frequently used validators.

MIT
Latest version published 5 years ago

Package Health Score

66 / 100
Full package analysis