servers/servertcp_handler.js
function _handlePromiseOrValue(promiseOrValue, cb) {
    if (promiseOrValue && promiseOrValue.then && typeof promiseOrValue.then === "function") {
        promiseOrValue
            .then(function(value) {
                cb(null, value);
            })
            .catch(function(err) {
                cb(err);
            });
    }  else {
        cb(null, promiseOrValue);
    }
}
function _handlePromiseOrValue(promiseOrValue, cb) {
    if (promiseOrValue && promiseOrValue.then && typeof promiseOrValue.then === "function") {
        promiseOrValue
            .then(function(value) {
                cb(null, value);
            })
            .catch(function(err) {
                cb(err);
            });
    }  else {
        cb(null, promiseOrValue);
    }
}
function _handlePromiseOrValue ( promiseOrValue , cb ) { if ( promiseOrValue && promiseOrValue . then && typeof promiseOrValue . then === "function" ) { promiseOrValue . then ( function ( value ) { cb ( null , value ) ; } ) . catch ( function ( err ) { cb ( err ) ; } ) ; } else { cb ( null , promiseOrValue ) ; } }
Handle the callback invocation for Promises or synchronous values

@param promiseOrValue - the Promise to be resolved or value to be returned
@param cb - the callback to be invoked
@returns undefined
@private
Handle the callback invocation for Promises or synchronous values