Skip to content

Commit

Permalink
add concat method declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyGiretti committed May 25, 2018
1 parent 37cfe11 commit 98490ca
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/services/Arrays.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,20 @@ export class ArraysService {
}

/**
* Creates an array with all falsey values removed.
* Creates an array with all falsey values removed.
* The values false, null, 0, "", undefined, and NaN are falsey.
* @param array
*/
public compact(array: Array<any>): Array<any> {
return _.compact(array);
}

/**
* Creates a new array concatenating array with any additional arrays and/or values.
* @param array
* @param values
*/
public concat<T>(array: Array<T>, ...values: Array<T>): Array<T> {
return _.concat(array, ...values);
}
}

0 comments on commit 98490ca

Please sign in to comment.