lib/tumblr.js
function wrapCreatePost(type, validate) {
    return function(blogIdentifier, params, callback) {
        params = extend({type: type}, params);

        if (isArray(validate)) {
            validate = partial(function(params, requireKeys) {
                if (requireKeys.length) {
                    const keyIntersection = intersection(keys(params), requireKeys);
                    if (requireKeys.length === 1 && !keyIntersection.length) {
                        throw new Error('Missing required field: ' + requireKeys[0]);
                    } else if (!keyIntersection.length) {
                        throw new Error('Missing one of: ' + requireKeys.join(', '));
                    } else if (keyIntersection.length > 1) {
                        throw new Error('Can only use one of: ' + requireKeys.join(', '));
                    }
                }
                return true;
            }, params, validate);
        }

        if (isFunction(validate)) {
            if (!validate(params)) {
                throw new Error('Error validating parameters');
            }
        }

        if (arguments.length > 2) {
            return this.createPost(blogIdentifier, params, callback);
        } else {
            return this.createPost(blogIdentifier, params);
        }
    };
}
function wrapCreatePost(type, validate) {
    return function(blogIdentifier, params, callback) {
        params = extend({type: type}, params);

        if (isArray(validate)) {
            validate = partial(function(params, requireKeys) {
                if (requireKeys.length) {
                    const keyIntersection = intersection(keys(params), requireKeys);
                    if (requireKeys.length === 1 && !keyIntersection.length) {
                        throw new Error('Missing required field: ' + requireKeys[0]);
                    } else if (!keyIntersection.length) {
                        throw new Error('Missing one of: ' + requireKeys.join(', '));
                    } else if (keyIntersection.length > 1) {
                        throw new Error('Can only use one of: ' + requireKeys.join(', '));
                    }
                }
                return true;
            }, params, validate);
        }

        if (isFunction(validate)) {
            if (!validate(params)) {
                throw new Error('Error validating parameters');
            }
        }

        if (arguments.length > 2) {
            return this.createPost(blogIdentifier, params, callback);
        } else {
            return this.createPost(blogIdentifier, params);
        }
    };
}
function wrapCreatePost ( type , validate ) { return function ( blogIdentifier , params , callback ) { params = extend ( { type : type } , params ) ; if ( isArray ( validate ) ) { validate = partial ( function ( params , requireKeys ) { if ( requireKeys . length ) { const keyIntersection = intersection ( keys ( params ) , requireKeys ) ; if ( requireKeys . length === 1 && ! keyIntersection . length ) { throw new Error ( 'Missing required field: ' + requireKeys [ 0 ] ) ; } else if ( ! keyIntersection . length ) { throw new Error ( 'Missing one of: ' + requireKeys . join ( ', ' ) ) ; } else if ( keyIntersection . length > 1 ) { throw new Error ( 'Can only use one of: ' + requireKeys . join ( ', ' ) ) ; } } return true ; } , params , validate ) ; } if ( isFunction ( validate ) ) { if ( ! validate ( params ) ) { throw new Error ( 'Error validating parameters' ) ; } } if ( arguments . length > 2 ) { return this . createPost ( blogIdentifier , params , callback ) ; } else { return this . createPost ( blogIdentifier , params ) ; } } ; }
Wraps createPost to specify `type` and validate the parameters

@param  {string} type - post type
@param  {Function} [validate] - returns `true` if the parameters validate

@return {Function} wrapped function

@private
Wraps createPost to specify type and validate the parameters