Some common utils for collections
| Legato. | Some common utils for collections |
| Functions | |
| Legato. | Filters given array based on given evaluate method. |
| Legato. | Filters given object based on given evaluate method. |
| Legato. | Transforms given array based on given transformer method. |
| Legato. | Calls a given function on each element of an array |
| copyIfExists | Copies all Properties from source to destination if they exist in source |
Legato.Lang.CollectionUtils.filter = function( array, evaluate )
Filters given array based on given evaluate method. If evaluate method returns true, arrayelement will been keeped. False otherwise.
| array | {Object} The array to filter |
| evaluate | {Function} the filter function |
{Object} The filtered array
Legato.Lang.CollectionUtils.filterObject = function( object, evaluate )
Filters given object based on given evaluate method. If key is in evaluate, object property will be keeped. False otherwise.
| object | {Object} The object to filter |
| evaluate | {Array} the array of properties to keep |
{Object} The filtered object
Legato.Lang.CollectionUtils.transform = function( array, transformer )
Transforms given array based on given transformer method. The new build array will then been returned.
| array | {Object} The array to filter |
| evaluate | {Function} the filter function |
{Object} The filtered array
Filters given array based on given evaluate method.
Legato.Lang.CollectionUtils.filter = function( array, evaluate )
Filters given object based on given evaluate method.
Legato.Lang.CollectionUtils.filterObject = function( object, evaluate )
Transforms given array based on given transformer method.
Legato.Lang.CollectionUtils.transform = function( array, transformer )
Calls a given function on each element of an array
Legato.Lang.CollectionUtils.each = function( array, func )
Copies all Properties from source to destination if they exist in source
Legato.Lang.CollectionUtils.copyIfExists = function( source, destination, properties )