UNPKG

662 BPlain TextView Raw
1return (function(currentDocument) {
2 var module = { exports: {} };
3
4 (function(module, exports) {
5 // Source code for json stable stringify (exports the function)
6 %s
7 }(module, module.exports));
8
9 // Stringified document
10 var originalDocument = %s;
11
12 var stringify = module.exports;
13 var replacer = function(key, value) {
14 if(value instanceof ObjectId) return value.str;
15 if(value instanceof Date) return value.toJSON();
16 if(value instanceof NumberLong) return value.toNumber();
17 if(value instanceof Timestamp) return value.i + ':' + value.t;
18 return value;
19 };
20
21 return originalDocument === stringify(currentDocument, { replacer: replacer });
22}(this));