ddnet
Version:
A typescript npm package for interacting with data from ddnet.org
39 lines • 940 B
JavaScript
import { Player } from './Player.js';
/**
* Represents a player's partner.
*/
export class Partner {
/**
* The name of this partner.
*/
name;
/**
* The url of this player on ddnet.org
*/
url;
/**
* The amount of finishes the player and this partner share.
*/
finishCount;
/**
* Construct a new {@link Partner} instance.
*/
constructor(data) {
this.name = data.name;
this.url = `https://ddnet.org/players/${encodeURIComponent(this.name)}`;
this.finishCount = data.finishCount;
}
/**
* Returns a new {@link Player} object from the {@link name} of this partner.
*/
async toPlayer() {
return await Player.new(this.name);
}
/**
* Returns the name and url of this player in markdown format.
*/
toString() {
return `[${this.name}](${this.url})`;
}
}
//# sourceMappingURL=Partner.js.map