| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 
 | function isArray (value) {return typeof value === 'object' && Object.prototype.toString.call(value) === '[object Array]';
 }
 
 function equal (a, b) {
 return a === b;
 }
 
 function mod (value, base) {
 return value % base;
 }
 
 function or (a, b) {
 return Boolean(a) || Boolean(b);
 }
 
 function compose (fnA, fnB) {
 return function () {
 var args = Array.prototype.slice.call(arguments, 0);
 return fnA(fnB.apply(null, args));
 }
 }
 
 function isMultipleOf (baseValues, value) {
 var checkModulus = compose(equal.bind(null, 0), mod);
 return baseValues.map(checkModulus.bind(null, value)).reduce(or);
 }
 
 function sumMultiplesOf3And5 (list) {
 var values = isArray(list) ? values : [],
 isValueAcceptable = isMultipleOf.bind(null, [3, 5]),
 multiples = values.filter(isValueAcceptable),
 total = 0,
 index = 0;
 
 for (index; index < multiples.length; index++) {
 total += multiples[index];
 }
 
 return total;
 }
 
 |