@codibly/api-validation

1.1.0 • Public • Published

@codibly/api-validation

semantic-release code style: prettier commitizen friendly tested with jest

npm version npm license npm downloads npm types

Installation

This package is available as an npm package.

npm install --save @codibly/api-validation

or

yarn add @codibly/api-validation

Usage

The main gola of this library is to help is easy way handle api validation. ####Error Code

  • VALIDATION_ERROR - validation form error code ####Check error code To check if error has valid error code we use function isError
function isError(ErrorCode, Response | undefined): error is Error {}

####Get form errors To get validation form errors we have to functions which reducer array of errors to simple object where key is a filed name and value is a string or object.

- ValidationErrorMapper.toFormError(error: Error): FormError
- ValidationErrorMapper.toFormErrorsWithSheetCells(error: Error, sheetField: string[]): FormError

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @codibly/api-validation

Weekly Downloads

2

Version

1.1.0

License

MIT

Unpacked Size

31.1 kB

Total Files

20

Last publish

Collaborators

  • lkostrowski
  • lukasz-dobosz
  • jaaaracz
  • damian-labas
  • office_codibly