Skip to content
This repository was archived by the owner on Apr 14, 2021. It is now read-only.

Commit 3445876

Browse files
authored
Merge pull request #184 from andyearnshaw/ie8-trailing-comma
Fixes #181: removing all trailing commas to attempt to restore IE8 compatibility
2 parents 5fe77ee + 39180f1 commit 3445876

16 files changed

+97
-97
lines changed

.eslintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"no-console": 0,
1515

1616
"arrow-parens": [2, "always"],
17-
"comma-dangle": [2, "always-multiline"],
17+
"comma-dangle": [2, "never"],
1818
"eqeqeq": 2,
1919
"linebreak-style": [2, "unix"],
2020
"prefer-arrow-callback": 2,

Gruntfile.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@ module.exports = function (grunt) {
66
pkg: grunt.file.readJSON('package.json'),
77

88
clean: {
9-
test262: ['tmp/test262**', 'data/test262**', 'tests/test262/'],
9+
test262: ['tmp/test262**', 'data/test262**', 'tests/test262/']
1010
},
1111

1212
curl: {
1313
test262: {
1414
src : 'https://github.com/tc39/test262/archive/master.zip',
15-
dest: 'tmp/test262.zip',
16-
},
15+
dest: 'tmp/test262.zip'
16+
}
1717
},
1818

1919
unzip: {
2020
test262: {
2121
src : 'tmp/test262.zip',
22-
dest: 'tmp/',
23-
},
22+
dest: 'tmp/'
23+
}
2424
},
2525

2626
copy: {
@@ -31,10 +31,10 @@ module.exports = function (grunt) {
3131
src : [
3232
'LICENSE',
3333
'test/intl402/**/*.js',
34-
'harness/*.js',
35-
],
36-
},
37-
},
34+
'harness/*.js'
35+
]
36+
}
37+
}
3838

3939
});
4040

@@ -49,7 +49,7 @@ module.exports = function (grunt) {
4949
'curl:test262',
5050
'unzip:test262',
5151
'copy:test262',
52-
'update-tests',
52+
'update-tests'
5353
]);
5454

5555
};

scripts/build-dist.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const bundleConfig = {
1717
format: 'umd',
1818
moduleName: 'IntlPolyfill',
1919
sourceMap: true,
20-
external: ['Intl'],
20+
external: ['Intl']
2121
};
2222

2323
let babelConfig = JSON.parse(fs.readFileSync('src/.babelrc', 'utf8'));
@@ -29,14 +29,14 @@ babelConfig.presets = babelConfig.presets.map((preset) => {
2929
let plugins = [
3030
babel(babelConfig),
3131
commonjs({
32-
sourceMap: true,
33-
}),
32+
sourceMap: true
33+
})
3434
];
3535

3636
if (isProduction) {
3737
plugins.push(
3838
uglify({
39-
warnings: false,
39+
warnings: false
4040
})
4141
);
4242
}

scripts/build-lib.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ babelConfig.presets = babelConfig.presets.map((preset) => {
1414
let bundle = rollup({
1515
entry: p.resolve('src/core.js'),
1616
plugins: [
17-
babel(babelConfig),
18-
],
17+
babel(babelConfig)
18+
]
1919
});
2020

2121
// Cast to native Promise.
2222
bundle = Promise.resolve(bundle);
2323

2424
bundle.then(({write}) => write({
2525
dest: p.resolve('lib/core.js'),
26-
format: 'cjs',
26+
format: 'cjs'
2727
}));
2828

2929
process.on('unhandledRejection', (reason) => {throw reason;});

scripts/utils/extract-calendars.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import * as path from 'path';
44
import {
55
getParentLocale,
66
hasCalendars,
7-
normalizeLocale,
7+
normalizeLocale
88
} from './locales';
99

1010
export default function extractCalendars(locales) {
@@ -53,7 +53,7 @@ export default function extractCalendars(locales) {
5353
// locale doesn't have relative fields, then we fallback to the "root"
5454
// locale's fields.
5555
calendars[locale] = {
56-
calendars: getCalendars(resolvedLocale),
56+
calendars: getCalendars(resolvedLocale)
5757
};
5858

5959
return calendars;
@@ -74,14 +74,14 @@ function loadCalendars(locale) {
7474
"cldr-cal-islamic-full",
7575
"cldr-cal-japanese-full",
7676
"cldr-cal-persian-full",
77-
"cldr-cal-roc-full",
77+
"cldr-cal-roc-full"
7878
];
7979
// walking all packages, selecting calendar files, then
8080
// reading the content of each calendar, and concatenating the set
8181
return pkgs.reduce((calendars, pkgName) => {
8282
let dir = path.resolve(path.dirname(require.resolve(pkgName + '/package.json')), 'main', locale);
8383
let filenames = glob.sync("ca-*.json", {
84-
cwd: dir,
84+
cwd: dir
8585
});
8686
return filenames.reduce((calendars, filename) => {
8787
return Object.assign(calendars, require(path.join(dir, filename)).main[locale].dates.calendars);

scripts/utils/extract-numbers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ module.exports = function extractNumbersFields(locales) {
4747
// locale doesn't have relative fields, then we fallback to the "root"
4848
// locale's fields.
4949
numbers[locale] = {
50-
numbers: getNumbers(resolvedLocale),
50+
numbers: getNumbers(resolvedLocale)
5151
};
5252

5353
return numbers;

scripts/utils/locales.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@ let PARENT_LOCALES_HASH = require('cldr-core/supplemental/parentLocales.json')
1010
.supplemental.parentLocales.parentLocale;
1111

1212
let CALENDARS_LOCALES_HASH = glob.sync('*/ca-*.json', {
13-
cwd: path.resolve(CLDR_DATES_DIR, 'main'),
13+
cwd: path.resolve(CLDR_DATES_DIR, 'main')
1414
}).reduce((hash, filename) => {
1515
hash[path.dirname(filename)] = true;
1616
return hash;
1717
}, {});
1818

1919
let NUMBERS_LOCALES_HASH = glob.sync('*/numbers.json', {
20-
cwd: path.resolve(CLDR_NUMBERS_DIR, 'main'),
20+
cwd: path.resolve(CLDR_NUMBERS_DIR, 'main')
2121
}).reduce((hash, filename) => {
2222
hash[path.dirname(filename)] = true;
2323
return hash;
2424
}, {});
2525

2626
let CURRENCIES_LOCALES_HASH = glob.sync('*/currencies.json', {
27-
cwd: path.resolve(CLDR_NUMBERS_DIR, 'main'),
27+
cwd: path.resolve(CLDR_NUMBERS_DIR, 'main')
2828
}).reduce((hash, filename) => {
2929
hash[path.dirname(filename)] = true;
3030
return hash;

scripts/utils/reduce.js

+13-13
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function createNumberFormats (ptn) {
1818
let patterns = ptn.split(';'),
1919

2020
ret = {
21-
positivePattern: replaceSpecialChars(patterns[0]),
21+
positivePattern: replaceSpecialChars(patterns[0])
2222
};
2323

2424
// Negative patterns aren't always specified, in those cases use '-' + positivePattern
@@ -52,7 +52,7 @@ export default function (locale, data) {
5252
let caMap = {
5353
'gregorian': 'gregory',
5454
'ethiopic-amete-alem': 'ethioaa',
55-
'islamic-civil': 'islamicc',
55+
'islamic-civil': 'islamicc'
5656
};
5757

5858
// Default calendar is always gregorian, apparently
@@ -88,7 +88,7 @@ export default function (locale, data) {
8888
hour12: !/H|k/.test(defaultTimeFormat),
8989

9090
formats: [],
91-
calendars: {},
91+
calendars: {}
9292
},
9393
number: {
9494
// Numbering systems, with the default first
@@ -100,8 +100,8 @@ export default function (locale, data) {
100100
// Symbols
101101
symbols: {},
102102

103-
currencies: {},
104-
},
103+
currencies: {}
104+
}
105105
};
106106

107107
let ptn;
@@ -117,7 +117,7 @@ export default function (locale, data) {
117117
plusSign: sym.plusSign,
118118
minusSign: sym.minusSign,
119119
percentSign: sym.percentSign,
120-
infinity: sym.infinity,
120+
infinity: sym.infinity
121121
};
122122
});
123123

@@ -165,27 +165,27 @@ export default function (locale, data) {
165165
obj.months = {
166166
narrow: gopv(frmt.narrow),
167167
short: gopv(frmt.abbreviated),
168-
long: gopv(frmt.wide),
168+
long: gopv(frmt.wide)
169169
};
170170
}
171171
if ((frmt = data.calendars[cal].days) && (frmt = frmt.format)) {
172172
obj.days = {
173173
narrow: gopv(frmt.narrow),
174174
short: gopv(frmt.abbreviated),
175-
long: gopv(frmt.wide),
175+
long: gopv(frmt.wide)
176176
};
177177
}
178178
if ((frmt = data.calendars[cal].eras)) {
179179
obj.eras = {
180180
narrow: gopv(frmt.eraNarrow),
181181
short: gopv(frmt.eraAbbr),
182-
long: gopv(frmt.eraNames),
182+
long: gopv(frmt.eraNames)
183183
};
184184
}
185185
if ((frmt = data.calendars[cal].dayPeriods) && (frmt = frmt.format)) {
186186
obj.dayPeriods = {
187187
am: (frmt.wide || frmt.abbreviated).am,
188-
pm: (frmt.wide || frmt.abbreviated).pm,
188+
pm: (frmt.wide || frmt.abbreviated).pm
189189
};
190190
}
191191

@@ -195,7 +195,7 @@ export default function (locale, data) {
195195
yMMMMEEEEd: defCa.dateFormats.full,
196196
yMMMMd: defCa.dateFormats.long,
197197
yMMMd: defCa.dateFormats.medium,
198-
yMd: defCa.dateFormats.short,
198+
yMd: defCa.dateFormats.short
199199
};
200200

201201
// Basic Time Formats
@@ -204,7 +204,7 @@ export default function (locale, data) {
204204
hmmsszzzz: defCa.timeFormats.full,
205205
hmsz: defCa.timeFormats.long,
206206
hms: defCa.timeFormats.medium,
207-
hm: defCa.timeFormats.short,
207+
hm: defCa.timeFormats.short
208208
};
209209

210210
ret.date.formats = {
@@ -214,7 +214,7 @@ export default function (locale, data) {
214214
long: defCa.dateTimeFormats.long,
215215
availableFormats: defCa.dateTimeFormats.availableFormats,
216216
dateFormats: basicDateFormats,
217-
timeFormats: basicTimeFormats,
217+
timeFormats: basicTimeFormats
218218
};
219219
});
220220

src/11.numberformat.js

+14-14
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22
// ======================================
33

44
import {
5-
IsWellFormedCurrencyCode,
5+
IsWellFormedCurrencyCode
66
} from "./6.locales-currencies-tz.js";
77

88
import {
9-
Intl,
9+
Intl
1010
} from "./8.intl.js";
1111

1212
import {
1313
CanonicalizeLocaleList,
1414
SupportedLocales,
1515
ResolveLocale,
1616
GetNumberOption,
17-
GetOption,
17+
GetOption
1818
} from "./9.negotiation.js";
1919

2020
import {
@@ -33,14 +33,14 @@ import {
3333
getInternalProperties,
3434
createRegExpRestore,
3535
secret,
36-
objCreate,
36+
objCreate
3737
} from "./util.js";
3838

3939
// Currency minor units output from get-4217 grunt task, formatted
4040
const currencyMinorUnits = {
4141
BHD: 3, BYR: 0, XOF: 0, BIF: 0, XAF: 0, CLF: 4, CLP: 0, KMF: 0, DJF: 0,
4242
XPF: 0, GNF: 0, ISK: 0, IQD: 3, JPY: 0, JOD: 3, KRW: 0, KWD: 3, LYD: 3,
43-
OMR: 3, PYG: 0, RWF: 0, TND: 3, UGX: 0, UYI: 0, VUV: 0, VND: 0,
43+
OMR: 3, PYG: 0, RWF: 0, TND: 3, UGX: 0, UYI: 0, VUV: 0, VND: 0
4444
};
4545

4646
// Define the NumberFormat constructor internally so it cannot be tainted
@@ -58,12 +58,12 @@ export function NumberFormatConstructor () {
5858
defineProperty(Intl, 'NumberFormat', {
5959
configurable: true,
6060
writable: true,
61-
value: NumberFormatConstructor,
61+
value: NumberFormatConstructor
6262
});
6363

6464
// Must explicitly set prototypes as unwritable
6565
defineProperty(Intl.NumberFormat, 'prototype', {
66-
writable: false,
66+
writable: false
6767
});
6868

6969
/**
@@ -89,7 +89,7 @@ export function /*11.1.1.1 */InitializeNumberFormat (numberFormat, locales, opti
8989
// NOTE: Non-standard, for internal use only
9090
if (arguments[0] === secret)
9191
return internal;
92-
},
92+
}
9393
});
9494

9595
// 2. Set the [[initializedIntlObject]] internal property of numberFormat to true.
@@ -321,7 +321,7 @@ function CurrencyDigits(currency) {
321321
/* 11.2.3 */internals.NumberFormat = {
322322
'[[availableLocales]]': [],
323323
'[[relevantExtensionKeys]]': ['nu'],
324-
'[[localeData]]': {},
324+
'[[localeData]]': {}
325325
};
326326

327327
/**
@@ -361,7 +361,7 @@ defineProperty(Intl.NumberFormat, 'supportedLocalesOf', {
361361
// (defined in 9.2.8) with arguments availableLocales, requestedLocales,
362362
// and options.
363363
return SupportedLocales(availableLocales, requestedLocales, options);
364-
}, internals.NumberFormat),
364+
}, internals.NumberFormat)
365365
});
366366

367367
/**
@@ -371,7 +371,7 @@ defineProperty(Intl.NumberFormat, 'supportedLocalesOf', {
371371
*/
372372
/* 11.3.2 */defineProperty(Intl.NumberFormat.prototype, 'format', {
373373
configurable: true,
374-
get: GetFormatNumber,
374+
get: GetFormatNumber
375375
});
376376

377377
function GetFormatNumber() {
@@ -891,7 +891,7 @@ let numSys = {
891891
tamldec: ['\u0BE6', '\u0BE7', '\u0BE8', '\u0BE9', '\u0BEA', '\u0BEB', '\u0BEC', '\u0BED', '\u0BEE', '\u0BEF'],
892892
telu: ['\u0C66', '\u0C67', '\u0C68', '\u0C69', '\u0C6A', '\u0C6B', '\u0C6C', '\u0C6D', '\u0C6E', '\u0C6F'],
893893
thai: ['\u0E50', '\u0E51', '\u0E52', '\u0E53', '\u0E54', '\u0E55', '\u0E56', '\u0E57', '\u0E58', '\u0E59'],
894-
tibt: ['\u0F20', '\u0F21', '\u0F22', '\u0F23', '\u0F24', '\u0F25', '\u0F26', '\u0F27', '\u0F28', '\u0F29'],
894+
tibt: ['\u0F20', '\u0F21', '\u0F22', '\u0F23', '\u0F24', '\u0F25', '\u0F26', '\u0F27', '\u0F28', '\u0F29']
895895
};
896896

897897
/**
@@ -916,7 +916,7 @@ let numSys = {
916916
props = [
917917
'locale', 'numberingSystem', 'style', 'currency', 'currencyDisplay',
918918
'minimumIntegerDigits', 'minimumFractionDigits', 'maximumFractionDigits',
919-
'minimumSignificantDigits', 'maximumSignificantDigits', 'useGrouping',
919+
'minimumSignificantDigits', 'maximumSignificantDigits', 'useGrouping'
920920
],
921921
internal = this !== null && typeof this === 'object' && getInternalProperties(this);
922922

@@ -930,5 +930,5 @@ let numSys = {
930930
}
931931

932932
return objCreate({}, descs);
933-
},
933+
}
934934
});

0 commit comments

Comments
 (0)