1/** 2 * Copyright (c) 2015-present, Facebook, Inc. 3 * 4 * This source code is licensed under the MIT license found in the 5 * LICENSE file in the root directory of this source tree. 6 * 7 * strict 8 */ 9 10var MAX_LENGTH = 5; 11 12/** 13 * Given [ A, B, C ] return 'A, B, or C'. 14 */ 15export default function orList(items) { 16 var selected = items.slice(0, MAX_LENGTH); 17 return selected.reduce(function (list, quoted, index) { 18 return list + (selected.length > 2 ? ', ' : ' ') + (index === selected.length - 1 ? 'or ' : '') + quoted; 19 }); 20}