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

Commit 42eea92

Browse files
committed
big commit to align with new spec (splitting src/core into pieces to match sections in the spec, adopting eslint and babel). branch is still unstable.
1 parent 6731ed3 commit 42eea92

19 files changed

+3475
-3131
lines changed

.babelrc

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"plugins": [
3+
"transform-es2015-modules-commonjs"
4+
],
5+
"ignore": [
6+
"dist/*.js",
7+
"lib/*.js",
8+
"locale-data/*.js"
9+
]
10+
}

.eslintignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
dist/
2+
lib/
3+
locale-data/
4+
tasks/
5+
tests/
6+
tmp/
7+
t.js

.eslintrc

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"parser": "babel-eslint",
3+
"extends": "eslint:recommended",
4+
"parserOptions": {
5+
"ecmaVersion": 6,
6+
"sourceType": "module",
7+
"ecmaFeatures": {},
8+
},
9+
"env": {
10+
"node": true,
11+
"browser": true
12+
},
13+
"rules": {
14+
"no-console": 0,
15+
16+
"arrow-parens": [2, "always"],
17+
"comma-dangle": [2, "always-multiline"],
18+
"eqeqeq": 2,
19+
"linebreak-style": [2, "unix"],
20+
"prefer-arrow-callback": 2,
21+
"semi": [2, "always"],
22+
"strict": [2, "never"],
23+
"yoda": [2, "never"],
24+
25+
"no-alert": 2,
26+
"no-const-assign": 2,
27+
"no-else-return": 2,
28+
"no-this-before-super": 2,
29+
"no-unexpected-multiline": 2,
30+
"no-var": 2,
31+
"no-warning-comments": 1
32+
}
33+
}

index.js

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
1-
var m = require('./lib/core.js'),
2-
IntlPolyfill = m['default'];
3-
41
// Expose `IntlPolyfill` as global to add locale data into runtime later on.
5-
global.IntlPolyfill = IntlPolyfill;
2+
global.IntlPolyfill = require('./lib/core.js');
63

74
// Require all locale data for `Intl`. This module will be
85
// ignored when bundling for the browser with Browserify/Webpack.
96
require('./locale-data/complete.js');
107

118
// hack to export the polyfill as global Intl if needed
129
if (!global.Intl) {
13-
global.Intl = IntlPolyfill;
14-
IntlPolyfill.__applyLocaleSensitivePrototypes();
10+
global.Intl = global.IntlPolyfill;
11+
global.IntlPolyfill.__applyLocaleSensitivePrototypes();
1512
}
1613

1714
// providing an idiomatic api for the nodejs version of this module
18-
module.exports = exports = IntlPolyfill;
19-
// preserving the original api in case another module is relying on that
20-
exports['default'] = IntlPolyfill;
15+
module.exports = global.IntlPolyfill;

src/.babelrc

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"presets": [
3+
"es2015"
4+
],
5+
"plugins": [
6+
"transform-object-rest-spread",
7+
"transform-es3-member-expression-literals",
8+
"transform-es3-property-literals"
9+
]
10+
}

src/10.collator.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// Collator is not implemented in this polyfill.

0 commit comments

Comments
 (0)