| 1234567891011121314151617181920212223 |
- function getDictionaryOptions() {
- if (arguments.length !== 2) return [];
- var keys = arguments[0].map(function (item) { return item.key; });
- var index = keys.indexOf(arguments[1]);
- return index !== -1 ? arguments[0][index].options : []
- };
- function getDictionaryLabel() {
- if (arguments.length !== 3) return '';
- var options = getDictionaryOptions(arguments[0], arguments[1]);
- var keys = options.map(function (item) { return item.value; });
- var index = keys.indexOf(arguments[2]);
- return index !== -1 ? options[index].label : ''
- };
- module.exports = {
- options: getDictionaryOptions,
- label: getDictionaryLabel
- };
|