1.0.4 • Published 5 years ago

complete-validator v1.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

complete-validator

Installation

$ npm install complete-validator 

Usage

const validator = require('complete-validator');

const results = validator(object, schema, customMessages, arrayValuesOrMomentOrDateArgument);

The validator function returns an object with value and errors properties.

  • value - contains a copy of the original object with its values optimised according to their types
  • error - contains array of validation errors if any or null if non.

API

For now, refer to Laravel validation docs, validation API will be updated in the next release.

An extra feature added is clean which works strings only. Arguments can be either or both of spaces and case.

  • spaces - Removes spaces in the value, its arguments can be begin which removes spaces at beginning of value, end which removes spaces at end of value, between_single which replaces multiple spaces and/or new lines and tabs with a single space, between_none which removes spaces in between and both which trims value on both ends.
  • case - Updates the value according to case provided which can either be upper, lower or title.

Sub arguments are provided in dot format i.e.

'spaces.both.between_single,case.title'

NB: Please bear with me, documentation coming up next

Licence

MIT

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago