Files: 8bd323651fb1b0b76a2af4d86690309d221f6ab1 / modules / many-people.js
756 bytesRaw
1 | var plugs = require('patchbay/plugs') |
2 | var person = plugs.first(exports.person = []) |
3 | exports.many_people = manyPeople |
4 | |
5 | function manyPeople (ids) { |
6 | ids = Array.from(ids) |
7 | var featuredIds = ids.slice(-3).reverse() |
8 | |
9 | if (ids.length) { |
10 | if (ids.length > 3) { |
11 | return [ |
12 | person(featuredIds[0]), ', ', |
13 | person(featuredIds[1]), |
14 | ' and ', ids.length - 2, ' others' |
15 | ] |
16 | } else if (ids.length === 3) { |
17 | return [ |
18 | person(featuredIds[0]), ', ', |
19 | person(featuredIds[1]), ' and ', |
20 | person(featuredIds[2]) |
21 | ] |
22 | } else if (ids.length === 2) { |
23 | return [ |
24 | person(featuredIds[0]), ' and ', |
25 | person(featuredIds[1]) |
26 | ] |
27 | } else { |
28 | return person(featuredIds[0]) |
29 | } |
30 | } |
31 | } |
32 |
Built with git-ssb-web