MCPcopy
hub / github.com/formatjs/formatjs / resolvedOptions

Method resolvedOptions

packages/intl-pluralrules/index.ts:152–179  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

150 })
151 }
152 public resolvedOptions(): Intl.ResolvedPluralRulesOptions {
153 validateInstance(this, 'resolvedOptions')
154 const opts = Object.create(null)
155 const internalSlots = getInternalSlots(this)
156 opts.locale = internalSlots.locale
157 opts.type = internalSlots.type
158 ;(
159 [
160 'minimumIntegerDigits',
161 'minimumFractionDigits',
162 'maximumFractionDigits',
163 'minimumSignificantDigits',
164 'maximumSignificantDigits',
165 ] as Array<keyof PluralRulesInternal>
166 ).forEach(field => {
167 const val = internalSlots[field]
168 if (val !== undefined) {
169 opts[field] = val
170 }
171 })
172
173 opts.pluralCategories = [
174 ...PluralRules.localeData[opts.locale].categories[
175 opts.type as 'cardinal'
176 ],
177 ]
178 return opts
179 }
180 public select(val: number | bigint): LDMLPluralRule {
181 validateInstance(this, 'select')
182 // Use ToIntlMathematicalValue which handles bigint per ECMA-402

Callers

nothing calls this directly

Calls 2

validateInstanceFunction · 0.70
getInternalSlotsFunction · 0.70

Tested by

no test coverage detected