convertFrom()
This function is used to calculate XP from a level, or vise versa.
Parametersβ
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
value | number | β | The value to convert. | |
type | "level" or "xp" | β | level | Type to convert from. |
Return valueβ
Throwsβ
XpFatal
- If the value is not a number, or type is invalid.
Exampleβ
const {convertFrom} = require('simply-xp');
const value = 10;
const type = "level";
const result = convertFrom(value, type)
console.log(result) // Returns Result