index.js
function unregisterTargets(userId, channel, targets, callback) {
    var self = this

    // no target list specified, so we need to load all the targets
    // of the supplied channel
    if (arguments.length < 4) {
        // probably we've got the callback as the third arg
        callback = targets

        this.load(userId, channel, function (err, targets) {
            // cannot load targets of the given channel
            // call back with the error
            if (err) {
                if (typeof err === 'object') {
                    err.userId  = userId
                    err.channel = channel
                }

                process.nextTick(callback, [ err ])
            }
            // we've got that list!
            else {
                // ...or maybe that's not really a list?
                if (!Array.isArray(targets))
                    targets = [ targets ]

                removeTargets(self, userId, channel, targets, callback)
            }
        })
    }
    // we've got an explicit target list, go remove them
    else {
        // ...or maybe that's not really a list?
        if (!Array.isArray(targets))
            targets = [ targets ]

        removeTargets(self, userId, channel, targets, callback)
    }

    // make it chainable
    return this
}
function unregisterTargets(userId, channel, targets, callback) {
    var self = this

    // no target list specified, so we need to load all the targets
    // of the supplied channel
    if (arguments.length < 4) {
        // probably we've got the callback as the third arg
        callback = targets

        this.load(userId, channel, function (err, targets) {
            // cannot load targets of the given channel
            // call back with the error
            if (err) {
                if (typeof err === 'object') {
                    err.userId  = userId
                    err.channel = channel
                }

                process.nextTick(callback, [ err ])
            }
            // we've got that list!
            else {
                // ...or maybe that's not really a list?
                if (!Array.isArray(targets))
                    targets = [ targets ]

                removeTargets(self, userId, channel, targets, callback)
            }
        })
    }
    // we've got an explicit target list, go remove them
    else {
        // ...or maybe that's not really a list?
        if (!Array.isArray(targets))
            targets = [ targets ]

        removeTargets(self, userId, channel, targets, callback)
    }

    // make it chainable
    return this
}
function unregisterTargets ( userId , channel , targets , callback ) { var self = this // no target list specified, so we need to load all the targets // of the supplied channel if ( arguments . length < 4 ) { // probably we've got the callback as the third arg callback = targets this . load ( userId , channel , function ( err , targets ) { // cannot load targets of the given channel // call back with the error if ( err ) { if ( typeof err === 'object' ) { err . userId = userId err . channel = channel } process . nextTick ( callback , [ err ] ) } // we've got that list! else { // ...or maybe that's not really a list? if ( ! Array . isArray ( targets ) ) targets = [ targets ] removeTargets ( self , userId , channel , targets , callback ) } } ) } // we've got an explicit target list, go remove them else { // ...or maybe that's not really a list? if ( ! Array . isArray ( targets ) ) targets = [ targets ] removeTargets ( self , userId , channel , targets , callback ) } // make it chainable return this }
Remove a previously saved channel or target.

@param {*} userId - User identifier. Type is mostly string or number but depends on the consumer.
@param {string} channel - Channel name.
@param {*|*[]} [targets] - The target or list of targets to remove. If not supplied, then all the targets of the given channel will be removed.
@param {function(?Error[])} callback
@returns {Handover}
Remove a previously saved channel or target .