# All files / src OptionsNormalizer.js

100% Statements 18/18
100% Branches 5/5
100% Functions 0/0
100% Lines 17/17

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40

    10x
    10x
    10x
    10x
    10x

    10x
    3x

    10x

    10x
    5x

    10x

    10x
    10x
    10x

    1x

    1x

    1x
     "use strict";
    class OptionsNormalizer {
        static normalizeOptionsPreset(options) {
            let normalizedOptions = Object.assign({}, options);
            normalizedOptions = OptionsNormalizer.unicodeArrayRule(normalizedOptions);
            normalizedOptions = OptionsNormalizer.unicodeArrayThresholdRule(normalizedOptions);
            normalizedOptions = OptionsNormalizer.selfDefendingRule(normalizedOptions);
            return normalizedOptions;
        }
        static selfDefendingRule(options) {
            if (options.selfDefending) {
                Object.assign(options, OptionsNormalizer.SELF_DEFENDING_OPTIONS);
            }
            return options;
        }
        static unicodeArrayRule(options) {
            if (!options.unicodeArray) {
                Object.assign(options, OptionsNormalizer.DISABLED_UNICODE_ARRAY_OPTIONS);
            }
            return options;
        }
        static unicodeArrayThresholdRule(options) {
            const minValue = 0, maxValue = 1;
            options.unicodeArrayThreshold = Math.min(Math.max(options.unicodeArrayThreshold, minValue), maxValue);
            return options;
        }
    }
    OptionsNormalizer.DISABLED_UNICODE_ARRAY_OPTIONS = {
        encodeUnicodeLiterals: false,
        rotateUnicodeArray: false,
        unicodeArray: false,
        unicodeArrayThreshold: 0,
        wrapUnicodeArrayCalls: false
    };
    OptionsNormalizer.SELF_DEFENDING_OPTIONS = {
        compact: true,
        selfDefending: true
    };
    exports.OptionsNormalizer = OptionsNormalizer;
    //# sourceMappingURL=OptionsNormalizer.js.map