-
Notifications
You must be signed in to change notification settings - Fork 1
Built In Functions
Peter Thomas edited this page Feb 27, 2025
·
3 revisions
Xplorer has a set of built-in functions that handle the most common needs such as generating a UUID or random number. This list will evolve over time. All syntax is standard, simple JavaScript.
| API | Description | Example |
|---|---|---|
xp.random() |
Random fraction between 0 and 1 | xp.random() |
xp.random(max) |
Random number between 0 and max | xp.random(2000) |
xp.random(min, max) |
Random number between min and max | xp.random(1000, 9999) |
xp.timeMillis() |
Current time in milliseconds (since January 1, 1970), useful for concatenating a random string in many situations | 'John User' + xp.timeMillis() |
xp.typeOf(any) |
Get data type, useful for distinguishing between JSON objects and arrays, result will be a string, one of the following: object, array, function, string, number, boolean, undefined, null and unknown
|
xp.typeOf(myVariable) |
xp.uuid() |
Generate random UUID |