Class: PieceLocation
The metadata class used for Pieces.
Constructors
constructor
• new PieceLocation(full
, root
): PieceLocation
Parameters
Name | Type | Description |
---|---|---|
full | string | The full path to the file. |
root | string | The root directory the file was found from. |
Returns
Defined in
projects/pieces/src/lib/structures/PieceLocation.ts:22
Properties
full
• Readonly
full: string
The full path to the file.
Defined in
projects/pieces/src/lib/structures/PieceLocation.ts:11
root
• Readonly
root: string
The root directory the file was found from.
Defined in
projects/pieces/src/lib/structures/PieceLocation.ts:16
Accessors
directories
• get
directories(): string
[]
The names of the directories that separate PieceLocation.root and PieceLocation.full.
Returns
string
[]
Example
const location = new PieceLocation(
'/usr/src/app/commands',
'/usr/src/app/commands/games/multiplayer/connect-four.js'
);
console.log(location.directories);
// → ['games', 'multiplayer']
Defined in
projects/pieces/src/lib/structures/PieceLocation.ts:64
name
• get
name(): string
The name and extension of the file that was loaded, extracted from PieceLocation.full.
Returns
string
Example
const location = new PieceLocation(
'/usr/src/app/commands',
'/usr/src/app/commands/games/multiplayer/connect-four.js'
);
console.log(location.name);
// → 'connect-four.js'
Defined in
projects/pieces/src/lib/structures/PieceLocation.ts:81
relative
• get
relative(): string
The relative path between PieceLocation.root and PieceLocation.full.
Returns
string
Example
const location = new PieceLocation(
'/usr/src/app/commands',
'/usr/src/app/commands/general/ping.js'
);
console.log(location.relative);
// → 'general/ping.js'
Defined in
projects/pieces/src/lib/structures/PieceLocation.ts:47