UNPKG

document.js

Version:

General purpose ODM supporting memory and mongo database adapters

13 lines (10 loc) 337 B
(function() { expectToBeNow = function(actual) { if(!actual) throw new Error('Expected to be given a date-like object'); var ms = Math.abs((new Date().getTime() - new Date(actual).getTime())); if(ms > 50) { throw new Error('Expected '+actual+' to be withing 50ms of *now* but was '+ms+'ms'); } }; })();