Browse Source

Updated option normalizers for `stringArrayCallsTransform` option

sanex 3 years ago
parent
commit
711a135334

+ 2 - 2
src/options/OptionsNormalizer.ts

@@ -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,
     ];

+ 2 - 2
src/options/normalizer-rules/StringArrayCallsTransform.ts → src/options/normalizer-rules/StringArrayCallsTransformThresholdRule.ts

@@ -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,

+ 3 - 3
test/functional-tests/options/OptionsNormalizer.spec.ts

@@ -771,12 +771,12 @@ describe('OptionsNormalizer', () => {
             });
         });
 
-        describe('stringArrayCallsTransformRule', () => {
+        describe('stringArrayCallsTransformThresholdRule', () => {
             before(() => {
                 optionsPreset = getNormalizedOptions({
                     ...getDefaultOptions(),
-                    stringArrayCallsTransform: false,
-                    stringArrayCallsTransformThreshold: 1
+                    stringArrayCallsTransform: true,
+                    stringArrayCallsTransformThreshold: 0
                 });
 
                 expectedOptionsPreset = {