Intl.LocaleMatcher ponyfill providing comprehensive locale matching algorithms with support for 'lookup' and 'best fit' strategies
94
{
"context": "This criteria evaluates how effectively an engineer uses @formatjs/intl-localematcher to build a high-performance locale matching system. The focus is on proper utilization of the package's three-tier optimization features including exact matching, locale maximization, and caching mechanisms.",
"type": "weighted_checklist",
"checklist": [
{
"name": "Uses match function",
"description": "The implementation correctly imports and uses the `match()` function from @formatjs/intl-localematcher as the primary locale matching mechanism",
"max_score": 25
},
{
"name": "Handles exact matches",
"description": "The implementation leverages the package's Tier 1 exact matching capability by passing locale arrays directly to the match function, enabling O(1) Set-based lookups",
"max_score": 15
},
{
"name": "Supports maximization",
"description": "The implementation correctly handles locale maximization scenarios (e.g., zh-TW matching zh-Hant-TW) by relying on the package's built-in Tier 2 maximization and fallback logic",
"max_score": 20
},
{
"name": "Position-based preference",
"description": "The implementation preserves the order of requested locales in the array passed to match(), allowing the package's position-based penalty system to prioritize earlier locales",
"max_score": 15
},
{
"name": "Caching strategy",
"description": "The implementation takes advantage of the package's internal WeakMap caching for canonicalized locale arrays by reusing the same array references when possible, or implements additional caching of match results",
"max_score": 15
},
{
"name": "Default locale handling",
"description": "The implementation properly uses the package's default locale parameter in the match() function to handle cases where no suitable match is found",
"max_score": 10
}
]
}Install with Tessl CLI
npx tessl i tessl/npm-formatjs--intl-localematcherdocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10