Code coverage report for sockjs-client/lib/simpleevent.js

Statements: 100% (15 / 15)      Branches: 100% (4 / 4)      Functions: 100% (2 / 2)      Lines: 100% (15 / 15)      Ignored: none     

All files » sockjs-client/lib/ » simpleevent.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38                  1   1   1 98 98     1 1       1 5 1     4 4 1     4   1    
'use strict';
/*
 * ***** BEGIN LICENSE BLOCK *****
 * Copyright (c) 2011-2012 VMware, Inc.
 *
 * For the license see COPYING.
 * ***** END LICENSE BLOCK *****
 */
 
var assign = require('lodash.assign');
 
module.exports = SimpleEvent;
 
function SimpleEvent(type, obj) {
    this.type = type;
    assign(this, obj);
}
 
SimpleEvent.prototype.toString = function () {
    var acc = [],
        val,
        key;
 
    for (key in this) {
        if (!this.hasOwnProperty(key)) {
            continue;
        }
 
        val = this[key];
        if (typeof val === 'function') {
            val = '[function]';
        }
 
        acc.push(key + '=' + val);
    }
    return 'SimpleEvent(' + acc.join(', ') + ')';
};