overhaul
v0.0.5
Published
Type Definitions
Downloads
1
Maintainers
Readme
Overhaul
Type Checking, Formatting, Annotations, & more
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
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
Installation
npm install --save overhaul
License
overhaul is licensed under the MIT license.