lib/escort.js
function (descriptor) {
        var result = {};
        for (var key in descriptor) {
            if (Object.prototype.hasOwnProperty.call(descriptor, key)) {
                var keys = key.split(',');
                for (var i = 0, len = keys.length; i < len; i += 1) {
                    var method = keys[i];
                    if (!ACCEPTABLE_METHOD_SET[method]) {
                        throw new Error("Unknown descriptor method " + method);
                    }
                    if (Object.prototype.hasOwnProperty.call(result, method)) {
                        throw new Error("Already specified descriptor method " + method);
                    }
                    result[method] = descriptor[key];
                }
            }
        }
        if (!result.options) {
            result.options = createOptionsHandler(result);
        }
        return freeze(result);
    }
function (descriptor) {
        var result = {};
        for (var key in descriptor) {
            if (Object.prototype.hasOwnProperty.call(descriptor, key)) {
                var keys = key.split(',');
                for (var i = 0, len = keys.length; i < len; i += 1) {
                    var method = keys[i];
                    if (!ACCEPTABLE_METHOD_SET[method]) {
                        throw new Error("Unknown descriptor method " + method);
                    }
                    if (Object.prototype.hasOwnProperty.call(result, method)) {
                        throw new Error("Already specified descriptor method " + method);
                    }
                    result[method] = descriptor[key];
                }
            }
        }
        if (!result.options) {
            result.options = createOptionsHandler(result);
        }
        return freeze(result);
    }
function ( descriptor ) { var result = { } ; for ( var key in descriptor ) { if ( Object . prototype . hasOwnProperty . call ( descriptor , key ) ) { var keys = key . split ( ',' ) ; for ( var i = 0 , len = keys . length ; i < len ; i += 1 ) { var method = keys [ i ] ; if ( ! ACCEPTABLE_METHOD_SET [ method ] ) { throw new Error ( "Unknown descriptor method " + method ) ; } if ( Object . prototype . hasOwnProperty . call ( result , method ) ) { throw new Error ( "Already specified descriptor method " + method ) ; } result [ method ] = descriptor [ key ] ; } } } if ( ! result . options ) { result . options = createOptionsHandler ( result ) ; } return freeze ( result ) ; }
Verify the validity of the provided descriptor and return a sanitized version.
This will add an options handler if none is provided.

@param {Object} descriptor A map of methods to their associated callbacks
@return {Object} A map of methods to their associated callbacks
@api private

@example descriptor = sanitizeDescriptor(descriptor);
Verify the validity of the provided descriptor and return a sanitized version . This will add an options handler if none is provided .