Sha256: 783bc21c6c70c08fe9463a1b49d51561ab7801ee104b9de7c8a268e95701fa22

Contents?: true

Size: 632 Bytes

Versions: 72

Compression:

Stored size: 632 Bytes

Contents

/**
* Here is an example solution for the PigLatin exercise
*/
component {

	function translate( input ) {
		var response = '';
		
		// Loop over each work
		return input
			.listToArray( ' ' )
			.map( function( word ) {
		
				// Vowel sounds 
				if( word.reFindNoCase( '^(a|e|i|o|u|yt|xr)' ) ) {
					return word & 'ay';
				// Consonate sounds
				} else if( word.reFindNoCase( '^(ch|squ|qu|thr|th|sch)' ) ) {
					return word.reReplaceNoCase( '^(ch|squ|qu|thr|th|sch)(.*)', '\2\1ay' );
				// Everything else
				} else {
					return word.right( -1 ) & word.left( 1 ) & 'ay';
				}
						
			} )
			.toList( ' ' );
		
	}
			
}

Version data entries

72 entries across 71 versions & 1 rubygems

Version Path
trackler-2.2.1.84 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.83 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.82 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.81 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.80 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.79 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.78 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.77 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.76 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.75 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.74 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.73 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.72 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.71 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.70 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.69 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.68 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.67 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.66 tracks/cfml/exercises/pig-latin/Solution.cfc
trackler-2.2.1.65 tracks/cfml/exercises/pig-latin/Solution.cfc