Skip to content

Commit

Permalink
Merge pull request #12141 from hasezoey/fixSchemaTypeReturn
Browse files Browse the repository at this point in the history
fix(schematype): actually always return "this" where specified
  • Loading branch information
vkarpov15 committed Jul 25, 2022
2 parents cacdc02 + 5c61611 commit 2b0c5e1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/schematype.js
Expand Up @@ -462,7 +462,7 @@ SchemaType.prototype.unique = function(bool) {
SchemaType.prototype.text = function(bool) {
if (this._index === false) {
if (!bool) {
return;
return this;
}
throw new Error('Path "' + this.path + '" may not have `index` set to ' +
'false and `text` set to true');
Expand Down Expand Up @@ -499,7 +499,7 @@ SchemaType.prototype.text = function(bool) {
SchemaType.prototype.sparse = function(bool) {
if (this._index === false) {
if (!bool) {
return;
return this;
}
throw new Error('Path "' + this.path + '" may not have `index` set to ' +
'false and `sparse` set to true');
Expand Down

0 comments on commit 2b0c5e1

Please sign in to comment.