Socket
Socket
Sign inDemoInstall

joi

Package Overview
Dependencies
Maintainers
2
Versions
238
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

joi - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

4

package.json
{
"name": "joi",
"description": "Object schema validation",
"version": "0.1.1",
"version": "0.1.2",
"author": "Van Nguyen <the.gol.effect@gmail.com>",

@@ -20,3 +20,3 @@ "contributors": [

"dependencies": {
"hoek": "0.4.x"
"hoek": "0.6.x"
},

@@ -23,0 +23,0 @@ "devDependencies": {

@@ -34,3 +34,3 @@ <a href="https://github.com/walmartlabs/blammo"><img src="https://raw.github.com/walmartlabs/blammo/master/images/from.png" align="right" /></a>

The **joi** validation system is used to validate JavaScript objects based on a rich descriptive schema.
Schema validation is the process of ensuring that objecta match pre-defined expectations.
Schema validation is the process of ensuring that objects match pre-defined expectations.

@@ -90,16 +90,11 @@ For example, the following schema:

The Types object is pre-populated with a mutable list of JavaScript's valid data types. However, for convenience, the registry also includes subset helpers (marked with #):
The Types object is pre-populated with a mutable list of JavaScript's valid data types. However, for convenience, the registry also includes subset helpers with common constraints already applied. For a list of helpers see the following sections...
* String
* Date ```String.date()```
* Email ```String.email()```
* Number
* Int ```Number.integer()```
* Float ```Number.float()```
* Boolean
* Array
* Object
* Function
* [String](#string "String")
* [Number](#number "Number")
* [Boolean](#boolean "Boolean")
* [Array](#array "Array")
* [Object](#object "Object")
Note that the Int is just Number with the integer constraint already applied. Any custom, user-defined data type is derived from one of the base types (although it may also combine additional types for sub-elements). Thus, there are two valid ways of creating your own types.
Any custom, user-defined data type is derived from one of the base types (although it may also combine additional types for sub-elements). Thus, there are two valid ways of creating your own types.

@@ -147,3 +142,3 @@ The first method is to add the type directly to the Type Registry. This makes the new type explicitly available as a base Type.

The above example demonstrates that even though the username has a minimum length of 6 extra constraints can be appended that allow 'admin' to be used as a username. Likewise, even though Administrator would be allowed by the other constraints, it is explicitly denied by the _'deny'_ constraint.
The above example demonstrates that even though the username has a minimum length of 6, extra constraints can be appended that allow 'admin' to be used as a username. Likewise, even though 'Administrator' would be allowed by the other constraints, it is explicitly denied by the _'deny'_ constraint.

@@ -273,3 +268,3 @@ ### By Type

Specifies that this input is a valid Date string (locale string but also accepts unix timestamp).
Specifies that this input is a valid Date string (locale string but also accepts unix timestamp in milliseconds).

@@ -299,3 +294,3 @@ ##### String.encoding(enc)

If n is not a positive integer, it returns an Error.
If n is not an integer, it returns an Error.

@@ -308,3 +303,3 @@ ##### Number.max(n)

If n is not a positive integer, it returns an Error.
If n is not an integer, it returns an Error.

@@ -311,0 +306,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc