Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.DS_Store
node_modules
7 changes: 7 additions & 0 deletions js-schema.debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,13 @@ var ClassSchema = module.exports = Schema.patterns.ClassSchema = Schema.extend({
},
validate: function(instance) {
return instance instanceof this.constructor
},
toJSON: function() {
var json = Schema.prototype.toJSON.call(this)

json.type = this.constructor.name

return json
}
})

Expand Down
2 changes: 1 addition & 1 deletion js-schema.min.js

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions lib/patterns/class.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ var ClassSchema = module.exports = Schema.patterns.ClassSchema = Schema.extend({
},
validate: function(instance) {
return instance instanceof this.constructor
},
toJSON: function() {
var json = Schema.prototype.toJSON.call(this)

json.type = this.constructor.name

return json
}
})

Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
"validation",
"validator"
],
"version": "0.7.2",
"scripts": {
"test": "./test.sh"
},
"version": "0.8.0",
"homepage": "https://github.com/molnarg/js-schema",
"repository": {
"type": "git",
Expand Down