Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
describe('Cardinal rules', () => {
for (var lc in cardinalData.supplemental['plurals-type-cardinal']) {
describe(lc, () => testPluralData('cardinal', lc, getPlural))
}
})
function extractPluralCategories() {
let plurals = require('cldr-core/supplemental/plurals.json').supplemental['plurals-type-cardinal'];
let pluralCategories = {};
Object.keys(plurals).forEach(locale => {
pluralCategories[locale] = Object.keys(plurals[locale]).map(key => key.replace('pluralRule-count-', ''));
});
return pluralCategories;
}
if (vars.length) fn = ' var ' + vars.join('\n var ') + '\n' + fn
fn = ' function (s/*: string | number */)/*: Rule */ {\n' + fn + 'other\n }'
var index = pluralFunctions.indexOf(fn)
if (index < 0) {
index = pluralFunctions.length
pluralFunctions[index] = fn
}
return {
data: data,
func: index
}
}
var pluralsTypeCardinal = pluralsJSON.supplemental['plurals-type-cardinal']
var pluralsTypeOrdinal = ordinalsJSON.supplemental['plurals-type-ordinal']
var locales = {}
var funcs = {}
for (var locale in pluralsTypeCardinal) {
var cardinal = parseRules(pluralsTypeCardinal[locale])
if (cardinal) {
locales[locale] = { plurals: { cardinal: cardinal.data } }
funcs[locale] = 'cardinal: f[' + cardinal.func + ']'
}
}
for (var locale in pluralsTypeOrdinal) {
var ordinal = parseRules(pluralsTypeOrdinal[locale])
if (ordinal) {
if (locales[locale]) {
locales[locale].plurals.ordinal = ordinal.data