mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-10 08:43:09 +02:00
parent
45c5e7b967
commit
c03e2dfbc0
2 changed files with 6 additions and 6 deletions
|
@ -11,8 +11,8 @@ export function countIf<T>(f: Predicate<T>, xs: T[]): number {
|
|||
/**
|
||||
* Count the number of elements that is equal to the element
|
||||
*/
|
||||
export function count<T>(x: T, xs: T[]): number {
|
||||
return countIf(y => x === y, xs);
|
||||
export function count<T>(a: T, xs: T[]): number {
|
||||
return countIf(x => x === a, xs);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -33,8 +33,8 @@ export function intersperse<T>(sep: T, xs: T[]): T[] {
|
|||
/**
|
||||
* Returns the array of elements that is not equal to the element
|
||||
*/
|
||||
export function erase<T>(x: T, xs: T[]): T[] {
|
||||
return xs.filter(y => x !== y);
|
||||
export function erase<T>(a: T, xs: T[]): T[] {
|
||||
return xs.filter(x => x !== a);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
export type Predicate<T> = (x: T) => boolean;
|
||||
export type Predicate<T> = (a: T) => boolean;
|
||||
|
||||
export type Relation<T, U> = (x: T, y: U) => boolean;
|
||||
export type Relation<T, U> = (a: T, b: U) => boolean;
|
||||
|
||||
export type EndoRelation<T> = Relation<T, T>;
|
||||
|
|
Loading…
Reference in a new issue