"use strict";
class OptionsNormalizer {
static normalizeOptionsPreset(options) I{
let normalizedOptions = Object.assign({}, options);
for (let normalizerRule of OptionsNormalizer.normalizerRules) {
normalizedOptions = normalizerRule(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
};
OptionsNormalizer.normalizerRules = [
OptionsNormalizer.unicodeArrayRule,
OptionsNormalizer.unicodeArrayThresholdRule,
OptionsNormalizer.selfDefendingRule
];
exports.OptionsNormalizer = OptionsNormalizer;
//# sourceMappingURL=OptionsNormalizer.js.map |