git ssb

0+

alanz / patchwork



forked from Matt McKegg / patchwork

Tree: 0df7b2e9903705c4b2201aa29a6a6c1560b102af

Files: 0df7b2e9903705c4b2201aa29a6a6c1560b102af / 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