Skip to content

Commit 20f281e

Browse files
update
1 parent df141cd commit 20f281e

9 files changed

Lines changed: 97 additions & 62 deletions

File tree

Features.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ This table lists features available in the most common engines.
8282
<li><a href="api-doc/interfaces/FeatureAll.md#LOCALE_INFINITY"><code>LOCALE_INFINITY</code></a> (Internet Explorer 11 on Windows 10)
8383
<li><a href="api-doc/interfaces/FeatureAll.md#LOCALE_NUMERALS_BN"><code>LOCALE_NUMERALS_BN</code></a> (Internet Explorer 11 on Windows 10)
8484
<li><a href="api-doc/interfaces/FeatureAll.md#LOCALE_NUMERALS_EXT"><code>LOCALE_NUMERALS_EXT</code></a> (Internet Explorer 11 on Windows 10)
85-
<li><a href="api-doc/interfaces/FeatureAll.md#LOCALE_NUMERALS_IE11_WIN7"><code>LOCALE_NUMERALS_IE11_WIN7</code></a> (Internet Explorer 11 on Windows 7, on Windows 8, and on Windows 10, not in Internet Explorer 11 on Windows 8 and on Windows 10)
86-
<li><a href="api-doc/interfaces/FeatureAll.md#LOCALE_NUMERALS_IE11_WIN7_8"><code>LOCALE_NUMERALS_IE11_WIN7_8</code></a> (Internet Explorer 11 on Windows 7, on Windows 8, and on Windows 10, not in Internet Explorer 11 on Windows 10)
85+
<li><a href="api-doc/interfaces/FeatureAll.md#LOCALE_NUMERALS_IE11_WIN7"><code>LOCALE_NUMERALS_IE11_WIN7</code></a> (Internet Explorer 11 on Windows 7)
86+
<li><a href="api-doc/interfaces/FeatureAll.md#LOCALE_NUMERALS_IE11_WIN7_8"><code>LOCALE_NUMERALS_IE11_WIN7_8</code></a> (Internet Explorer 11 on Windows 7 and on Windows 8)
8787
<li><a href="api-doc/interfaces/FeatureAll.md#NO_FF_SRC"><code>NO_FF_SRC</code></a> (implied by <a href="api-doc/interfaces/FeatureAll.md#IE_SRC"><code>IE_SRC</code></a>)
8888
<li><a href="api-doc/interfaces/FeatureAll.md#NO_V8_SRC"><code>NO_V8_SRC</code></a> (implied by <a href="api-doc/interfaces/FeatureAll.md#IE_SRC"><code>IE_SRC</code></a>)
8989
<li><a href="api-doc/interfaces/FeatureAll.md#OBJECT_W_SELF"><code>OBJECT_W_SELF</code></a> (implied by <a href="api-doc/interfaces/FeatureAll.md#WINDOW"><code>WINDOW</code></a>)

api-doc/interfaces/FeatureAll.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -432,23 +432,23 @@ Available in Chrome, Edge, Firefox, Internet Explorer 11 on Windows 10, Safari,
432432

433433
> **LOCALE\_NUMERALS\_IE11\_WIN7**: [`ElementaryFeature`](ElementaryFeature.md)
434434
435-
Localized number formatting exclusive to Interner Explorer 11 in Windows 7.
435+
Localized number formatting exclusive to Internet Explorer 11 in Windows 7.
436436

437437
#### Remarks
438438

439-
Available in Internet Explorer 11 on Windows 7, on Windows 8, and on Windows 10 before 11 on Windows 8 and on Windows 10.
439+
Available in Internet Explorer 11 on Windows 7.
440440

441441
***
442442

443443
### LOCALE\_NUMERALS\_IE11\_WIN7\_8
444444

445445
> **LOCALE\_NUMERALS\_IE11\_WIN7\_8**: [`ElementaryFeature`](ElementaryFeature.md)
446446
447-
Localized number formatting exclusive to Interner Explorer 11 in Windows 7 and 8.
447+
Localized number formatting exclusive to Internet Explorer 11 in Windows 7 and 8.
448448

449449
#### Remarks
450450

451-
Available in Internet Explorer 11 on Windows 7, on Windows 8, and on Windows 10 before 11 on Windows 10.
451+
Available in Internet Explorer 11 on Windows 7 and on Windows 8.
452452

453453
***
454454

api-doc/interfaces/FeatureConstructor.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -694,11 +694,11 @@ Available in Chrome, Edge, Firefox, Internet Explorer 11 on Windows 10, Safari,
694694

695695
> **LOCALE\_NUMERALS\_IE11\_WIN7**: [`ElementaryFeature`](ElementaryFeature.md)
696696
697-
Localized number formatting exclusive to Interner Explorer 11 in Windows 7.
697+
Localized number formatting exclusive to Internet Explorer 11 in Windows 7.
698698

699699
#### Remarks
700700

701-
Available in Internet Explorer 11 on Windows 7, on Windows 8, and on Windows 10 before 11 on Windows 8 and on Windows 10.
701+
Available in Internet Explorer 11 on Windows 7.
702702

703703
#### Inherited from
704704

@@ -710,11 +710,11 @@ Available in Internet Explorer 11 on Windows 7, on Windows 8, and on Windows 10
710710

711711
> **LOCALE\_NUMERALS\_IE11\_WIN7\_8**: [`ElementaryFeature`](ElementaryFeature.md)
712712
713-
Localized number formatting exclusive to Interner Explorer 11 in Windows 7 and 8.
713+
Localized number formatting exclusive to Internet Explorer 11 in Windows 7 and 8.
714714

715715
#### Remarks
716716

717-
Available in Internet Explorer 11 on Windows 7, on Windows 8, and on Windows 10 before 11 on Windows 10.
717+
Available in Internet Explorer 11 on Windows 7 and on Windows 8.
718718

719719
#### Inherited from
720720

dev/internal/engine-data.mjs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Feature } from '../../lib/jscrewit.js';
1+
import { isDeepStrictEqual } from 'node:util';
2+
import { Feature } from '../../lib/jscrewit.js';
23

34
const AND_FORMATTER = new Intl.ListFormat('en');
45
const OR_FORMATTER = new Intl.ListFormat('en', { type: 'disjunction' });
@@ -37,9 +38,10 @@ export const getAvailabilityByFeature =
3738
return availabilityInfo;
3839
};
3940

40-
export function getDescription(compatibilities, compatibilityIndex, appendPlus)
41+
export function getDescription(compatibilities, start, end, appendPlus)
4142
{
42-
const { tag, versions } = compatibilities[compatibilityIndex];
43+
const describedCompatibilities = compatibilities.slice(start, end);
44+
const [{ tag, versions }] = describedCompatibilities;
4345
const [firstVersion] = versions;
4446
let description = typeof firstVersion === 'string' ? firstVersion : firstVersion.from;
4547
if (isOldAndLatestVersion(versions))
@@ -51,11 +53,10 @@ export function getDescription(compatibilities, compatibilityIndex, appendPlus)
5153
}
5254
if (tag != null)
5355
{
54-
const taggableCompatibilities = compatibilities.slice(compatibilityIndex);
55-
const tags = taggableCompatibilities.map(({ tag }) => tag).filter(tag => tag != null);
56+
const tags = describedCompatibilities.map(({ tag }) => tag).filter(tag => tag != null);
5657
description += ` ${joinWithAnd(tags)}`;
5758
}
58-
if (appendPlus && !isLastVersion(compatibilities, compatibilityIndex))
59+
if (appendPlus && !isLastVersion(describedCompatibilities, 0))
5960
description += '+';
6061
return description;
6162
}
@@ -98,3 +99,12 @@ export function joinWithOr(array)
9899
const returnValue = OR_FORMATTER.format(array);
99100
return returnValue;
100101
}
102+
103+
export function needsUnavailNote(compatibilities, firstAvail, firstUnavail)
104+
{
105+
const returnValue =
106+
firstUnavail &&
107+
!isDeepStrictEqual
108+
(compatibilities[firstAvail].versions, compatibilities[firstUnavail].versions);
109+
return returnValue;
110+
}

dev/make-feature-doc.mjs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Feature } from '../lib/jscrewit.js';
22

3-
import { getAvailabilityByFeature, getDescription, joinWithAnd }
3+
import { getAvailabilityByFeature, getDescription, joinWithAnd, needsUnavailNote }
44
from './internal/engine-data.mjs';
55

66
function formatFeatureName(featureName)
@@ -11,12 +11,12 @@ function formatFeatureName(featureName)
1111
return result;
1212
}
1313

14-
function getCombinedDescription(families, compatibilityIndex = 0)
14+
function getCombinedDescription(families, start, end)
1515
{
1616
function getVersionedName(name)
1717
{
1818
const compatibilities = Feature.FAMILIES[name];
19-
const description = getDescription(compatibilities, compatibilityIndex, true);
19+
const description = getDescription(compatibilities, start, end, true);
2020
const versionedName = description ? `${name} ${description}` : name;
2121
return versionedName;
2222
}
@@ -44,14 +44,15 @@ function getVersioningFor(featureName, families)
4444
const { firstAvail } = availabilityInfo;
4545
if (firstAvail != null)
4646
{
47+
const { firstUnavail } = availabilityInfo;
4748
const notes = [];
4849
if (firstAvail)
4950
{
50-
const availNote = getCombinedDescription(families, firstAvail);
51+
const availNote = getCombinedDescription(families, firstAvail, firstUnavail);
5152
notes.push(availNote);
5253
}
53-
const { firstUnavail } = availabilityInfo;
54-
if (firstUnavail)
54+
const compatibilities = Feature.FAMILIES[anyFamily];
55+
if (needsUnavailNote(compatibilities, firstAvail, firstUnavail))
5556
{
5657
const unavailNote = `not in ${getCombinedDescription(families, firstUnavail)}`;
5758
notes.push(unavailNote);

dev/make-feature-types.mjs

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1-
import { isDeepStrictEqual } from 'node:util';
2-
import { Feature } from '../lib/jscrewit.js';
1+
import { Feature } from '../lib/jscrewit.js';
32

43
import
5-
{ calculateAvailabilityInfo, getAvailabilityByFeature, getDescription, joinWithAnd, joinWithOr }
4+
{
5+
calculateAvailabilityInfo,
6+
getAvailabilityByFeature,
7+
getDescription,
8+
joinWithAnd,
9+
joinWithOr,
10+
needsUnavailNote,
11+
}
612
from './internal/engine-data.mjs';
713

814
const INDENT = ' ';
@@ -130,24 +136,14 @@ export default
130136
let availEntry = family;
131137
if (firstAvail)
132138
{
133-
const preUnavailCompatibilities =
134-
firstUnavail == null ?
135-
compatibilities : compatibilities.slice(0, firstUnavail);
136139
const description =
137-
getDescription(preUnavailCompatibilities, firstAvail, true);
140+
getDescription(compatibilities, firstAvail, firstUnavail, true);
138141
availEntry += ` ${description}`;
139142
}
140-
if
141-
(
142-
firstUnavail &&
143-
!isDeepStrictEqual
144-
(
145-
compatibilities[firstUnavail].versions,
146-
compatibilities[firstAvail].versions,
147-
)
148-
)
143+
if (needsUnavailNote(compatibilities, firstAvail, firstUnavail))
149144
{
150-
const description = getDescription(compatibilities, firstUnavail, false);
145+
const description =
146+
getDescription(compatibilities, firstUnavail, undefined, false);
151147
if (description)
152148
availEntry += ` before ${description}`;
153149
}

src/lib/definitions.js

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ function getFHPaddingEntries(index)
473473
else
474474
expr += '[' + index + ']';
475475
}
476-
var entry = define._callWithFeatures(expr, arguments, 3);
476+
var entry = define._callWithFeatures({ expr: expr, optimize: true }, arguments, 3);
477477
return entry;
478478
}
479479

@@ -1198,6 +1198,11 @@ function getFHPaddingEntries(index)
11981198
define({ expr: '"ar-td"', solutionType: SolutionType.COMBINED_STRING }),
11991199
define({ expr: '"ar"', solutionType: SolutionType.COMBINED_STRING }, SHORT_LOCALES),
12001200
],
1201+
LOCALE_HE:
1202+
[
1203+
define({ expr: '"He"', solutionType: SolutionType.COMBINED_STRING }),
1204+
define({ expr: '"he"', solutionType: SolutionType.COMBINED_STRING }),
1205+
],
12011206
MAP:
12021207
[
12031208
define({ expr: '"map"', optimize: true, solutionType: SolutionType.COMBINED_STRING }),
@@ -1757,13 +1762,28 @@ function getFHPaddingEntries(index)
17571762
useLocaleNumeralDefinition('ا', '"fa"', NaN, 1, LOCALE_NUMERALS_EXT);
17581763
useLocaleNumeralDefinition('ع', '"fa"', NaN, 2, LOCALE_NUMERALS_EXT);
17591764
useLocaleNumeralDefinition('د', '"fa"', NaN, 3, LOCALE_NUMERALS_EXT);
1760-
useLocaleNumeralDefinition('ל', '"he"', NaN, 0, LOCALE_NUMERALS_IE11_WIN7_8);
1765+
useLocaleNumeralDefinition('ש', 'LOCALE_HE', -Infinity, 7, LOCALE_NUMERALS_IE11_WIN7_8);
1766+
useLocaleNumeralDefinition('י', 'LOCALE_HE', Infinity, 1, LOCALE_NUMERALS_IE11_WIN7_8);
1767+
useLocaleNumeralDefinition('נ', 'LOCALE_HE', Infinity, 2, LOCALE_NUMERALS_IE11_WIN7_8);
1768+
useLocaleNumeralDefinition('ו', 'LOCALE_HE', Infinity, 4, LOCALE_NUMERALS_IE11_WIN7_8);
1769+
useLocaleNumeralDefinition('ף', 'LOCALE_HE', Infinity, 5, LOCALE_NUMERALS_IE11_WIN7_8);
1770+
useLocaleNumeralDefinition('ח', 'LOCALE_HE', Infinity, 7, LOCALE_NUMERALS_IE11_WIN7_8);
1771+
useLocaleNumeralDefinition('ב', 'LOCALE_HE', Infinity, 10, LOCALE_NUMERALS_IE11_WIN7_8);
1772+
useLocaleNumeralDefinition('ל', 'LOCALE_HE', NaN, 0, LOCALE_NUMERALS_IE11_WIN7_8);
1773+
useLocaleNumeralDefinition('א', 'LOCALE_HE', NaN, 1, LOCALE_NUMERALS_IE11_WIN7_8);
1774+
useLocaleNumeralDefinition('מ', 'LOCALE_HE', NaN, 3, LOCALE_NUMERALS_IE11_WIN7_8);
1775+
useLocaleNumeralDefinition('ס', 'LOCALE_HE', NaN, 4, LOCALE_NUMERALS_IE11_WIN7_8);
1776+
useLocaleNumeralDefinition('פ', 'LOCALE_HE', NaN, 5, LOCALE_NUMERALS_IE11_WIN7_8);
1777+
useLocaleNumeralDefinition('ר', 'LOCALE_HE', NaN, 6, LOCALE_NUMERALS_IE11_WIN7_8);
17611778
useLocaleNumeralDefinition('非', '"ja"', NaN, 5, LOCALE_NUMERALS_IE11_WIN7_8);
17621779
useLocaleNumeralDefinition('数', '"ja"', NaN, 6, LOCALE_NUMERALS_IE11_WIN7_8);
17631780
useLocaleNumeralDefinition('値', '"ja"', NaN, 7, LOCALE_NUMERALS_IE11_WIN7_8);
17641781
useLocaleNumeralDefinition('ė', '"lt"', Infinity, 7, LOCALE_NUMERALS_IE11_WIN7_8);
17651782
useLocaleNumeralDefinition('ī', '"lv"', Infinity, 6, LOCALE_NUMERALS_IE11_WIN7);
1783+
useLocaleNumeralDefinition('ń', '"pl"', Infinity, 7, LOCALE_NUMERALS_IE11_WIN7_8);
17661784
useLocaleNumeralDefinition('ś', '"pl"', Infinity, 13, LOCALE_NUMERALS_IE11_WIN7_8);
1785+
useLocaleNumeralDefinition('ć', '"pl"', Infinity, 14, LOCALE_NUMERALS_IE11_WIN7_8);
1786+
useLocaleNumeralDefinition('ą', '"pl"', NaN, 14, LOCALE_NUMERALS_IE11_WIN7_8);
17671787
useLocaleNumeralDefinition('н', '"ru"', NaN, 0, LOCALE_NUMERALS_EXT);
17681788
useLocaleNumeralDefinition('е', '"ru"', NaN, 1, LOCALE_NUMERALS_EXT);
17691789
useLocaleNumeralDefinition('ч', '"ru"', NaN, 3, LOCALE_NUMERALS_EXT);

src/lib/features.js

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -323,37 +323,40 @@ var featureInfos =
323323
LOCALE_NUMERALS_IE11_WIN7:
324324
{
325325
description:
326-
'Localized number formatting exclusive to Interner Explorer 11 in Windows 7.',
326+
'Localized number formatting exclusive to Internet Explorer 11 in Windows 7.',
327327
check:
328328
function ()
329329
{
330330
var available =
331-
checkLocaleNumeral('lv', Infinity, /^bezgalība/) &&
332-
checkLocaleNumeral('ru', Infinity, /^бесконечность/);
331+
checkLocaleNumeral('lv', Infinity, /^......ī/) &&
332+
checkLocaleNumeral('ru', Infinity, /^беск.н.ч.о.ть/);
333333
return available;
334334
},
335335
excludes: ['RUSSIAN_INFINITY'],
336336
},
337337
LOCALE_NUMERALS_IE11_WIN7_8:
338338
{
339339
description:
340-
'Localized number formatting exclusive to Interner Explorer 11 in Windows 7 and 8.',
340+
'Localized number formatting exclusive to Internet Explorer 11 in Windows 7 and 8.',
341341
check:
342342
function ()
343343
{
344344
var available =
345345
checkLocaleNumeral('ar', NaN, /^ليس.برقم/) &&
346-
checkLocaleNumeral('ar', Infinity, /^\+لا.نهاية/) &&
347-
checkLocaleNumeral('cs', NaN, /^Není.číslo/) &&
348-
checkLocaleNumeral('el', Infinity, /^Άπειρο/) &&
349-
checkLocaleNumeral('el', NaN, /^μη.αριθμός/) &&
346+
checkLocaleNumeral('ar', Infinity, /^..ا.نه..ة/) &&
347+
checkLocaleNumeral('cs', NaN, /^.....č/) &&
348+
checkLocaleNumeral('el', Infinity, /^Άπε..ο/) &&
349+
checkLocaleNumeral('el', NaN, /^μη.αριθ.ός/) &&
350350
checkLocaleNumeral('he', NaN, /^לא.מספר/) &&
351-
checkLocaleNumeral('ja', Infinity, /^\+/) &&
352-
checkLocaleNumeral('ja', NaN, /^NaN.\(\)/) &&
353-
checkLocaleNumeral('lt', Infinity, /^begalybė/) &&
354-
checkLocaleNumeral('pl', Infinity, /^\+nieskończoność/) &&
351+
checkLocaleNumeral('he', Infinity, /^.ינ.וף.ח..ב/) &&
352+
checkLocaleNumeral('he', -Infinity, /^.......ש/) &&
353+
checkLocaleNumeral('ja', Infinity, /^./) &&
354+
checkLocaleNumeral('ja', NaN, /^...../) &&
355+
checkLocaleNumeral('lt', Infinity, /^.......ė/) &&
356+
checkLocaleNumeral('pl', Infinity, /^.......ń.....ść/) &&
357+
checkLocaleNumeral('pl', NaN, /^..............ą/) &&
355358
checkLocaleNumeral('zh', Infinity, /^/) &&
356-
checkLocaleNumeral('zh-cn', NaN, /^/);
359+
checkLocaleNumeral('zh-cn', NaN, /^../);
357360
return available;
358361
},
359362
},
@@ -701,7 +704,7 @@ var featureInfos =
701704
inherits: 'IE_11',
702705
versions: ['11'],
703706
compatibilityTag: 'on Windows 7',
704-
compatibilityShortTag: 'W8',
707+
compatibilityShortTag: 'W7',
705708
includes:
706709
{
707710
LOCALE_NUMERALS_IE11_WIN7: true,

test/helpers/feature-emulation.helpers.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,10 @@
835835
case 'he':
836836
if (isNaN(number))
837837
returnValue = 'לא\xa0מספר';
838+
else if (+this === Infinity)
839+
returnValue = 'אינסוף חיובי';
840+
else if (+this === -Infinity)
841+
returnValue = 'אינסוף שלילי';
838842
break;
839843
case 'ja':
840844
if (isNaN(number))
@@ -856,15 +860,12 @@
856860
}
857861
break;
858862
case 'pl':
859-
switch (this)
860-
{
861-
case Infinity:
863+
if (isNaN(number))
864+
returnValue = 'nie jest liczbą';
865+
else if (+this === Infinity)
862866
returnValue = '+nieskończoność';
863-
break;
864-
case -Infinity:
867+
else if (+this === -Infinity)
865868
returnValue = '-nieskończoność';
866-
break;
867-
}
868869
break;
869870
case 'zh':
870871
switch (this)
@@ -880,6 +881,10 @@
880881
case 'zh-cn':
881882
if (isNaN(number))
882883
returnValue = '非数字';
884+
else if (+this === Infinity)
885+
returnValue = '正无穷大';
886+
else if (+this === -Infinity)
887+
returnValue = '负无穷大';
883888
break;
884889
}
885890
return returnValue;

0 commit comments

Comments
 (0)