-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
⏪ 🏷️ Revert improper typing modify in master@f6b9793
- Loading branch information
KsRyY
committed
Jan 29, 2020
1 parent
49b7e70
commit 38611fc
Showing
4 changed files
with
21 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
type forEachCallback<T> = (val: T, index?: number, array?: T[]) => void | ||
type forEachCallback<T> = (val: T, index: number, array: T[]) => void | ||
|
||
type curriedMap<T> = (array: T[]) => T[] | ||
type curriedForEach<T> = (array: T[]) => T[] | ||
|
||
function map<T>(cb: forEachCallback<T>): curriedMap<T> | ||
function map<T>(cb: forEachCallback<T>, array: T[]): T[] | ||
function map<T>(cb: forEachCallback<T>, array?: T[]): curriedMap<T> | T[] { | ||
function forEach<T>(cb: forEachCallback<T>): curriedForEach<T> | ||
function forEach<T>(cb: forEachCallback<T>, array: T[]): T[] | ||
function forEach<T>(cb: forEachCallback<T>, array?: T[]): curriedForEach<T> | T[] { | ||
if (typeof array !== 'undefined') { | ||
array.forEach(cb) | ||
return array | ||
} | ||
|
||
return array => map(cb, array) | ||
return array => forEach(cb, array) | ||
} | ||
|
||
export default map | ||
export default forEach |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters