@defriction/is_a
v1.0.6
Published
Utility for detecting value types
Downloads
20
Maintainers
Readme
is_a
Utility function to help determine value types
Installation
Example usage
// ...
if( is_a('email', '[email protected]') ){
console.log('This is a valid email address!');
}else{
console.log('This email addres is not valid!');
}
Value Check Types
- Email is_a('email', value);
- Email Charactersis_a('email_character', value);
- Domain is_a('domain', value);
- Domain Characters is_a('domain_character', value);
- URL is_a('url', value);
- Phone is_a('phone', value); // +1(555) 555-5555 and 555.555.5555 and 555-555-5555 are true
- Strong Password is_a('strong_password', value); // Min 8 characters, Uppercase letter, Lowercase Letter, Special Character (@$!%*?&)
- Truthy is_a('truthy', value);
- Falsy is_a('falsy', value);
- String is_a('string', value);
- Number is_a('number', value); // false against NaN