Skip to content

Commit

Permalink
Updates Tests and Documentation (#16)
Browse files Browse the repository at this point in the history
Adds documentation for validating primitives, and adds tests for the documentation. Also updates a few linting errors/warnings.
  • Loading branch information
losandes authored Sep 11, 2019
1 parent 3130dcf commit afb6076
Show file tree
Hide file tree
Showing 9 changed files with 4,802 additions and 73 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ const allTheTypes = blueprint('allTheTypes', {
optionalArrayOfAny: 'any[]?',

// weakly typed arrays
requiredArray: 'array', // same as any[]
requiredArray: 'array', // same as any[]
optionalArray: 'array?', // same as any[]?

// decimals
Expand All @@ -184,10 +184,15 @@ const allTheTypes = blueprint('allTheTypes', {
requiredDecimalTo15Places: 'decimal:15',
optionalDecimalTo15Places: 'decimal:15?',

requiredPrimitive: 'primitive',
optionalPrimitive: 'primitive?',
requiredArrayOfPrimitives: 'primitive[]',
optionalArrayOfPrimitives: 'primitive[]?',

// inline custom validators
someProperty: ({ key, value, input, root }) =>
root.productType === 'book' && typeof value === 'string'
)
})
```

### Optionals
Expand Down
2 changes: 1 addition & 1 deletion dist/blueprint.js
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
'use strict';

var registerType = Blueprint.registerType;
var types = ['function', 'asyncFunction', 'promise', 'object', 'array', 'boolean', 'date', 'number', 'decimal', 'regexp' // 'string' registered separately, below
var types = ['function', 'asyncFunction', 'promise', 'object', 'array', 'boolean', 'date', 'number', 'decimal', 'regexp', 'primitive' // 'string' registered separately, below
];

var errorMessage = function errorMessage(type) {
Expand Down
2 changes: 1 addition & 1 deletion dist/blueprint.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit afb6076

Please sign in to comment.