rommel

A functional validation library written with ramda (all hail ramda 🙌). Heavily inspired by Joi with the following features:

Usage no npm install needed!

<script type="module">
  import rommel from 'https://cdn.skypack.dev/rommel';
</script>

README

RV🚙

A functional validation library written with ramda (all hail ramda 🙌). Heavily inspired by Joi with the following features:

  • Functional all the way
  • Reusable and composable
  • Small footprint
  • Descriptive and declarative
import {schema} from "rv";

schema([
    description(),
    label(),
    matches(),
    defaultsTo(),

    isObject(),
    isString(),
    isNumber(),
    isDate(),
    isBoolean(),
    isArray(),
        isRequired(),
    isPositive(),
    isNegative(),
    isInfinity(),
    isInteger(),
    isNaN(),
    isPositiveInteger(),
    isNegativeInteger(),
    isGreaterThan(),
    isLessThan(),
    isNull(),
    isUndefined(),
    isNil(),
    isEmpty(),
    isTrue(),
    isTruthy(),
    isFalse(),
    isFalsey(),

    isOneOf(),
    notOneOf(),
    notNil(),
    notNull(),
    notEmpty(),
    notUndefined(),

        hasShape(),
    hasLength(),
    hasMinLength(),
    hasMaxLength(),
    hasRequiredKeys(),
    hasOnlyKnownKeys(),
    hasUniqueValues(),

    allowOptionalKeys(),
    allowUnknownKeys(),

    rejectKeys(),
    rejectWhen

    shouldAnyPass(),
    shouldAllPass(),
])
// Primitives
isObject(
    hasShape({
        name: isString(isOptional()))
        email: isString(matches(/\.+@\.+/), isOptional())
        password: isString()
    }),
    notNull(),
    notEmpty(),
)
isArray()
isNumber()
isString()
isBoolean()
matches()

is
not
has
reject
allow
should

hasShape()
hasItems()

isNil()
notNil()
rejectNil()
allowNil()

isOptional()
allowUndefined()