function extend(dest, src, merge) {
    var keys = Object.keys(src);
    var i = 0;
    while (i < keys.length) {
        if (!merge || (merge && dest[keys[i]] === undefined)) {
            dest[keys[i]] = src[keys[i]];
        }
        i++;
    }
    return dest;
}
extend object.
means that properties in dest will be overwritten by the ones in src.
@param {Object} dest
@param {Object} src
@param {Boolean} [merge]
@returns {Object} dest