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.104 tracks/cfml/exercises/flatten-array/Solution.cfc
trackler-2.2.1.103 tracks/cfml/exercises/flatten-array/Solution.cfc
trackler-2.2.1.102 tracks/cfml/exercises/flatten-array/Solution.cfc
trackler-2.2.1.101 tracks/cfml/exercises/flatten-array/Solution.cfc
trackler-2.2.1.100 tracks/cfml/exercises/flatten-array/Solution.cfc
trackler-2.2.1.99 tracks/cfml/exercises/flatten-array/Solution.cfc
trackler-2.2.1.98 tracks/cfml/exercises/flatten-array/Solution.cfc
trackler-2.2.1.97 tracks/cfml/exercises/flatten-array/Solution.cfc
trackler-2.2.1.96 tracks/cfml/exercises/flatten-array/Solution.cfc
trackler-2.2.1.95 tracks/cfml/exercises/flatten-array/Solution.cfc
trackler-2.2.1.94 tracks/cfml/exercises/flatten-array/Solution.cfc
trackler-2.2.1.93 tracks/cfml/exercises/flatten-array/Solution.cfc
trackler-2.2.1.92 tracks/cfml/exercises/flatten-array/Solution.cfc
trackler-2.2.1.91 tracks/cfml/exercises/flatten-array/Solution.cfc
trackler-2.2.1.90 tracks/cfml/exercises/flatten-array/Solution.cfc
trackler-2.2.1.89 tracks/cfml/exercises/flatten-array/Solution.cfc
trackler-2.2.1.88 tracks/cfml/exercises/flatten-array/Solution.cfc
trackler-2.2.1.87 tracks/cfml/exercises/flatten-array/Solution.cfc
trackler-2.2.1.86 tracks/cfml/exercises/flatten-array/Solution.cfc
trackler-2.2.1.85 tracks/cfml/exercises/flatten-array/Solution.cfc