Files
Suggestion/node_modules/mongoose/lib/helpers/discriminator/areDiscriminatorValuesEqual.js
爱喝水的木子 00b48da363 fix
2026-03-02 15:35:39 +08:00

17 lines
412 B
JavaScript

'use strict';
const isBsonType = require('../isBsonType');
module.exports = function areDiscriminatorValuesEqual(a, b) {
if (typeof a === 'string' && typeof b === 'string') {
return a === b;
}
if (typeof a === 'number' && typeof b === 'number') {
return a === b;
}
if (isBsonType(a, 'ObjectId') && isBsonType(b, 'ObjectId')) {
return a.toString() === b.toString();
}
return false;
};