Skip to content

Commit

Permalink
refactor(BaseEntity): Remove unused groupBy utility
Browse files Browse the repository at this point in the history
  • Loading branch information
elpete committed Apr 30, 2019
1 parent 3ca65dc commit cde0503
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions models/BaseEntity.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -1048,22 +1048,6 @@ component accessors="true" {
return false;
}

public struct function groupBy( required array items, required string key, boolean forceLookup = false ) {
return items.reduce( function( acc, item ) {
if ( ( isObject( item ) && structKeyExists( item, "get#key#" ) ) || forceLookup ) {
var value = invoke( item, "get#key#" );
}
else {
var value = item[ key ];
}
if ( ! structKeyExists( acc, value ) ) {
acc[ value ] = [];
}
arrayAppend( acc[ value ], item );
return acc;
}, {} );
}

/*=================================
= Read Only =
=================================*/
Expand Down

0 comments on commit cde0503

Please sign in to comment.