Sha256: ca416635e35f7a38eee1bfb711e37d7bba4b99ff1c01789099c1a97f1698e61c
Contents?: true
Size: 587 Bytes
Versions: 216
Compression:
Stored size: 587 Bytes
Contents
let s:allergy_map = { \ 'eggs': 1, \ 'peanuts': 2, \ 'shellfish': 4, \ 'strawberries': 8, \ 'tomatoes': 16, \ 'chocolate': 32, \ 'pollen': 64, \ 'cats': 128, \ } function! AllergicTo(score, allergy) abort return and(a:score, s:allergy_map[a:allergy]) != 0 endfunction function! List(score) abort return filter(map(sort(items(s:allergy_map), 's:valsort'), \ 'v:val[0]'), 'AllergicTo(a:score, v:val)') endfunction function! s:valsort(a, b) abort return a:a[1] - a:b[1] endfunction
Version data entries
216 entries across 216 versions & 1 rubygems