lib/schema.js
function defaultOptions(options) {
    const optionsDefault = {
        validateBeforeSave: true,
        explicitOnly: true,
        queries: {
            readAll: false,
            format: queries.formats.JSON,
        },
    };
    options = extend(true, {}, optionsDefault, options);
    if (options.joi) {
        const joiOptionsDefault = {
            options: {
                allowUnknown: options.explicitOnly !== true,
            },
        };
        if (is.object(options.joi)) {
            options.joi = extend(true, {}, joiOptionsDefault, options.joi);
        } else {
            options.joi = Object.assign({}, joiOptionsDefault);
        }
        if (!Object.prototype.hasOwnProperty.call(options.joi.options, 'stripUnknown')) {
            options.joi.options.stripUnknown = options.joi.options.allowUnknown !== true;
        }
    }
    return options;
}
function defaultOptions(options) {
    const optionsDefault = {
        validateBeforeSave: true,
        explicitOnly: true,
        queries: {
            readAll: false,
            format: queries.formats.JSON,
        },
    };
    options = extend(true, {}, optionsDefault, options);
    if (options.joi) {
        const joiOptionsDefault = {
            options: {
                allowUnknown: options.explicitOnly !== true,
            },
        };
        if (is.object(options.joi)) {
            options.joi = extend(true, {}, joiOptionsDefault, options.joi);
        } else {
            options.joi = Object.assign({}, joiOptionsDefault);
        }
        if (!Object.prototype.hasOwnProperty.call(options.joi.options, 'stripUnknown')) {
            options.joi.options.stripUnknown = options.joi.options.allowUnknown !== true;
        }
    }
    return options;
}
function defaultOptions ( options ) { const optionsDefault = { validateBeforeSave : true , explicitOnly : true , queries : { readAll : false , format : queries . formats . JSON , } , } ; options = extend ( true , { } , optionsDefault , options ) ; if ( options . joi ) { const joiOptionsDefault = { options : { allowUnknown : options . explicitOnly !== true , } , } ; if ( is . object ( options . joi ) ) { options . joi = extend ( true , { } , joiOptionsDefault , options . joi ) ; } else { options . joi = Object . assign ( { } , joiOptionsDefault ) ; } if ( ! Object . prototype . hasOwnProperty . call ( options . joi . options , 'stripUnknown' ) ) { options . joi . options . stripUnknown = options . joi . options . allowUnknown !== true ; } } return options ; }
Merge options passed with the default option for Schemas
@param options
Merge options passed with the default option for Schemas