You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
412 B
JavaScript
17 lines
412 B
JavaScript
10 months ago
|
'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;
|
||
|
};
|