[![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


License
MIT
Install
npm install @beecode/msh-node-util@3.5.1

Documentation

Build Status codecov GitHub license
NPM

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

vision-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 }),
}