Skip to content

Commit 2b0c5e1

Browse files
authored
Merge pull request #12141 from hasezoey/fixSchemaTypeReturn
fix(schematype): actually always return "this" where specified
2 parents cacdc02 + 5c61611 commit 2b0c5e1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/schematype.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ SchemaType.prototype.unique = function(bool) {
462462
SchemaType.prototype.text = function(bool) {
463463
if (this._index === false) {
464464
if (!bool) {
465-
return;
465+
return this;
466466
}
467467
throw new Error('Path "' + this.path + '" may not have `index` set to ' +
468468
'false and `text` set to true');
@@ -499,7 +499,7 @@ SchemaType.prototype.text = function(bool) {
499499
SchemaType.prototype.sparse = function(bool) {
500500
if (this._index === false) {
501501
if (!bool) {
502-
return;
502+
return this;
503503
}
504504
throw new Error('Path "' + this.path + '" may not have `index` set to ' +
505505
'false and `sparse` set to true');

0 commit comments

Comments
 (0)