メインコンテンツまでスキップ

convertFrom()

This function is used to calculate XP from a level, or vise versa.

Parameters

ParameterTypeRequiredDefaultDescription
valuenumberThe value to convert.
type"level" or "xp"levelType 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