Sha256: a9c04e1afc766df5df11a53923ae18e594f1a6712231b7d7b86f8292a0e6be73
Contents?: true
Size: 649 Bytes
Versions: 47
Compression:
Stored size: 649 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(input) { var message = input.trim(); 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
47 entries across 47 versions & 1 rubygems