Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let NUMBERS_LOCALES_HASH = glob.sync("*/numbers.json", {
cwd: path.resolve(CLDR_NUMBERS_DIR, "main")
}).reduce((hash, filename) => {
hash[path.dirname(filename)] = true
return hash
}, {})
let CURRENCIES_LOCALES_HASH = glob.sync("*/currencies.json", {
cwd: path.resolve(CLDR_NUMBERS_DIR, "main")
}).reduce((hash, filename) => {
hash[path.dirname(filename)] = true
return hash
}, {})
let DEFAULT_CONTENT_ARRAY = require("cldr-core/defaultContent.json")
.defaultContent.map((value) => value.replace(/_/g, "-"))
// Some locales that have a `pluralRuleFunction` don't have a `dateFields.json`
// file, and visa versa, so this creates a unique collection of all locales in
// the CLDR for which we need data from.
let ALL_LOCALES_HASH =
Object.keys(PARENT_LOCALES_HASH)
.concat(Object.keys(CALENDARS_LOCALES_HASH))
.concat(Object.keys(NUMBERS_LOCALES_HASH))
.concat(Object.keys(CURRENCIES_LOCALES_HASH))
.concat(DEFAULT_CONTENT_ARRAY)
.sort()
.reduce((hash, locale) => {
hash[locale.toLowerCase()] = locale
return hash
}, {})