UNPKG

t-comm

Version:

专业、稳定、纯粹的工具库

37 lines (35 loc) 1 kB
/** * 获取审核人 * @param params 参数 * @returns 审核人 * * @example * ```ts * getAuditorFromRainbowConfig({ * rainbowConfig: { "pmd-mobile/match/*": "gg", "pmd-mobile/convert-cross": "gg" }, * checkKeyList: [ 'pmd-mobile/match/gp/gp-hor', 'pmd-mobile/match/gp' ], * minimatch: require('minimatch'), * minimatchKey: 'pmd-mobile/match/gp', * }) * ``` */ function getAuditorFromRainbowConfig(_a) { var rainbowConfig = _a.rainbowConfig, checkKeyList = _a.checkKeyList, minimatch = _a.minimatch, minimatchKey = _a.minimatchKey; for (var _i = 0, checkKeyList_1 = checkKeyList; _i < checkKeyList_1.length; _i++) { var key = checkKeyList_1[_i]; if (rainbowConfig[key]) { return rainbowConfig[key]; } } var matchedGlob = Object.keys(rainbowConfig).find(function (item) { return minimatch(minimatchKey, item); }); if (matchedGlob) { return rainbowConfig[matchedGlob]; } return ''; } export { getAuditorFromRainbowConfig };