(s, o, i = 'keyword')
| 20504 | 'value', |
| 20505 | ] |
| 20506 | function compileKeywords(s, o, i = 'keyword') { |
| 20507 | const a = {} |
| 20508 | return ( |
| 20509 | 'string' == typeof s |
| 20510 | ? compileList(i, s.split(' ')) |
| 20511 | : Array.isArray(s) |
| 20512 | ? compileList(i, s) |
| 20513 | : Object.keys(s).forEach(function (i) { |
| 20514 | Object.assign(a, compileKeywords(s[i], o, i)) |
| 20515 | }), |
| 20516 | a |
| 20517 | ) |
| 20518 | function compileList(s, i) { |
| 20519 | ;(o && (i = i.map((s) => s.toLowerCase())), |
| 20520 | i.forEach(function (o) { |
| 20521 | const i = o.split('|') |
| 20522 | a[i[0]] = [s, scoreForKeyword(i[0], i[1])] |
| 20523 | })) |
| 20524 | } |
| 20525 | } |
| 20526 | function scoreForKeyword(s, o) { |
| 20527 | return o |
| 20528 | ? Number(o) |
no test coverage detected