| 123456789101112131415161718192021222324 |
- 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 v_l = arguments[2] ? arguments[2].split(':') : [];
- var index = keys.indexOf(v_l[0]);
- return index !== -1 ? v_l[1] || options[index].label : ''
- };
- module.exports = {
- options: getDictionaryOptions,
- label: getDictionaryLabel
- };
|