Sha256: c57266d5de2815241484ea3017eddb15821b574228730c332563841a3525b20b
Contents?: true
Size: 619 Bytes
Versions: 208
Compression:
Stored size: 619 Bytes
Contents
function Bob() { 'use strict'; function isSilence(message) { return message.replace(/\s+/g, '') === ''; } function isShouting(message) { return message.toUpperCase() === message && /[A-Z]/.test(message); } function isAQuestion(message) { return message[message.length - 1] === '?'; } this.hey = function(message) { if (isSilence(message)) { return 'Fine. Be that way!'; } else if (isShouting(message)) { return 'Whoa, chill out!'; } else if (isAQuestion(message)) { return 'Sure.'; } else { return 'Whatever.'; } }; } module.exports = Bob;
Version data entries
208 entries across 208 versions & 1 rubygems