Skip to content

Commit

Permalink
refactor: make arrEvery callback params non-optional
Browse files Browse the repository at this point in the history
  • Loading branch information
owenpearson committed Oct 5, 2023
1 parent 695e5bb commit a298240
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/common/lib/util/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,10 @@ export const arrFilter = (Array.prototype.filter as unknown)
};

export const arrEvery = (Array.prototype.every as unknown)
? function <T>(arr: Array<T>, fn: (value: T, index?: number, arr?: Array<T>) => boolean) {
? function <T>(arr: Array<T>, fn: (value: T, index: number, arr: Array<T>) => boolean) {
return arr.every(fn);
}
: function <T>(arr: Array<T>, fn: (value: T, index?: number, arr?: Array<T>) => boolean) {
: function <T>(arr: Array<T>, fn: (value: T, index: number, arr: Array<T>) => boolean) {
const len = arr.length;
for (let i = 0; i < len; i++) {
if (!fn(arr[i], i, arr)) {
Expand Down

0 comments on commit a298240

Please sign in to comment.