jscrewit 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/jscrewit.js CHANGED
@@ -1076,16 +1076,6 @@
1076
1076
  includes: ['NO_IE_SRC', 'NO_V8_SRC'],
1077
1077
  excludes: ['NO_FF_SRC'],
1078
1078
  },
1079
- FILL:
1080
- {
1081
- description: 'Existence of the native function Array.prototype.fill.',
1082
- check:
1083
- function ()
1084
- {
1085
- var available = Array.prototype.fill;
1086
- return available;
1087
- },
1088
- },
1089
1079
  FLAT:
1090
1080
  {
1091
1081
  description: 'Existence of the native function Array.prototype.flat.',
@@ -1298,6 +1288,16 @@
1298
1288
  return available;
1299
1289
  },
1300
1290
  },
1291
+ RUSSIAN_INFINITY:
1292
+ {
1293
+ description: 'Russian string representation of Infinity as "∞".',
1294
+ check:
1295
+ function ()
1296
+ {
1297
+ var available = Infinity.toLocaleString('ru') === '∞';
1298
+ return available;
1299
+ },
1300
+ },
1301
1301
  SELF:
1302
1302
  {
1303
1303
  description:
@@ -1381,7 +1381,6 @@
1381
1381
  'BARPROP',
1382
1382
  'DOCUMENT',
1383
1383
  'ESC_HTML_QUOT',
1384
- 'FILL',
1385
1384
  'FLAT',
1386
1385
  'FROM_CODE_POINT',
1387
1386
  'FUNCTION_19_LF',
@@ -1392,6 +1391,7 @@
1392
1391
  'NAME',
1393
1392
  'NO_IE_SRC',
1394
1393
  'REGEXP_STRING_ITERATOR',
1394
+ 'RUSSIAN_INFINITY',
1395
1395
  'STATUS',
1396
1396
  'WINDOW',
1397
1397
  ],
@@ -1424,7 +1424,6 @@
1424
1424
  'BARPROP',
1425
1425
  'DOCUMENT',
1426
1426
  'ESC_HTML_QUOT',
1427
- 'FILL',
1428
1427
  'FLAT',
1429
1428
  'FROM_CODE_POINT',
1430
1429
  'FUNCTION_19_LF',
@@ -1435,6 +1434,7 @@
1435
1434
  'LOCALE_NUMERALS_EXT',
1436
1435
  'NAME',
1437
1436
  'REGEXP_STRING_ITERATOR',
1437
+ 'RUSSIAN_INFINITY',
1438
1438
  'STATUS',
1439
1439
  'V8_SRC',
1440
1440
  'WINDOW',
@@ -1475,7 +1475,6 @@
1475
1475
  'DOCUMENT',
1476
1476
  'ESC_HTML_QUOT',
1477
1477
  'FF_SRC',
1478
- 'FILL',
1479
1478
  'FLAT',
1480
1479
  'FROM_CODE_POINT',
1481
1480
  'FUNCTION_19_LF',
@@ -1486,6 +1485,7 @@
1486
1485
  'NAME',
1487
1486
  'OBJECT_ARRAY_ENTRIES_CTOR',
1488
1487
  'REGEXP_STRING_ITERATOR',
1488
+ 'RUSSIAN_INFINITY',
1489
1489
  'SHORT_LOCALES',
1490
1490
  'STATUS',
1491
1491
  'WINDOW',
@@ -1529,6 +1529,14 @@
1529
1529
  ],
1530
1530
  attributes: { 'char-increment-restriction': null, 'web-worker-restriction': null },
1531
1531
  },
1532
+ IE_11_WIN_8:
1533
+ {
1534
+ inherits: 'IE_11',
1535
+ versions: ['11'],
1536
+ compatibilityTag: 'on Windows 8',
1537
+ compatibilityShortTag: 'W8',
1538
+ includes: { RUSSIAN_INFINITY: true },
1539
+ },
1532
1540
  IE_11_WIN_10:
1533
1541
  {
1534
1542
  inherits: 'IE_11',
@@ -1540,6 +1548,7 @@
1540
1548
  LOCALE_INFINITY: true,
1541
1549
  LOCALE_NUMERALS_BN: true,
1542
1550
  LOCALE_NUMERALS_EXT: true,
1551
+ RUSSIAN_INFINITY: true,
1543
1552
  },
1544
1553
  },
1545
1554
  NODE_20:
@@ -1552,7 +1561,6 @@
1552
1561
  'ARROW',
1553
1562
  'AT',
1554
1563
  'ESC_HTML_QUOT',
1555
- 'FILL',
1556
1564
  'FLAT',
1557
1565
  'FROM_CODE_POINT',
1558
1566
  'FUNCTION_19_LF',
@@ -1563,6 +1571,7 @@
1563
1571
  'NAME',
1564
1572
  'OBJECT_ARRAY_ENTRIES_CTOR',
1565
1573
  'REGEXP_STRING_ITERATOR',
1574
+ 'RUSSIAN_INFINITY',
1566
1575
  'SHORT_LOCALES',
1567
1576
  'V8_SRC',
1568
1577
  ],
@@ -1598,7 +1607,6 @@
1598
1607
  'DOCUMENT',
1599
1608
  'ESC_HTML_QUOT',
1600
1609
  'FF_SRC',
1601
- 'FILL',
1602
1610
  'FLAT',
1603
1611
  'FROM_CODE_POINT',
1604
1612
  'FUNCTION_19_LF',
@@ -1609,6 +1617,7 @@
1609
1617
  'NAME',
1610
1618
  'OBJECT_ARRAY_ENTRIES_CTOR',
1611
1619
  'REGEXP_STRING_ITERATOR',
1620
+ 'RUSSIAN_INFINITY',
1612
1621
  'SHORT_LOCALES',
1613
1622
  'STATUS',
1614
1623
  'WINDOW',
@@ -2249,10 +2258,10 @@
2249
2258
 
2250
2259
  var SIMPLE = createEmpty();
2251
2260
 
2261
+ var FORMAT_MAPPER_LONG;
2262
+ var FORMAT_MAPPER_SHORT;
2252
2263
  var FROM_CHAR_CODE;
2253
2264
  var FROM_CHAR_CODE_CALLBACK_FORMATTER;
2254
- var MAPPER_FORMATTER;
2255
- var OPTIMAL_ARG_NAME;
2256
2265
  var OPTIMAL_B;
2257
2266
  var OPTIMAL_RETURN_STRING;
2258
2267
 
@@ -2274,12 +2283,6 @@
2274
2283
  var FB_R_PADDING_SHIFTS;
2275
2284
  var FH_R_PADDING_SHIFTS;
2276
2285
 
2277
- function chooseOtherArgName(argName)
2278
- {
2279
- var otherArgName = argName !== 'undefined' ? 'undefined' : 'falsefalse';
2280
- return otherArgName;
2281
- }
2282
-
2283
2286
  function createCharDefinitionInFn(expr, index, paddingEntries)
2284
2287
  {
2285
2288
  function charDefinitionInFn(char)
@@ -2570,7 +2573,6 @@
2570
2573
  var DOCUMENT = Feature.DOCUMENT;
2571
2574
  var ESC_HTML_QUOT = Feature.ESC_HTML_QUOT;
2572
2575
  var FF_SRC = Feature.FF_SRC;
2573
- var FILL = Feature.FILL;
2574
2576
  var FLAT = Feature.FLAT;
2575
2577
  var FROM_CODE_POINT = Feature.FROM_CODE_POINT;
2576
2578
  var FUNCTION_19_LF = Feature.FUNCTION_19_LF;
@@ -2589,6 +2591,7 @@
2589
2591
  var OBJECT_W_SELF = Feature.OBJECT_W_SELF;
2590
2592
  var PLAIN_INTL = Feature.PLAIN_INTL;
2591
2593
  var REGEXP_STRING_ITERATOR = Feature.REGEXP_STRING_ITERATOR;
2594
+ var RUSSIAN_INFINITY = Feature.RUSSIAN_INFINITY;
2592
2595
  var SELF = Feature.SELF;
2593
2596
  var SHORT_LOCALES = Feature.SHORT_LOCALES;
2594
2597
  var STATUS = Feature.STATUS;
@@ -2889,9 +2892,6 @@
2889
2892
  define('(RP_1_WA + FILTER)[20]', V8_SRC),
2890
2893
  define('(RP_1_WA + AT)[20]', AT, NO_V8_SRC),
2891
2894
  define('(RP_5_A + AT)[20]', AT, V8_SRC),
2892
- define('(+(RP_0_S + FILL)[0] + FILL)[20]', FILL, NO_FF_SRC),
2893
- define('(RP_5_A + FILL)[20]', FILL, NO_IE_SRC),
2894
- define('(RP_0_S + FILL)[20]', FILL, NO_V8_SRC),
2895
2895
  define('(+(RP_0_S + FLAT)[0] + FLAT)[20]', FLAT, NO_FF_SRC),
2896
2896
  define('(RP_5_A + FLAT)[20]', FLAT, NO_IE_SRC),
2897
2897
  define('(RP_0_S + FLAT)[20]', FLAT, NO_V8_SRC),
@@ -2910,7 +2910,6 @@
2910
2910
  [
2911
2911
  define('escape(FILTER)[20]'),
2912
2912
  define('escape(0 + AT)[20]', AT),
2913
- define('escape(FILL)[21]', FILL),
2914
2913
  define('escape(FLAT)[21]', FLAT),
2915
2914
  define('escape(ANY_FUNCTION)[0]', IE_SRC),
2916
2915
  defineCharDefault(),
@@ -2996,12 +2995,9 @@
2996
2995
  define('escape("}")[2]'),
2997
2996
  define('escape((RP_4_A + [+("1000" + (AT + 0)[31] + 0)] + AT)[40])[2]', AT), // *
2998
2997
  define // *
2999
- ('escape((NaN + [+("10" + [(RP_6_S + FILL)[40]] + "000")] + FILL)[40])[2]', FILL),
3000
- define // *
3001
2998
  ('escape((NaN + [+("10" + [(RP_6_S + FLAT)[40]] + "000")] + FLAT)[40])[2]', FLAT),
3002
2999
  define('escape(FILTER)[50]', V8_SRC),
3003
3000
  define('escape([[]][+(RP_0_S + AT)[0]] + AT)[61]', AT, NO_FF_SRC), // *
3004
- define('escape(FILL)[60]', FF_SRC, FILL),
3005
3001
  ],
3006
3002
  'E':
3007
3003
  [
@@ -3305,6 +3301,7 @@
3305
3301
  define('Infinity[TO_LOCALE_STRING]("ja")[SLICE_OR_SUBSTR]("-1")'),
3306
3302
  define('Infinity[TO_LOCALE_STRING]("ja").at("-1")', AT),
3307
3303
  define('Infinity[TO_LOCALE_STRING]()', LOCALE_INFINITY),
3304
+ define('Infinity[TO_LOCALE_STRING]("ru")', RUSSIAN_INFINITY),
3308
3305
  defineCharDefault(),
3309
3306
  ],
3310
3307
  });
@@ -3397,7 +3394,6 @@
3397
3394
  [
3398
3395
  define('FILTER'),
3399
3396
  define('AT', AT),
3400
- define('FILL', FILL),
3401
3397
  define('FLAT', FLAT),
3402
3398
  ],
3403
3399
  ARRAY_ITERATOR:
@@ -3408,10 +3404,6 @@
3408
3404
  [
3409
3405
  define('[].at', AT),
3410
3406
  ],
3411
- FILL:
3412
- [
3413
- define('[].fill', FILL),
3414
- ],
3415
3407
  FILTER:
3416
3408
  [
3417
3409
  define('[].filter'),
@@ -3485,11 +3477,9 @@
3485
3477
  [
3486
3478
  define('[[true][+(RP_3_WA + FILTER)[30]]]'),
3487
3479
  define('[[true][+(RP_1_WA + AT)[30]]]', AT),
3488
- define('[[true][+(RP_5_A + FILL)[30]]]', FILL),
3489
3480
  define('[[true][+(RP_5_A + FLAT)[30]]]', FLAT),
3490
3481
  define('[[true][+!!++(RP_0_S + FILTER)[20]]]', INCR_CHAR),
3491
3482
  define('[[true][+!!++(RP_1_WA + AT)[20]]]', AT, INCR_CHAR),
3492
- define('[[true][+!!++(RP_0_S + FILL)[20]]]', FILL, INCR_CHAR),
3493
3483
  define('[[true][+!!++(RP_0_S + FLAT)[20]]]', FLAT, INCR_CHAR),
3494
3484
  ],
3495
3485
  FBEP_9_U:
@@ -3499,8 +3489,6 @@
3499
3489
  define
3500
3490
  ({ expr: '[false][+(RP_1_WA + AT)[20]]', solutionType: SolutionType.UNDEFINED }, AT),
3501
3491
  define
3502
- ({ expr: '[false][+(RP_0_S + FILL)[20]]', solutionType: SolutionType.UNDEFINED }, FILL),
3503
- define
3504
3492
  ({ expr: '[false][+(RP_0_S + FLAT)[20]]', solutionType: SolutionType.UNDEFINED }, FLAT),
3505
3493
  ],
3506
3494
  FBEP_10_S:
@@ -3536,14 +3524,6 @@
3536
3524
  AT
3537
3525
  ),
3538
3526
  define
3539
- (
3540
- {
3541
- expr: '+("10" + [(RP_6_S + FILL)[40]] + "00000")',
3542
- solutionType: SolutionType.WEAK_ALGEBRAIC,
3543
- },
3544
- FILL
3545
- ),
3546
- define
3547
3527
  (
3548
3528
  {
3549
3529
  expr: '+("10" + [(RP_6_S + FLAT)[40]] + "00000")',
@@ -3570,14 +3550,6 @@
3570
3550
  AT
3571
3551
  ),
3572
3552
  define
3573
- (
3574
- {
3575
- expr: '+("1000" + (FILL + 0)[33] + "000")',
3576
- solutionType: SolutionType.WEAK_ALGEBRAIC,
3577
- },
3578
- FILL
3579
- ),
3580
- define
3581
3553
  (
3582
3554
  {
3583
3555
  expr: '+("1000" + (FLAT + 0)[33] + "000")',
@@ -3692,6 +3664,104 @@
3692
3664
 
3693
3665
  FH_R_PADDING_SHIFTS = [define(1, IE_SRC), define(0, NO_IE_SRC)];
3694
3666
 
3667
+ var FORMAT_MAPPER_ENTRIES =
3668
+ [
3669
+ define
3670
+ (
3671
+ (function () {
3672
+ var formatMapper =
3673
+ function (accessor)
3674
+ {
3675
+ var mapper =
3676
+ 'Function("return function(falsefalse){return function(undefined){return ' +
3677
+ 'falsefalse' + accessor + '}}")()';
3678
+ return mapper;
3679
+ };
3680
+ formatMapper.argName = 'undefined';
3681
+ return formatMapper;
3682
+ })()
3683
+ ),
3684
+ define
3685
+ (
3686
+ (function () {
3687
+ var formatMapper =
3688
+ function (accessor)
3689
+ {
3690
+ var mapper =
3691
+ 'Function("return function(undefined){return this' + accessor + '}")().bind';
3692
+ return mapper;
3693
+ };
3694
+ formatMapper.argName = 'undefined';
3695
+ return formatMapper;
3696
+ })()
3697
+ ),
3698
+ define
3699
+ (
3700
+ (function () {
3701
+ var formatMapper =
3702
+ function (accessor)
3703
+ {
3704
+ var mapper =
3705
+ 'Function("return function(f){return this' + accessor + '}")().bind';
3706
+ return mapper;
3707
+ };
3708
+ formatMapper.argName = 'f';
3709
+ return formatMapper;
3710
+ })()
3711
+ ),
3712
+ define
3713
+ (
3714
+ (function () {
3715
+ var formatMapper =
3716
+ function (accessor)
3717
+ {
3718
+ var mapper =
3719
+ 'Function("return falsefalse=>undefined=>falsefalse' + accessor + '")()';
3720
+ return mapper;
3721
+ };
3722
+ formatMapper.argName = 'undefined';
3723
+ return formatMapper;
3724
+ })(),
3725
+ ARROW
3726
+ ),
3727
+ ];
3728
+
3729
+ FORMAT_MAPPER_LONG =
3730
+ defineList
3731
+ (
3732
+ FORMAT_MAPPER_ENTRIES,
3733
+ [
3734
+ define(0),
3735
+ define(2, ARRAY_ITERATOR),
3736
+ define(0, NO_FF_SRC),
3737
+ define(0, NO_V8_SRC),
3738
+ define(2, ARRAY_ITERATOR, CAPITAL_HTML),
3739
+ define(0, ARRAY_ITERATOR, AT),
3740
+ define(0, ARRAY_ITERATOR, FLAT),
3741
+ define(0, ARRAY_ITERATOR, NO_IE_SRC),
3742
+ define(0, ARRAY_ITERATOR, CAPITAL_HTML, IE_SRC),
3743
+ define(3),
3744
+ ]
3745
+ );
3746
+
3747
+ FORMAT_MAPPER_SHORT =
3748
+ defineList
3749
+ (
3750
+ FORMAT_MAPPER_ENTRIES,
3751
+ [
3752
+ define(0),
3753
+ define(1, ARRAY_ITERATOR),
3754
+ define(0, NO_FF_SRC),
3755
+ define(0, NO_V8_SRC),
3756
+ define(1, ARRAY_ITERATOR, CAPITAL_HTML),
3757
+ define(0, ARRAY_ITERATOR, AT),
3758
+ define(0, ARRAY_ITERATOR, FLAT),
3759
+ define(0, ARRAY_ITERATOR, NO_IE_SRC),
3760
+ define(0, ARRAY_ITERATOR, CAPITAL_HTML, IE_SRC),
3761
+ define(3),
3762
+ ]
3763
+ );
3764
+
3695
3765
  FROM_CHAR_CODE =
3696
3766
  defineList
3697
3767
  (
@@ -3700,30 +3770,37 @@
3700
3770
  define(0),
3701
3771
  define(1),
3702
3772
  define(0, ITERATOR_HELPER),
3703
- define(1, FILL),
3704
- define(0, ARRAY_ITERATOR, CAPITAL_HTML, FROM_CODE_POINT),
3705
- define(1, FLAT, ITERATOR_HELPER),
3706
- define(0, FILL, FROM_CODE_POINT, ITERATOR_HELPER, NAME),
3773
+ define(0, ARRAY_ITERATOR, CAPITAL_HTML),
3707
3774
  define(1, ARRAY_ITERATOR, ITERATOR_HELPER),
3775
+ define(1, AT, ITERATOR_HELPER),
3776
+ define(1, BARPROP, ITERATOR_HELPER),
3777
+ define(1, CAPITAL_HTML, ITERATOR_HELPER),
3778
+ define(1, FLAT, ITERATOR_HELPER),
3708
3779
  define(1, IE_SRC, ITERATOR_HELPER),
3709
3780
  define(1, ITERATOR_HELPER, NO_IE_SRC),
3710
- define(1, FILL, FLAT, ITERATOR_HELPER, NAME),
3711
- define(0, ARRAY_ITERATOR, FILL, FROM_CODE_POINT, ITERATOR_HELPER),
3712
3781
  define(0, ARRAY_ITERATOR, FLAT, FROM_CODE_POINT, ITERATOR_HELPER),
3713
3782
  define(0, ARRAY_ITERATOR, FROM_CODE_POINT, IE_SRC, ITERATOR_HELPER),
3783
+ define(1, ARRAY_ITERATOR, BARPROP, IE_SRC, ITERATOR_HELPER),
3784
+ define(1, ARRAY_ITERATOR, CAPITAL_HTML, IE_SRC, ITERATOR_HELPER),
3714
3785
  define(0, ARRAY_ITERATOR, FROM_CODE_POINT, ITERATOR_HELPER, NO_IE_SRC),
3715
- define(1, ARRAY_ITERATOR, FILL, ITERATOR_HELPER, NO_IE_SRC),
3716
- define(1, ARRAY_ITERATOR, FILL, ITERATOR_HELPER, NO_V8_SRC),
3717
- define(1, ARRAY_ITERATOR, FLAT, ITERATOR_HELPER, NO_IE_SRC),
3718
- define(1, ARRAY_ITERATOR, FLAT, ITERATOR_HELPER, NO_V8_SRC),
3786
+ define(1, ARRAY_ITERATOR, AT, FLAT, ITERATOR_HELPER),
3787
+ define(1, ARRAY_ITERATOR, AT, IE_SRC, ITERATOR_HELPER),
3788
+ define(1, ARRAY_ITERATOR, AT, ITERATOR_HELPER, NO_IE_SRC),
3789
+ define(1, ARRAY_ITERATOR, BARPROP, FLAT, ITERATOR_HELPER),
3790
+ define(1, ARRAY_ITERATOR, BARPROP, ITERATOR_HELPER, NO_IE_SRC),
3791
+ define(1, ARRAY_ITERATOR, CAPITAL_HTML, FLAT, ITERATOR_HELPER),
3792
+ define(1, ARRAY_ITERATOR, CAPITAL_HTML, ITERATOR_HELPER, NO_IE_SRC),
3719
3793
  define(0, ARRAY_ITERATOR, FROM_CODE_POINT, ITERATOR_HELPER, NAME),
3720
- define(1, AT, ITERATOR_HELPER),
3721
- define(1, BARPROP, ITERATOR_HELPER),
3722
- define(1, CAPITAL_HTML, ITERATOR_HELPER),
3723
- define(1, ARRAY_ITERATOR, FILL, IE_SRC, ITERATOR_HELPER, NAME),
3724
- define(1, ARRAY_ITERATOR, FILL, ITERATOR_HELPER, NAME, NO_IE_SRC),
3725
- define(1, ARRAY_ITERATOR, FLAT, IE_SRC, ITERATOR_HELPER, NAME),
3726
- define(1, ARRAY_ITERATOR, FLAT, ITERATOR_HELPER, NAME, NO_IE_SRC),
3794
+ define(1, ARRAY_ITERATOR, AT, ITERATOR_HELPER, NAME),
3795
+ define(1, ARRAY_ITERATOR, BARPROP, ITERATOR_HELPER, NAME),
3796
+ define(1, ARRAY_ITERATOR, CAPITAL_HTML, ITERATOR_HELPER, NAME),
3797
+ define(1, ARRAY_ITERATOR, FLAT, ITERATOR_HELPER, NO_V8_SRC),
3798
+ define(0, ARRAY_ITERATOR, FLAT, FROM_CODE_POINT, ITERATOR_HELPER, NAME, NO_V8_SRC),
3799
+ define(1, ARRAY_ITERATOR, FLAT, IE_SRC, ITERATOR_HELPER),
3800
+ define(1, ARRAY_ITERATOR, FLAT, ITERATOR_HELPER, NO_IE_SRC),
3801
+ define(1, ARRAY_ITERATOR, AT, FLAT, ITERATOR_HELPER, NO_V8_SRC),
3802
+ define(1, ARRAY_ITERATOR, BARPROP, FLAT, ITERATOR_HELPER, NO_V8_SRC),
3803
+ define(1, ARRAY_ITERATOR, CAPITAL_HTML, FLAT, ITERATOR_HELPER, NO_V8_SRC),
3727
3804
  ]
3728
3805
  );
3729
3806
 
@@ -3799,8 +3876,6 @@
3799
3876
  define(0, ARRAY_ITERATOR, CAPITAL_HTML, NO_V8_SRC),
3800
3877
  define(1, ARRAY_ITERATOR, AT, CAPITAL_HTML),
3801
3878
  define(1, ARRAY_ITERATOR, CAPITAL_HTML, FF_SRC, FLAT),
3802
- define(1, ARRAY_ITERATOR, CAPITAL_HTML, FILL, IE_SRC),
3803
- define(1, ARRAY_ITERATOR, CAPITAL_HTML, FILL, NO_IE_SRC),
3804
3879
  define(1, ARRAY_ITERATOR, CAPITAL_HTML, FLAT, IE_SRC),
3805
3880
  define(2, ARRAY_ITERATOR, CAPITAL_HTML),
3806
3881
  define(3, ARRAY_ITERATOR, AT, CAPITAL_HTML, IE_SRC),
@@ -3810,82 +3885,13 @@
3810
3885
  ]
3811
3886
  );
3812
3887
 
3813
- MAPPER_FORMATTER =
3814
- defineList
3815
- (
3816
- [
3817
- define
3818
- (
3819
- function (argName, accessor)
3820
- {
3821
- var otherArgName = chooseOtherArgName(argName);
3822
- var mapper =
3823
- 'Function("return function(' + otherArgName + '){return function(' + argName +
3824
- '){return ' + otherArgName + accessor + '}}")()';
3825
- return mapper;
3826
- }
3827
- ),
3828
- define
3829
- (
3830
- function (argName, accessor)
3831
- {
3832
- var mapper =
3833
- 'Function("return function(' + argName + '){return this' + accessor +
3834
- '}")().bind';
3835
- return mapper;
3836
- }
3837
- ),
3838
- define
3839
- (
3840
- function (argName, accessor)
3841
- {
3842
- var otherArgName = chooseOtherArgName(argName);
3843
- var mapper =
3844
- 'Function("return ' + otherArgName + '=>' + argName + '=>' + otherArgName +
3845
- accessor + '")()';
3846
- return mapper;
3847
- },
3848
- ARROW
3849
- ),
3850
- ],
3851
- [
3852
- define(0),
3853
- define(1, ARRAY_ITERATOR),
3854
- define(0, NO_FF_SRC),
3855
- define(0, NO_V8_SRC),
3856
- define(1, ARRAY_ITERATOR, CAPITAL_HTML),
3857
- define(0, ARRAY_ITERATOR, AT),
3858
- define(0, ARRAY_ITERATOR, FILL),
3859
- define(0, ARRAY_ITERATOR, FLAT),
3860
- define(0, ARRAY_ITERATOR, NO_IE_SRC),
3861
- define(0, ARRAY_ITERATOR, CAPITAL_HTML, IE_SRC),
3862
- define(2),
3863
- ]
3864
- );
3865
-
3866
3888
  NATIVE_FUNCTION_INFOS =
3867
3889
  [
3868
3890
  define({ expr: 'FILTER', shift: 6 }),
3869
- define({ expr: 'FILL', shift: 4 }, FILL),
3870
3891
  define({ expr: 'FLAT', shift: 4 }, FLAT),
3871
3892
  define({ expr: 'AT', shift: 2 }, AT),
3872
3893
  ];
3873
3894
 
3874
- OPTIMAL_ARG_NAME =
3875
- defineList
3876
- (
3877
- [define('f'), define('undefined')],
3878
- [
3879
- define(0),
3880
- define(1, AT),
3881
- define(0, FLAT),
3882
- define(1, FILL, IE_SRC),
3883
- define(1, FILL, NO_IE_SRC),
3884
- define(0, FILL, FLAT, IE_SRC),
3885
- define(0, FILL, FLAT, NO_IE_SRC),
3886
- ]
3887
- );
3888
-
3889
3895
  OPTIMAL_B = defineList([define('B'), define('b')], [define(0), define(1, ARRAY_ITERATOR)]);
3890
3896
 
3891
3897
  OPTIMAL_RETURN_STRING =
@@ -3903,8 +3909,6 @@
3903
3909
  define(0, ARRAY_ITERATOR, CAPITAL_HTML, NO_V8_SRC),
3904
3910
  define(1, ARRAY_ITERATOR, AT, CAPITAL_HTML),
3905
3911
  define(1, ARRAY_ITERATOR, CAPITAL_HTML, FF_SRC, FLAT),
3906
- define(1, ARRAY_ITERATOR, CAPITAL_HTML, FILL, IE_SRC),
3907
- define(1, ARRAY_ITERATOR, CAPITAL_HTML, FILL, NO_IE_SRC),
3908
3912
  define(1, ARRAY_ITERATOR, CAPITAL_HTML, FLAT, IE_SRC),
3909
3913
  define(2),
3910
3914
  ]
@@ -4454,7 +4458,7 @@
4454
4458
 
4455
4459
  var tokenCache = createEmpty();
4456
4460
 
4457
- // Reserved words and that cannot be written with escape sequences.
4461
+ // Reserved words that cannot be written with escape sequences.
4458
4462
  var INESCAPABLE_WORDS = ['false', 'null', 'true'];
4459
4463
 
4460
4464
  // This list includes reserved words and identifiers that would cause a change in a script's
@@ -5743,6 +5747,234 @@
5743
5747
  return figurator;
5744
5748
  }
5745
5749
 
5750
+ /**
5751
+ * An object that exposes properties used to split a string into an array of strings or to join
5752
+ * array elements into a string.
5753
+ *
5754
+ * @typedef Delimiter
5755
+ *
5756
+ * @property {string} separator
5757
+ * An express-parsable expression used as an argument for `String.prototype.split` to split a string
5758
+ * into an array of strings.
5759
+ *
5760
+ * @property {string} joiner
5761
+ * The joiner can be any string. A joiner is inserted between adjacent strings in an array in order
5762
+ * to join them into a single string.
5763
+ */
5764
+
5765
+ function replaceJoinedArrayString(array, joiner, maxLength)
5766
+ {
5767
+ var str = array.join(joiner);
5768
+ var options = { maxLength: maxLength, screwMode: SCREW_AS_BONDED_STRING };
5769
+ var replacement = replaceStaticString(str, options);
5770
+ return replacement;
5771
+ }
5772
+
5773
+ function undefinedAsString(replacement)
5774
+ {
5775
+ if (replacement === '[][[]]')
5776
+ replacement += '+[]';
5777
+ return replacement;
5778
+ }
5779
+
5780
+ /**
5781
+ * Replaces a given array of strings with equivalent JSFuck code.
5782
+ *
5783
+ * Array elements may only contain characters with static definitions in their string
5784
+ * representations.
5785
+ *
5786
+ * @function Encoder#replaceStringArray
5787
+ *
5788
+ * @param {string[]} array
5789
+ * The string array to replace. Empty arrays are not supported.
5790
+ *
5791
+ * @param {Delimiter[]} insertions
5792
+ * An array of delimiters of which at most one will be used to compose a joined string and split it
5793
+ * into an array of strings.
5794
+ *
5795
+ * The encoder can pick an insertion and insert a joiner between any two adjacent elements to mark
5796
+ * the boundary between them. The separator is then used to split the concatenated string back into
5797
+ * its elements.
5798
+ *
5799
+ * @param {Delimiter[]|null} [substitutions]
5800
+ * An array of delimiters, specifying substitutions to be applied to the input elements.
5801
+ *
5802
+ * All substitutions are applied on each element of the input array, in the order they are
5803
+ * specified.
5804
+ *
5805
+ * Substitutions are expensive in two ways: they create additional overhead and prevent certain
5806
+ * optimizations for short arrays to be made. To allow all optimizations to be performed, omit this
5807
+ * argument or set it to null instead of specifying an empty array.
5808
+ *
5809
+ * @param {boolean} [allowZeroForEmptyElements=false]
5810
+ * Indicates whether empty string elements in the input array may be replaced with zeros.
5811
+ *
5812
+ * @param {boolean} [forceString=false]
5813
+ * Indicates whether the elements in the replacement expression should evaluate to strings.
5814
+ *
5815
+ * If this argument is falsy, the elements in the replacement expression may not be equal to those
5816
+ * in the input array, but will have the same string representation.
5817
+ *
5818
+ * Regardless of this argument, the string representation of the value of the whole replacement
5819
+ * expression will be always the same as the string representation of the input array after applying
5820
+ * substitutions (including optional empty string to zero replacements) to its elements.
5821
+ *
5822
+ * @param {number} [maxLength=(NaN)]
5823
+ * The maximum length of the replacement expression.
5824
+ *
5825
+ * If the replacement expression exceeds the specified length, the return value is `undefined`.
5826
+ *
5827
+ * If this parameter is `NaN`, then no length limit is imposed.
5828
+ *
5829
+ * @returns {string|undefined}
5830
+ * The replacement string or `undefined`.
5831
+ */
5832
+ function replaceStringArray
5833
+ (array, insertions, substitutions, allowZeroForEmptyElements, forceString, maxLength)
5834
+ {
5835
+ var replacement;
5836
+ var count = array.length;
5837
+ // Don't even try the split approach for two or less elements if the concat approach can be
5838
+ // applied.
5839
+ if (substitutions || count > 2)
5840
+ {
5841
+ var preReplacement =
5842
+ function ()
5843
+ {
5844
+ // Length of the shortest string replacement "([]+[])".
5845
+ var STRING_REPLACEMENT_MIN_LENGTH = 7;
5846
+
5847
+ // This is for the overhead of "[" + "](" + ")" plus the length of the shortest
5848
+ // separator replacement "[]".
5849
+ var SEPARATOR_MIN_OVERHEAD = 6;
5850
+
5851
+ // This is for the overhead of "[" + "](" + ")" plus the length of the shortest
5852
+ // joiner replacement "[]".
5853
+ var JOINER_MIN_OVERHEAD = 6;
5854
+
5855
+ var joinCount = substitutions ? substitutions.length : 0;
5856
+ var splitCount = joinCount + 1;
5857
+ var maxSplitReplacementLength =
5858
+ (maxLength - STRING_REPLACEMENT_MIN_LENGTH) / splitCount - SEPARATOR_MIN_OVERHEAD;
5859
+ var splitReplacement =
5860
+ this.replaceString('split', { maxLength: maxSplitReplacementLength, optimize: true });
5861
+ if (!splitReplacement)
5862
+ return;
5863
+ var preReplacement = '';
5864
+ if (joinCount)
5865
+ {
5866
+ var maxJoinReplacementLength =
5867
+ (
5868
+ maxLength - STRING_REPLACEMENT_MIN_LENGTH -
5869
+ splitCount * (splitReplacement.length + SEPARATOR_MIN_OVERHEAD)
5870
+ ) /
5871
+ joinCount -
5872
+ JOINER_MIN_OVERHEAD;
5873
+ var joinReplacement =
5874
+ this.replaceString('join', { maxLength: maxJoinReplacementLength });
5875
+ if (!joinReplacement)
5876
+ return;
5877
+ substitutions.forEach
5878
+ (
5879
+ function (substitution)
5880
+ {
5881
+ var separatorReplacement =
5882
+ undefinedAsString(this.replaceExpr(substitution.separator));
5883
+ var joinerReplacement =
5884
+ undefinedAsString(this.replaceString(substitution.joiner));
5885
+ preReplacement +=
5886
+ '[' + splitReplacement + '](' + separatorReplacement + ')[' +
5887
+ joinReplacement + '](' + joinerReplacement + ')';
5888
+ },
5889
+ this
5890
+ );
5891
+ }
5892
+ preReplacement += '[' + splitReplacement + ']';
5893
+ return preReplacement;
5894
+ }
5895
+ .call(this);
5896
+ }
5897
+ if (!substitutions && count > 1)
5898
+ {
5899
+ var concatReplacement =
5900
+ this.replaceString('concat', { maxLength: maxLength, optimize: true });
5901
+ }
5902
+ if (preReplacement)
5903
+ // Approach 1: (array[0] + joiner + array[1] + joiner + array[2]...).split(separator)
5904
+ {
5905
+ // 2 is for the additional overhead of "(" + ")".
5906
+ var maxBulkLength = maxLength - (preReplacement.length + 2);
5907
+ var optimalStrReplacement;
5908
+ var optimalSeparatorReplacement;
5909
+ insertions.forEach
5910
+ (
5911
+ function (insertion)
5912
+ {
5913
+ var strReplacement =
5914
+ replaceJoinedArrayString(array, insertion.joiner, maxBulkLength);
5915
+ if (!strReplacement)
5916
+ return;
5917
+ var separatorReplacement = undefinedAsString(this.replaceExpr(insertion.separator));
5918
+ var bulkLength = strReplacement.length + separatorReplacement.length;
5919
+ if (!(bulkLength > maxBulkLength))
5920
+ {
5921
+ maxBulkLength = bulkLength;
5922
+ optimalStrReplacement = strReplacement;
5923
+ optimalSeparatorReplacement = separatorReplacement;
5924
+ }
5925
+ },
5926
+ this
5927
+ );
5928
+ if (optimalStrReplacement)
5929
+ {
5930
+ replacement =
5931
+ optimalStrReplacement + preReplacement + '(' + optimalSeparatorReplacement + ')';
5932
+ maxLength = replacement.length - 1;
5933
+ }
5934
+ }
5935
+ if
5936
+ (
5937
+ !substitutions &&
5938
+ (
5939
+ count <= 1 ||
5940
+ concatReplacement &&
5941
+ // 4 is the length of the shortest possible replacement "[[]]".
5942
+ // 7 is the length of the shortest possible additional overhead for each following array
5943
+ // element, as in "[" + "](+[])" or "[" + "](![])".
5944
+ !(4 + (concatReplacement.length + 7) * (count - 1) > maxLength)
5945
+ )
5946
+ )
5947
+ // Approach 2: [array[0]].concat(array[1]).concat(array[2])...
5948
+ {
5949
+ var arrayReplacement;
5950
+ var options = { screwMode: forceString ? SCREW_AS_STRING : SCREW_NORMAL };
5951
+ if
5952
+ (
5953
+ !array.some
5954
+ (
5955
+ function (element)
5956
+ {
5957
+ var elementReplacement =
5958
+ undefinedAsString(replaceStaticString(element, options));
5959
+ if (arrayReplacement)
5960
+ {
5961
+ if (elementReplacement === '[]')
5962
+ elementReplacement = allowZeroForEmptyElements ? '+[]' : '[[]]';
5963
+ arrayReplacement +=
5964
+ '[' + concatReplacement + '](' + elementReplacement + ')';
5965
+ }
5966
+ else
5967
+ arrayReplacement = '[' + elementReplacement + ']';
5968
+ var result = arrayReplacement.length > maxLength;
5969
+ return result;
5970
+ }
5971
+ )
5972
+ )
5973
+ replacement = arrayReplacement;
5974
+ }
5975
+ return replacement;
5976
+ }
5977
+
5746
5978
  var ENCODING_TYPE_COMBINED = 'combined';
5747
5979
  var ENCODING_TYPE_EXPRESSION = 'expression';
5748
5980
  var ENCODING_TYPE_TEXT = 'text';
@@ -5829,7 +6061,7 @@
5829
6061
  }
5830
6062
 
5831
6063
  function createCharKeyArrayString
5832
- (encoder, input, charMap, insertions, substitutions, forceString, maxLength)
6064
+ (encoder, input, charMap, insertions, substitutions, areKeysFigures, maxLength)
5833
6065
  {
5834
6066
  var charKeyArray =
5835
6067
  _Array_prototype_map_call
@@ -5842,7 +6074,8 @@
5842
6074
  }
5843
6075
  );
5844
6076
  var charKeyArrayStr =
5845
- encoder.replaceStringArray(charKeyArray, insertions, substitutions, forceString, maxLength);
6077
+ encoder.replaceStringArray
6078
+ (charKeyArray, insertions, substitutions, !areKeysFigures, areKeysFigures, maxLength);
5846
6079
  return charKeyArrayStr;
5847
6080
  }
5848
6081
 
@@ -6028,10 +6261,17 @@
6028
6261
  var figureMaxLength = maxLength - legend.length;
6029
6262
  var figureLegend =
6030
6263
  encoder.replaceStringArray
6031
- (figures, figureLegendInsertions, null, true, figureMaxLength - minCharIndexArrayStrLength);
6264
+ (
6265
+ figures,
6266
+ figureLegendInsertions,
6267
+ null,
6268
+ false,
6269
+ true,
6270
+ figureMaxLength - minCharIndexArrayStrLength
6271
+ );
6032
6272
  if (!figureLegend)
6033
6273
  return;
6034
- var keyFigureArrayStr =
6274
+ var charIndexFigureArrayStr =
6035
6275
  createCharKeyArrayString
6036
6276
  (
6037
6277
  encoder,
@@ -6042,14 +6282,14 @@
6042
6282
  true,
6043
6283
  figureMaxLength - figureLegend.length
6044
6284
  );
6045
- if (!keyFigureArrayStr)
6285
+ if (!charIndexFigureArrayStr)
6046
6286
  return;
6047
- var formatter = encoder.findDefinition(MAPPER_FORMATTER);
6048
- var argName = 'undefined';
6287
+ var formatMapper = encoder.findDefinition(FORMAT_MAPPER_SHORT);
6288
+ var argName = formatMapper.argName;
6049
6289
  var accessor = '.indexOf(' + argName + ')';
6050
- var mapper = formatter(argName, accessor);
6290
+ var mapper = formatMapper(accessor);
6051
6291
  var charIndexArrayStr =
6052
- createJSFuckArrayMapping(encoder, keyFigureArrayStr, mapper, figureLegend);
6292
+ createJSFuckArrayMapping(encoder, charIndexFigureArrayStr, mapper, figureLegend);
6053
6293
  var output = encoder.createDictEncoding(legend, charIndexArrayStr, maxLength);
6054
6294
  return output;
6055
6295
  }
@@ -6186,13 +6426,6 @@
6186
6426
  return strCodes;
6187
6427
  }
6188
6428
 
6189
- function undefinedAsString(replacement)
6190
- {
6191
- if (replacement === '[][[]]')
6192
- replacement += '+[]';
6193
- return replacement;
6194
- }
6195
-
6196
6429
  function wrapWithCall(str)
6197
6430
  {
6198
6431
  var output = this.resolveConstant('Function').replacement + '(' + str + ')()';
@@ -6342,15 +6575,15 @@
6342
6575
 
6343
6576
  /* -------------------------------------------------------------------------------------- *\
6344
6577
 
6345
- Encodes "NINE" as:
6578
+ Encodes "FIFTY" as:
6346
6579
 
6347
- "false2falsefalse1".split(false).map("".charAt.bind("NEI")).join([])
6580
+ "false1falsefalse2false3".split(false).map("".charAt.bind("FITY")).join([])
6348
6581
 
6349
6582
  (split strategy)
6350
6583
 
6351
6584
  Or:
6352
6585
 
6353
- [0].concat(2).concat(0).concat(1).map("".charAt.bind("NEI")).join([])
6586
+ [[]].concat(1).concat(0).concat(2).concat(3).map("".charAt.bind("FITY")).join([])
6354
6587
 
6355
6588
  (concat strategy)
6356
6589
 
@@ -6863,7 +7096,7 @@
6863
7096
  return output;
6864
7097
  },
6865
7098
 
6866
- _maxDecodableArgs: 65533, // Limit imposed by Internet Explorer.
7099
+ _maxDecodableArgs: 65533, // Limit imposed by Internet Explorer.
6867
7100
 
6868
7101
  createDictEncoding:
6869
7102
  function (legend, charIndexArrayStr, maxLength, radix, coerceToInt)
@@ -6871,11 +7104,11 @@
6871
7104
  var mapper;
6872
7105
  if (radix)
6873
7106
  {
6874
- var formatter = this.findDefinition(MAPPER_FORMATTER);
6875
- var argName = this.findDefinition(OPTIMAL_ARG_NAME);
7107
+ var formatMapper = this.findDefinition(FORMAT_MAPPER_LONG);
7108
+ var argName = formatMapper.argName;
6876
7109
  var parseIntArg = (coerceToInt ? '+' : '') + argName;
6877
7110
  var accessor = '[parseInt(' + parseIntArg + ',' + radix + ')]';
6878
- mapper = formatter(argName, accessor);
7111
+ mapper = formatMapper(accessor);
6879
7112
  }
6880
7113
  else
6881
7114
  mapper = '"".charAt.bind';
@@ -6892,232 +7125,11 @@
6892
7125
  function (array, maxLength)
6893
7126
  {
6894
7127
  var result =
6895
- this.replaceStringArray(array, [FALSE_FREE_DELIMITER], null, false, maxLength);
7128
+ this.replaceStringArray(array, [FALSE_FREE_DELIMITER], null, false, false, maxLength);
6896
7129
  return result;
6897
7130
  },
6898
7131
 
6899
- replaceJoinedArrayString:
6900
- function (str, maxLength)
6901
- {
6902
- var options = { maxLength: maxLength, screwMode: SCREW_AS_BONDED_STRING };
6903
- var replacement = replaceStaticString(str, options);
6904
- return replacement;
6905
- },
6906
-
6907
- /**
6908
- * An object that exposes properties used to split a string into an array of strings or to
6909
- * join array elements into a string.
6910
- *
6911
- * @typedef Delimiter
6912
- *
6913
- * @property {string} separator
6914
- * An express-parsable expression used as an argument for `String.prototype.split` to split
6915
- * a string into an array of strings.
6916
- *
6917
- * @property {number} joiner
6918
- * The joiner can be any string. A joiner is inserted between adjacent strings in an array
6919
- * in order to join them into a single string.
6920
- */
6921
-
6922
- /**
6923
- * Replaces a given array of strings with equivalent JSFuck code.
6924
- *
6925
- * Array elements may only contain characters with static definitions in their string
6926
- * representations.
6927
- *
6928
- * @function Encoder#replaceStringArray
6929
- *
6930
- * @param {string[]} array
6931
- * The string array to replace. Empty arrays are not supported.
6932
- *
6933
- * @param {Delimiter[]} insertions
6934
- * An array of delimiters of which at most one will be used to compose a joined string and
6935
- * split it into an array of strings.
6936
- *
6937
- * The encoder can pick an insertion and insert a joiner between any two adjacent elements
6938
- * to mark the boundary between them. The separator is then used to split the concatenated
6939
- * string back into its elements.
6940
- *
6941
- * @param {Delimiter[]|null} [substitutions]
6942
- * An array of delimiters, specifying substitutions to be applied to the input elements.
6943
- *
6944
- * All substitutions are applied on each element of the input array, in the order they are
6945
- * specified.
6946
- *
6947
- * Substitutions are expensive in two ways: they create additional overhead and prevent
6948
- * certain optimizations for short arrays to be made. To allow all optimizations to be
6949
- * performed, omit this argument or set it to null instead of specifying an empty array.
6950
- *
6951
- * @param {boolean} [forceString=false]
6952
- * Indicates whether the elements in the replacement expression should evaluate to strings.
6953
- *
6954
- * If this argument is falsy, the elements in the replacement expression may not be equal to
6955
- * those in the input array, but will have the same string representation.
6956
- *
6957
- * Regardless of this argument, the string representation of the value of the whole
6958
- * replacement expression will be always the same as the string representation of the input
6959
- * array.
6960
- *
6961
- * @param {number} [maxLength=(NaN)]
6962
- * The maximum length of the replacement expression.
6963
- *
6964
- * If the replacement expression exceeds the specified length, the return value is
6965
- * `undefined`.
6966
- *
6967
- * If this parameter is `NaN`, then no length limit is imposed.
6968
- *
6969
- * @returns {string|undefined}
6970
- * The replacement string or `undefined`.
6971
- */
6972
- replaceStringArray:
6973
- function (array, insertions, substitutions, forceString, maxLength)
6974
- {
6975
- var replacement;
6976
- var count = array.length;
6977
- // Don't even try the split approach for 3 or less elements if the concat approach can
6978
- // be applied.
6979
- if (substitutions || count > 3)
6980
- {
6981
- var preReplacement =
6982
- function ()
6983
- {
6984
- // Length of the shortest string replacement "([]+[])".
6985
- var STRING_REPLACEMENT_MIN_LENGTH = 7;
6986
-
6987
- // This is for the overhead of "[" + "](" + ")" plus the length of the shortest
6988
- // separator replacement "[]".
6989
- var SEPARATOR_MIN_OVERHEAD = 6;
6990
-
6991
- // This is for the overhead of "[" + "](" + ")" plus the length of the shortest
6992
- // joiner replacement "[]".
6993
- var JOINER_MIN_OVERHEAD = 6;
6994
-
6995
- var joinCount = substitutions ? substitutions.length : 0;
6996
- var splitCount = joinCount + 1;
6997
- var maxSplitReplacementLength =
6998
- (maxLength - STRING_REPLACEMENT_MIN_LENGTH) / splitCount -
6999
- SEPARATOR_MIN_OVERHEAD;
7000
- var splitReplacement =
7001
- this.replaceString
7002
- ('split', { maxLength: maxSplitReplacementLength, optimize: true });
7003
- if (!splitReplacement)
7004
- return;
7005
- var preReplacement = '';
7006
- if (joinCount)
7007
- {
7008
- var maxJoinReplacementLength =
7009
- (
7010
- maxLength - STRING_REPLACEMENT_MIN_LENGTH -
7011
- splitCount * (splitReplacement.length + SEPARATOR_MIN_OVERHEAD)
7012
- ) /
7013
- joinCount -
7014
- JOINER_MIN_OVERHEAD;
7015
- var joinReplacement =
7016
- this.replaceString('join', { maxLength: maxJoinReplacementLength });
7017
- if (!joinReplacement)
7018
- return;
7019
- substitutions.forEach
7020
- (
7021
- function (substitution)
7022
- {
7023
- var separatorReplacement =
7024
- undefinedAsString(this.replaceExpr(substitution.separator));
7025
- var joinerReplacement =
7026
- undefinedAsString(this.replaceString(substitution.joiner));
7027
- preReplacement +=
7028
- '[' + splitReplacement + '](' + separatorReplacement + ')[' +
7029
- joinReplacement + '](' + joinerReplacement + ')';
7030
- },
7031
- this
7032
- );
7033
- }
7034
- preReplacement += '[' + splitReplacement + ']';
7035
- return preReplacement;
7036
- }
7037
- .call(this);
7038
- }
7039
- if (!substitutions && count > 1)
7040
- {
7041
- var concatReplacement =
7042
- this.replaceString('concat', { maxLength: maxLength, optimize: true });
7043
- }
7044
- if (preReplacement)
7045
- // Approach 1: (array[0] + joiner + array[1] + joiner + array[2]...).split(separator)
7046
- {
7047
- // 2 is for the additional overhead of "(" + ")".
7048
- var maxBulkLength = maxLength - (preReplacement.length + 2);
7049
- var optimalStrReplacement;
7050
- var optimalSeparatorReplacement;
7051
- insertions.forEach
7052
- (
7053
- function (insertion)
7054
- {
7055
- var str = array.join(insertion.joiner);
7056
- var strReplacement = this.replaceJoinedArrayString(str, maxBulkLength);
7057
- if (!strReplacement)
7058
- return;
7059
- var separatorReplacement =
7060
- undefinedAsString(this.replaceExpr(insertion.separator));
7061
- var bulkLength = strReplacement.length + separatorReplacement.length;
7062
- if (!(bulkLength > maxBulkLength))
7063
- {
7064
- maxBulkLength = bulkLength;
7065
- optimalStrReplacement = strReplacement;
7066
- optimalSeparatorReplacement = separatorReplacement;
7067
- }
7068
- },
7069
- this
7070
- );
7071
- if (optimalStrReplacement)
7072
- {
7073
- replacement =
7074
- optimalStrReplacement + preReplacement + '(' + optimalSeparatorReplacement +
7075
- ')';
7076
- maxLength = replacement.length - 1;
7077
- }
7078
- }
7079
- if
7080
- (
7081
- !substitutions &&
7082
- (
7083
- count <= 1 ||
7084
- concatReplacement &&
7085
- // 4 is the length of the shortest possible replacement "[[]]".
7086
- // 7 is the length of the shortest possible additional overhead for each
7087
- // following array element, as in "[" + "](+[])" or "[" + "](![])".
7088
- !(4 + (concatReplacement.length + 7) * (count - 1) > maxLength)
7089
- )
7090
- )
7091
- // Approach 2: [array[0]].concat(array[1]).concat(array[2])...
7092
- {
7093
- var arrayReplacement;
7094
- var options = { screwMode: forceString ? SCREW_AS_STRING : SCREW_NORMAL };
7095
- if
7096
- (
7097
- !array.some
7098
- (
7099
- function (element)
7100
- {
7101
- var elementReplacement =
7102
- undefinedAsString(replaceStaticString(element, options));
7103
- if (arrayReplacement)
7104
- {
7105
- if (elementReplacement === '[]')
7106
- elementReplacement = '[[]]';
7107
- arrayReplacement +=
7108
- '[' + concatReplacement + '](' + elementReplacement + ')';
7109
- }
7110
- else
7111
- arrayReplacement = '[' + elementReplacement + ']';
7112
- var result = arrayReplacement.length > maxLength;
7113
- return result;
7114
- }
7115
- )
7116
- )
7117
- replacement = arrayReplacement;
7118
- }
7119
- return replacement;
7120
- },
7132
+ replaceStringArray: replaceStringArray,
7121
7133
  }
7122
7134
  );
7123
7135
 
@@ -8087,10 +8099,10 @@
8087
8099
  ENTRIES[name + ':available'] = entries.available;
8088
8100
  }
8089
8101
 
8102
+ exposeEntries('FORMAT_MAPPER_LONG', FORMAT_MAPPER_LONG);
8103
+ exposeEntries('FORMAT_MAPPER_SHORT', FORMAT_MAPPER_SHORT);
8090
8104
  exposeEntries('FROM_CHAR_CODE', FROM_CHAR_CODE);
8091
8105
  exposeEntries('FROM_CHAR_CODE_CALLBACK_FORMATTER', FROM_CHAR_CODE_CALLBACK_FORMATTER);
8092
- exposeEntries('MAPPER_FORMATTER', MAPPER_FORMATTER);
8093
- exposeEntries('OPTIMAL_ARG_NAME', OPTIMAL_ARG_NAME);
8094
8106
  exposeEntries('OPTIMAL_B', OPTIMAL_B);
8095
8107
  exposeEntries('OPTIMAL_RETURN_STRING', OPTIMAL_RETURN_STRING);
8096
8108
  }