UNPKG

emulate-mongo-2-driver

Version:

Emulate the Mongo 2.x nodejs driver on top of the Mongo 3.x nodejs driver, for bc

27 lines (22 loc) 484 B
const { toTinsel } = require('./utils.js'); module.exports = function (baseClass) { class TinselCursor extends baseClass { get __emulated() { return true; } nextObject(callback) { return super.next(callback); } } Object.defineProperty( baseClass.prototype, toTinsel, { enumerable: false, value: function () { return Object.setPrototypeOf(this, TinselCursor.prototype); } } ); return TinselCursor; };