porting Node.js assert.js to browser