Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow 'en' in the list of supported locales #9

Merged
merged 7 commits into from
May 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
language: node_js
before_install:
# package-lock.json was introduced in npm@5
- '[[ $(node -v) =~ ^v9.*$ ]] || npm install -g npm@latest' # skipped when using node 9
- npm install -g greenkeeper-lockfile@1
before_script: greenkeeper-lockfile-update
after_script: greenkeeper-lockfile-upload
jobs:
include:
# ↓ The Greenkeeper job
- before_install:
# package-lock.json was introduced in npm@5
- '[[ $(node -v) =~ ^v9.*$ ]] || npm install -g npm@latest' # skipped when using node 9
- npm install -g greenkeeper-lockfile@1
script:
- greenkeeper-lockfile-update
- greenkeeper-lockfile-upload
node_js: "stable"
- script: npm test
node_js: "stable"
# Check that the code is properly parsed in Node.js v4
Expand Down
11 changes: 8 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,18 @@ function normalizeLocalesToKeep(localesToKeep) {
);
}

// Check if has unknown locales
// 'en' is built into Moment, so it doesn't exist in the locales context
localesToKeep = localesToKeep.filter(function(localeName) {
return localeName !== 'en';
});

// Check if it has unknown locales
var absentLocales = localesToKeep.filter(function(localeName) {
const localeData = moment.localeData(localeName);
var localeData = moment.localeData(localeName);
return (
// For Moment 2.20.1−
localeData === null ||
// For Moment. 2.21.0+ – this version now returns a default locale instead of null
// For Moment. 2.21.0+ – this version now returns the localeData of the currently set locale, instead of null
localeData === moment.localeData()
);
});
Expand Down
54 changes: 0 additions & 54 deletions index.test.js

This file was deleted.

Loading