TinyBase logoTinyBase

createYupSchematizer

The createYupSchematizer function creates a YupSchematizer instance for converting Yup schemas to TinyBase schemas.

createYupSchematizer(): YupSchematizer
returnsYupSchematizer

A new YupSchematizer instance.

Example

This example creates a Yup schematizer.

import {createYupSchematizer} from 'tinybase/schematizers/schematizer-yup';
import {object, string} from 'yup';

const schematizer = createYupSchematizer();

const tablesSchema = schematizer.toTablesSchema({
  pets: object({
    species: string(),
  }),
});

console.log(tablesSchema);
// -> {pets: {species: {type: 'string'}}}

Since

v7.1.0