Skip to content

Commit

Permalink
Merge pull request #8 from panzerstadt/latest
Browse files Browse the repository at this point in the history
make partitions pass types into callback in Arrayable chains
  • Loading branch information
MZanggl authored Jun 6, 2024
2 parents 04f0bbe + 51ce792 commit e9edb98
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ export function shuffle<T>(value: T[]) {
/**
* Returns a tuple separating the items that pass the given truth test.
*/
export function partition<T>(value: T[], callback: Function) {
export function partition<T>(value: T[], callback: (item: T, index?: number) => boolean) {
const tuple = [[], []] as [T[], T[]]

value.forEach((item, index) => {
Expand Down
2 changes: 1 addition & 1 deletion src/objects/Arrayable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ class Arrayable<T> extends Array<T> {
/**
* Returns a tuple separating the items that pass the given truth test.
*/
partition(callback: Function) {
partition(callback: (item: T) => boolean) {
const partitioned = this.constructor.from(Arr.partition(this, callback))
return partitioned.map(item => this.constructor.from(item))
}
Expand Down

0 comments on commit e9edb98

Please sign in to comment.