Skip to content
This repository has been archived by the owner on Dec 12, 2022. It is now read-only.
/ overhaul Public archive

Overhaul Properties: Type Checking, Formatting, & Annotations

License

Notifications You must be signed in to change notification settings

adamjeffries/overhaul

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ARCHIVED / DEPRECATED

Overhaul

Type Checking, Formatting, Annotations, & more

npm version

Table of Contents

Quick Start

const oh = require("overhaul");

let format = oh.object({
  id: oh.required.toString.description("User Id"),
  state: oh.default("WA").values(["CA", "OR", "WA"]),
  age: oh.integer.within(10, 20).deprecated,
  filter: oh.object({
    start: oh.default(0).toNumber,
    end: oh.default(() => 5000).number
  })
});

let req = format.value({
  id: 123,
  age: 15,
  filter: {start: "100"}
});

// req === { id: '123', age: 15, state: 'WA', filter: { start: 100, end: 5000 } }

Usage

Constructor

Value

Register

Definition

Serialize

↑ Back to top

Definitions

Types

Arguments

Array

Boolean

Date

Element

Empty

Error

Finite

Instance

NaN

Null

Number

Object (Plain Object)

//Shortcut
oh.object({
  id: oh.string,
  filter: oh.object({
    start: oh.number,
    end: oh.number
  })
})

// Is equivalent to:
oh.object({
  id: oh.string,
  filter: {
    start: oh.number,
    end: oh.number
  }
})

// oh.object is implied if inner key value is a plain object

RegExp

String

Undefined

Traversals

Copy

Delete

Index

Key

Move

Parent

Sibling

Modifiers

Default

Freeze

Noop

Parse

Required

Stringify

Annotations

Example

Description

Deprecated

Lodash

https://lodash.com/docs

↑ Back to top

Installation

npm install --save overhaul

↑ Back to top

License

overhaul is licensed under the MIT license.

↑ Back to top

About

Overhaul Properties: Type Checking, Formatting, & Annotations

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published