How to use the make-plural.hasOwnProperty function in make-plural

To help you get started, we’ve selected a few make-plural examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github catamphetamine / relative-time-format / bin / generate-locale-messages.js View on Github external
function getPluralRuleFunctionCode(locale) {
	if (plurals.hasOwnProperty(locale)) {
		const expectedLocale = getPluralRulesLocale(locale)
		if (locale !== expectedLocale) {
			throw new Error(`Expected to find pluralization rules for "${expectedLocale}" locale but found them for "${locale}" locale`)
		}
		return {
			locale,
			quantify: new MakePlurals(locale).toString('classify')
		}
	}
	const parts = locale.split('-')
	parts.pop()
	locale = parts.join('-')
	if (locale) {
		return getPluralRuleFunctionCode(locale)
	}
	// Not found.

make-plural

Unicode CLDR pluralization rules as JavaScript functions

ISC
Latest version published 10 days ago

Package Health Score

74 / 100
Full package analysis