Skip to content
This repository has been archived by the owner on Mar 10, 2022. It is now read-only.

Latest commit

 

History

History
30 lines (21 loc) · 562 Bytes

README.md

File metadata and controls

30 lines (21 loc) · 562 Bytes

@casper124578/utils

A package with useful node util functions (mostly for my personal projects)

Example

ts example

import * as yup from "yup";
import { validateSchema } from "@casper124578/utils";

const testSchemaObj = {
  email: yup.string().required().email(),
  password: yup.string().required().min(8),
};

// later in the code
const data = {
  /* some data here */
};

const [error] = await validateSchema(testSchemaObj, data);

if (error) {
  return console.log("validation error!", error);
}

console.log("validation success!");