Updated option normalizers for stringArrayCallsTransform option

This commit is contained in:
sanex
2022-02-05 22:13:55 +03:00
parent bbeadade39
commit 711a135334
3 changed files with 7 additions and 7 deletions
+2 -2
View File
@@ -18,7 +18,7 @@ import { SourceMapBaseUrlRule } from './normalizer-rules/SourceMapBaseUrlRule';
import { SourceMapFileNameRule } from './normalizer-rules/SourceMapFileNameRule';
import { SplitStringsChunkLengthRule } from './normalizer-rules/SplitStringsChunkLengthRule';
import { StringArrayRule } from './normalizer-rules/StringArrayRule';
import { StringArrayCallsTransformRule } from './normalizer-rules/StringArrayCallsTransform';
import { StringArrayCallsTransformThresholdRule } from './normalizer-rules/StringArrayCallsTransformThresholdRule';
import { StringArrayEncodingRule } from './normalizer-rules/StringArrayEncodingRule';
import { StringArrayWrappersChainedCallsRule } from './normalizer-rules/StringArrayWappersChainedCalls';
@@ -41,7 +41,7 @@ export class OptionsNormalizer implements IOptionsNormalizer {
SourceMapFileNameRule,
SplitStringsChunkLengthRule,
StringArrayRule,
StringArrayCallsTransformRule,
StringArrayCallsTransformThresholdRule,
StringArrayEncodingRule,
StringArrayWrappersChainedCallsRule,
];
@@ -6,8 +6,8 @@ import { IOptions } from '../../interfaces/options/IOptions';
* @param {IOptions} options
* @returns {IOptions}
*/
export const StringArrayCallsTransformRule: TOptionsNormalizerRule = (options: IOptions): IOptions => {
if (!options.stringArrayCallsTransform) {
export const StringArrayCallsTransformThresholdRule: TOptionsNormalizerRule = (options: IOptions): IOptions => {
if (options.stringArrayCallsTransformThreshold === 0) {
options = {
...options,
stringArrayCallsTransform: false,
@@ -771,12 +771,12 @@ describe('OptionsNormalizer', () => {
});
});
describe('stringArrayCallsTransformRule', () => {
describe('stringArrayCallsTransformThresholdRule', () => {
before(() => {
optionsPreset = getNormalizedOptions({
...getDefaultOptions(),
stringArrayCallsTransform: false,
stringArrayCallsTransformThreshold: 1
stringArrayCallsTransform: true,
stringArrayCallsTransformThreshold: 0
});
expectedOptionsPreset = {