* @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)
| 113 | * and default configuration rules |
| 114 | */ |
| 115 | function 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 | |
| 138 | module.exports = ListPattern; |
no test coverage detected