Sha256: acc24b4ab6c70138af2026b2405d7a29a387fff9e9cbf382747acc640613fcde

Contents?: true

Size: 475 Bytes

Versions: 72

Compression:

Stored size: 475 Bytes

Contents

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

	function flatten( input ) {
		var accumulator = [];
		
		// Loop over items in array
		input
			.each( function( i ) {
				// Skip nulls
				if( !isNull( i ) ) {
					// Simple values get added
					if( isArray( i ) ) {
						accumulator.append( flatten( i ), true );
					// Nested arrays recurse
					} else {
						accumulator.append( i );
					}
				}
			} );
		return accumulator;
	}
			
}

Version data entries

72 entries across 71 versions & 1 rubygems

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