All files / latest/src/handlers/set/src processSettings.js

100% Statements 18/18
100% Branches 3/3
100% Functions 1/1
100% Lines 18/18

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 181x 1x 1x 1x 1x 1x 1x 1x 82x 19x 19x 19x 19x 19x 63x 63x 1x 1x
const makeObject = require('../../make/makeObject');
 
/**
 * Process settings object, if boolean is found; set fatalErrorOnCreate. Output is always an object.
 * @param {Value} settings - settings object, or boolean with fatalErrorOnCreate setting
 * @returns {Object} object with settings
 */
const processSettings = (settings) => {
    if (typeof settings === 'boolean') {
        console.warn('Use of boolean setting for fatalErrorOnCreate on set or setAll is deprecated and will soon be disabled. Please use object with fatalErrorOnCreate as property instead.');
        return {
            fatalErrorOnCreate: settings
        }
    }
    return makeObject(settings);
}
 
module.exports = processSettings;