Skip to content

Commit

Permalink
chore: update README
Browse files Browse the repository at this point in the history
  • Loading branch information
atinux authored Jan 20, 2020
1 parent 7db990b commit 5df73f9
Showing 1 changed file with 4 additions and 32 deletions.
36 changes: 4 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,13 @@ It's designed to work both client-side and server-side and to be scalable with a

**See a live example:** http://atinux.github.io/schema-inspector/

<a target='_blank' rel='nofollow' href='https://app.codesponsor.io/link/htiWA79uE8uubJymVd58XjBi/Atinux/schema-inspector'>
<img alt='Sponsor' width='888' height='68' src='https://app.codesponsor.io/embed/htiWA79uE8uubJymVd58XjBi/Atinux/schema-inspector.svg' />
</a>

## Installation

### Node.js
<pre>npm install schema-inspector</pre>

### Browser

<pre>bower install schema-inspector</pre>
(Or download [async.js](https://raw.github.com/caolan/async/master/lib/async.js) and [schema-inspector.js](https://raw.github.com/Atinux/schema-inspector/master/lib/schema-inspector.js) manually).
```html
Expand Down Expand Up @@ -140,19 +137,20 @@ In the example below, the `inspector` variable will be used. For the client-sid
* [items](#s_items)

### Custom fields

* [punctual use](#cf_punctual)
* [extension](#cf_extension)
* [context](#cf_context)

### Asynchronous call

* [How to](#a_howTo)

### Thanks to:
* [Benjamin Gressier](https://twitter.com/NikitaJS) (major contributor of this awesome module)

## Validation

<a name="v_type" />
### type

* **type**: string, array of string.
Expand Down Expand Up @@ -222,7 +220,6 @@ inspector.validate(schema, c4); // Invalid: @.lorem must be a number, @dolor mus

---------------------------------------

<a name="v_optional" />
### optional

* **type**: boolean.
Expand Down Expand Up @@ -261,7 +258,6 @@ inspector.validate(schema2, c2); // Invalid: "@.lorem" is missing and not option

---------------------------------------

<a name="v_uniqueness" />
### uniqueness

* **type**: boolean.
Expand Down Expand Up @@ -289,7 +285,6 @@ inspector.validate(schema, c2); // Invalid: 12 exists twice in @.

---------------------------------------

<a name="v_pattern" />
### pattern

* **type**: string, RegExp object, array of string and RegExp.
Expand Down Expand Up @@ -327,7 +322,6 @@ inspector.validate(schema2, c2); // Invalid: @[2] ('amet@consectetur') does not

---------------------------------------

<a name="v_length" />
### minLength, maxLength, exactLength

* **type**: integer.
Expand Down Expand Up @@ -362,7 +356,6 @@ inspector.validate(schema, c2); // Invalid: @.lorem must have a length between 4

---------------------------------------

<a name="v_comparators" />
### lt, lte, gt, gte, eq, ne

* **type**: number (string, number and boolean for eq).
Expand Down Expand Up @@ -401,7 +394,6 @@ inspector.validate(schema, c2); // Invalid

---------------------------------------

<a name="v_someKeys" />
### someKeys

* **type**: array of string.
Expand Down Expand Up @@ -436,7 +428,6 @@ inspector.validate(schema, c3); // Invalid: Neither @.lorem nor @.ipsum is in c3

---------------------------------------

<a name="v_strict" />
### strict

* **type**: boolean.
Expand Down Expand Up @@ -469,7 +460,6 @@ inspector.validate(schema, c2); // Invalid: @.sit should not exist.

---------------------------------------

<a name="v_exec" />
### exec

* **type**: function, array of function.
Expand Down Expand Up @@ -509,7 +499,6 @@ inspector.validate(schema, c2); // Invalid: "@.lorem must not equal 3 =(".

---------------------------------------

<a name="v_properties" />
### properties

* **type**: object.
Expand Down Expand Up @@ -568,7 +557,6 @@ inspector.validate(schema, c2); // Invalid: @.lorem.ipsum.dolor must be a string

---------------------------------------

<a name="v_items" />
### items

* **type**: object, array of object.
Expand Down Expand Up @@ -610,7 +598,6 @@ inspector.validate(schema2, c2); // Valid

---------------------------------------

<a name="v_alias" />
### alias

* **type**: string.
Expand Down Expand Up @@ -647,7 +634,6 @@ console.log(r2.format()); // Property id (@._id): must be string, but is number

---------------------------------------

<a name="v_error" />
### error

* **type**: string.
Expand Down Expand Up @@ -685,7 +671,6 @@ console.log(r2.format()); // Property @._id: must be a valid ID.

---------------------------------------

<a name="v_code" />
### code

* **type**: string.
Expand Down Expand Up @@ -722,7 +707,6 @@ console.log(r2.error[0].code); // 'id-format'

## Sanitization

<a name="s_type" />
### type

* **type**: string.
Expand Down Expand Up @@ -798,8 +782,8 @@ var r = inspector.sanitize(schema, c);

---------------------------------------

<a name="s_def" />
### def

* **type**: any.
* **usable on**: any.

Expand Down Expand Up @@ -839,7 +823,6 @@ var r = inspector.sanitize(schema, c);

---------------------------------------

<a name="s_optional" />
### optional

* **type**: boolean.
Expand Down Expand Up @@ -874,7 +857,6 @@ var r = inspector.sanitize(schema, c);

---------------------------------------

<a name="s_rules" />
### rules

* **type**: string, array of string.
Expand Down Expand Up @@ -921,7 +903,6 @@ var r = inspector.sanitize(schema, c);

---------------------------------------

<a name="s_comparators" />
### min, max

* **type**: string, number.
Expand Down Expand Up @@ -955,7 +936,6 @@ var r = inspector.sanitize(schema, c);

---------------------------------------

<a name="s_length" />
### minLength, maxLength

* **type**: integer.
Expand Down Expand Up @@ -985,7 +965,6 @@ var r = inspector.sanitize(schema, c);

---------------------------------------

<a name="s_strict" />
### strict

* **type**: boolean.
Expand Down Expand Up @@ -1021,7 +1000,6 @@ var r = inspector.sanitize(schema, c);
```
---------------------------------------

<a name="s_exec" />
### exec

* **type**: function, array of functions.
Expand Down Expand Up @@ -1064,7 +1042,6 @@ var r = inspector.sanitize(schema, c);

---------------------------------------

<a name="s_properties" />
### properties

* **type**: object.
Expand All @@ -1074,7 +1051,6 @@ Work the same way as [validation "properties"](#v_properties).

---------------------------------------

<a name="s_items" />
### items

* **type**: object, array of object.
Expand All @@ -1084,7 +1060,6 @@ Work the same way as [validation "items"](#v_items).

## Custom fields

<a name="cf_punctual" />
### punctual use

When you need to use the same function in `exec` field several time, instead of
Expand Down Expand Up @@ -1126,7 +1101,6 @@ inspector.validate(schema, candidate, custom); // Invalid: "@.ipsum must be divi

---------------------------------------

<a name="cf_extension" />
### extension

Sometime you want to use a custom field everywhere in your program, so you may
Expand Down Expand Up @@ -1174,7 +1148,6 @@ inspector.validate(schema, candidate);
*/
```

<a name="cf_context" />
### Context

Every function you declare as a custom parameter, or with `exec` field will be
Expand All @@ -1200,7 +1173,6 @@ var result = inspector.validate(schema, candidate, custom);

## Asynchronous call

<a name="a_howTo" />
### How to

All of the examples above used synchronous calls (the simplest). But sometimes you
Expand Down

0 comments on commit 5df73f9

Please sign in to comment.