@beecode/msh-node-util
v3.5.1
Published
[![Build Status](https://beecode.semaphoreci.com/badges/msh-node-util/branches/main.svg?style=shields)](https://beecode.semaphoreci.com/projects/msh-node-util) [![codecov](https://codecov.io/gh/beecode-rs/msh-node-util/branch/main/graph/badge.svg?token=fH
Downloads
911
Readme
msh-node-util
Micro-service helper: node error
This project is intended to be used in typescript project.
Install
npm i @beecode/msh-node-util
Diagram
Usage
joiUtil
import { joiUtil } from '@beecode/msh-node-util/lib/joi-util'
import { ObjectSchema, Schema } from 'joi'
import { logger } from 'src/util/logger'
export const validationUtil = {
sanitize: <T>(objectToValidate: Partial<T> | any, schema: Schema<T> | ObjectSchema<T>): T =>
joiUtil.sanitize(objectToValidate, schema, { logger }),
validate: <T>(objectToValidate: Partial<T> | any, schema: Schema<T> | ObjectSchema<T>): T =>
joiUtil.validate(objectToValidate, schema, { logger }),
}