MCPcopy Create free account
hub / github.com/SlexAxton/listpattern / ListPattern

Function ListPattern

index.js:115–136  ·  view source on GitHub ↗

* @param {object} cldrData Ideally you just take the cldr-js value for your * locale and pass it straight in * @param {object} [_defaultConfig] Set a default configuration override for * every invocation of the resulting formatter * * @returns {function} This returns a formatter function that o

(cldrData, _defaultConfig)

Source from the content-addressed store, hash-verified

113 * and default configuration rules
114 */
115function ListPattern(cldrData, _defaultConfig) {
116 var formatter = listPatternFormatter;
117
118 var context = {
119 __cldr__: extractListPatterns(cldrData),
120 __config__: Object.assign(
121 {
122 patternType: DEFAULT_LIST_PATTERN
123 },
124 _defaultConfig || {}
125 )
126 };
127
128 // Return a bound function with the correct context
129 var result = formatter.bind(context);
130
131 // For tests sry…
132 result.__cldr__ = context.__cldr__;
133 result.__config__ = context.__config__;
134
135 return result;
136}
137
138module.exports = ListPattern;

Callers 1

index.test.jsFile · 0.85

Calls 1

extractListPatternsFunction · 0.85

Tested by

no test coverage detected