pure-validation

A lightweight module for simple object validation.

Usage no npm install needed!

<script type="module">
  import pureValidation from 'https://cdn.skypack.dev/pure-validation';
</script>

README

pure-validation

Greenkeeper badge Build Status npm package Dependency Status devDependency Status

A lightweight module for simple object validation.

Installation

yarn add pure-validation

API

getInitState

Returns an empty object - initial state of validation.

getFieldValidityExtension

Returns a new object with new field name and its validity state.

prop type required description
fieldName string true A field name
isOk bool true A validity value

setFieldValidity

Returns a new object with new field names and their validity states.

prop type required description
fields object true An object with list of field names and their validity states
fieldName string true A field name
isOk bool true A validity value

setFieldsValidity

Returns a new object with new field names and their validity states.

prop type required description
fields object true An object with list of field names and their validity states
fieldValidityExtensions array true An array of objects with field names and their validity states.

isFieldValid

prop type required description
field object true An object with field name to check

isAllFieldsValid

prop type required description
fields object true An object with field names and their values to check

isStringEmptyLike

prop type required description
value string true A value to check

isEmailLike

prop type required description
value string true A value to check

isPhoneLike

prop type required description
value string true A value to check

isUrlLike

prop type required description
value string true A value to check

License

MIT