12345678910111213141516171819202122232425262728293031 |
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.default = buildLocalizeFn;
- function buildLocalizeFn(args) {
- return function (dirtyIndex, dirtyOptions) {
- var options = dirtyOptions || {};
- var context = options.context ? String(options.context) : 'standalone';
- var valuesArray;
- if (context === 'formatting' && args.formattingValues) {
- var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
- var width = options.width ? String(options.width) : defaultWidth;
- valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
- } else {
- var _defaultWidth = args.defaultWidth;
- var _width = options.width ? String(options.width) : args.defaultWidth;
- valuesArray = args.values[_width] || args.values[_defaultWidth];
- }
- var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
- return valuesArray[index];
- };
- }
- module.exports = exports.default;
|