Skip to content

Commit

Permalink
add guard against empty schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
noahrc committed May 6, 2016
1 parent 8257588 commit 1be0491
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
5 changes: 4 additions & 1 deletion dist/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/bundle.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/style.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* json-schema-view-js
* https://github.com/mohsen1/json-schema-view-js#readme
* Version: 0.4.1 - 2016-05-06T19:52:05.306Z
* Version: 0.4.1 - 2016-05-06T21:04:10.062Z
* License: MIT
*/

Expand Down
2 changes: 1 addition & 1 deletion dist/style.min.css

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

3 changes: 3 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ export default class JSONSchemaView {
this.options = options;
this.isCollapsed = open <= 0;

// Guard against empty schemas
if (!this.schema) return '';

// if schema is an empty object which means any JOSN
this.isAny = typeof schema === 'object' &&
!Array.isArray(schema) &&
Expand Down

0 comments on commit 1be0491

Please sign in to comment.