This file has been truncated, but you can view the full file.
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
/** | |
* return the mid value among x, y, and z | |
* @param x | |
* @param y | |
* @param z | |
* @param compare | |
* @returns {Promise.<*>} | |
*/ | |
async function getPivot(x, y, z, compare) { | |
if (await compare(x, y) < 0) { |
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
class Some<A> implements Optional<A> { | |
constructor(private a: A) { | |
} | |
getOrElse(a: A) { | |
return this.a; | |
} | |
map<B>(func: (a: A) => B) { | |
return Optional(func(this.a)); | |
} | |
match<B>(cases: { |