Class: PieceLocation
Defined in: projects/pieces/src/lib/structures/PieceLocation.ts:7
The metadata class used for Pieces.
Constructors
new PieceLocation()
new PieceLocation(
full
:string
,root
:string
):PieceLocation
Defined in: projects/pieces/src/lib/structures/PieceLocation.ts:22
Parameters
Parameter | Type | Description |
---|---|---|
full | string | The full path to the file. |
root | string | The root directory the file was found from. |
Returns
Properties
full
readonly
full:string
Defined in: projects/pieces/src/lib/structures/PieceLocation.ts:11
The full path to the file.
root
readonly
root:string
Defined in: projects/pieces/src/lib/structures/PieceLocation.ts:16
The root directory the file was found from.
Accessors
directories
Get Signature
get directories():
string
[]
Defined in: projects/pieces/src/lib/structures/PieceLocation.ts:64
The names of the directories that separate PieceLocation.root and PieceLocation.full.
Example
const location = new PieceLocation(
'/usr/src/app/commands',
'/usr/src/app/commands/games/multiplayer/connect-four.js'
);
console.log(location.directories);
// → ['games', 'multiplayer']
Returns
string
[]
name
Get Signature
get name():
string
Defined in: projects/pieces/src/lib/structures/PieceLocation.ts:81
The name and extension of the file that was loaded, extracted from PieceLocation.full.
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'
Returns
string
relative
Get Signature
get relative():
string
Defined in: projects/pieces/src/lib/structures/PieceLocation.ts:47
The relative path between PieceLocation.root and PieceLocation.full.
Example
const location = new PieceLocation(
'/usr/src/app/commands',
'/usr/src/app/commands/general/ping.js'
);
console.log(location.relative);
// → 'general/ping.js'
Returns
string
virtual
Get Signature
get virtual():
boolean
Defined in: projects/pieces/src/lib/structures/PieceLocation.ts:30
Whether the file is virtual or not.
Returns
boolean
Methods
toJSON()
toJSON():
PieceLocationJSON
Defined in: projects/pieces/src/lib/structures/PieceLocation.ts:88
Defines the JSON.stringify
behavior of this structure.