sorodrigo / proxy-validator Goto Github PK
View Code? Open in Web Editor NEWSmall package that leverages the power of ES6 Proxy to validate and sanitize objects.
License: MIT License
Small package that leverages the power of ES6 Proxy to validate and sanitize objects.
License: MIT License
I want to check if a username field has either the string 'admin' or 'root', currently this is not possible as the objects keys for the 'contains' method will clash. How can this be supported?
Hi,
I'm a bit confused about how you work with 'options' as opposed to how the source library validator.js works with it. In particular, the function isMobilePhone defines 'locale' as one of the input parameters and 'options' as an object defaulting to {strictMode=false}
. In your example however, you use options as a key with locale as a value:
mobile: {
isMobilePhone: {
options: 'en-GB',
errorMessage: 'Invalid mobile number.'
},
isAlphanumeric: true
}
Now what I want to achieve in this particular case is to validate that the value is a phone number with any locale, BUT the locale being mandatory. I could probably work around that using 'matches' validator or using a custom regex match, but it is more about the general principle of how to translate the source library input parameters to your API as this would be the case for many other validators.
I like the fact that this is just a declarative wrapper for the validator lib, but what if we have some custom logic we would like to apply to a field?
How should this be done? I will be happy to submit a PR based on your suggestion.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.