Skip to content

Commit

Permalink
requested changes 4 cont.
Browse files Browse the repository at this point in the history
  • Loading branch information
aditi-khare-mongoDB committed Nov 12, 2024
1 parent 7c6ff5c commit c5dc226
Showing 1 changed file with 0 additions and 49 deletions.
49 changes: 0 additions & 49 deletions lib/schema/int32.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,55 +194,6 @@ SchemaInt32.prototype.cast = function(value) {
}
};

/*!
* ignore
*/

SchemaInt32.$conditionalHandlers = {
...SchemaType.prototype.$conditionalHandlers,
$gt: handleSingle,
$gte: handleSingle,
$lt: handleSingle,
$lte: handleSingle
};

/*!
* ignore
*/

function handleSingle(val, context) {
return this.castForQuery(null, val, context);
}

/**
* Casts contents for queries.
*
* @param {String} $conditional
* @param {any} val
* @api private
*/

SchemaInt32.prototype.castForQuery = function($conditional, val, context) {
let handler;
if ($conditional != null) {
handler = SchemaInt32.$conditionalHandlers[$conditional];

if (handler) {
return handler.call(this, val);
}

return this.applySetters(null, val, context);
}

try {
return this.applySetters(val, context);
} catch (err) {
if (err instanceof CastError && err.path === this.path && this.$fullPath != null) {
err.path = this.$fullPath;
}
throw err;
}
};

/*!
* Module exports.
Expand Down

0 comments on commit c5dc226

Please sign in to comment.