Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
describe('Ordinal rules', () => {
for (var lc in ordinalData.supplemental['plurals-type-ordinal']) {
describe(lc, () => testPluralData('ordinal', lc, getPlural))
}
})
})
function extractOrdinalCategories() {
let ordinals = require('cldr-core/supplemental/ordinals.json').supplemental['plurals-type-ordinal'];
let ordinalCategories = {};
Object.keys(ordinals).forEach(locale => {
ordinalCategories[locale] = Object.keys(ordinals[locale]).map(key => key.replace('pluralRule-count-', ''));
});
return ordinalCategories;
}
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
funcs[locale] += ', ordinal: f[' + ordinal.func + ']'