Skip to content

Commit

Permalink
chore: some fixes within readme
Browse files Browse the repository at this point in the history
  • Loading branch information
peyerluk committed Mar 20, 2018
1 parent 4d8acb9 commit d07c86b
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ms.strictObj({

## Strings

Using the ms.string() method
Using the `ms.string()` method:
```js
ms.string()
output = {type: 'string'})
Expand All @@ -42,13 +42,16 @@ output = {type: 'string'})
```js
ms.string({pattern: '[a-z]+'})

// Passing a javascript RegExp is equivalent to the above
ms.string({pattern: /[a-z]+/})

output = {
type: 'string',
pattern: '[a-z]+'
}
```

Setting the required flag (only possible within an object)
Setting the required flag (only possible within an object):
```js
ms.obj({
foo: ms.required.string()
Expand All @@ -65,7 +68,7 @@ output = {
}
```

Simplified usage within objects
Simplified usage within objects:
```js
ms.obj({
foo: 'string'
Expand Down Expand Up @@ -99,14 +102,14 @@ output = {

## Numbers and Integers

Simplified usage within objects
Simplified usage within objects:
```js
ms.obj({
foo: 'string'
})
```

Using the ms.number() method
Using the `ms.number()` method:
```js
ms.number()
output = {type: 'number'}
Expand All @@ -122,7 +125,7 @@ output = {
}
```

Using the ms.integer() method
Using the `ms.integer()` method:
```js
ms.integer()
output = {type: 'integer'}
Expand All @@ -138,7 +141,7 @@ ms.boolean()
output = {type: 'boolean'})
```

Simplified usage within objects
Simplified usage within objects:
```js
ms.obj({
foo: 'boolean:required'
Expand All @@ -162,22 +165,21 @@ ms.obj()
output = {type: 'object'}
```

Don't allow additional properties with `strictObj()`
Don't allow additional properties with `strictObj()`:
```js
ms.strictObj({
count: ms.integer()
})

output = {
type: 'object'
additionalProperties: false
type: 'object',
additionalProperties: false,
properties: {
count: {type: 'integer'}
}
}
```


## Arrays

```js
Expand All @@ -194,7 +196,7 @@ output = {

```js
// All values in an enumeration must be of the same type.
ms.required.enum('foo', 'bar')
ms.enum('foo', 'bar')

output = {
type: 'string',
Expand Down

0 comments on commit d07c86b

Please sign in to comment.