-function getFormattedObjects<U, T extends FormattableToJSON> (objects: T[], objectsTotal: number, formattedArg?: any) {
- const formattedObjects: U[] = []
-
- objects.forEach(object => {
- formattedObjects.push(object.toFormattedJSON(formattedArg))
- })
+function getFormattedObjects<U, V, T extends FormattableToJSON<U, V>> (objects: T[], objectsTotal: number, formattedArg?: U) {
+ const formattedObjects = objects.map(o => o.toFormattedJSON(formattedArg))