git ssb

10+

Matt McKegg / patchwork



Tree: a821b0ce884300e8ff3901678c19c6827e1189e9

Files: a821b0ce884300e8ff3901678c19c6827e1189e9 / modules / many-people.js

756 bytesRaw
1var plugs = require('patchbay/plugs')
2var person = plugs.first(exports.person = [])
3exports.many_people = manyPeople
4
5function 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