variables

#SideeX# variables

Methods

(static) add(name, value) → {string}

Adds a variable.

Example
import {SideeX} from "@sideex/api"
var sideex = new SideeX();
console.log(sideex.variables.add("var-0", "hello"));
console.log(sideex.variables.get("vars"));
Parameters:
Name Type Description
name string

Name of the variable

value *

Value of the variable


Returns:

varIdString - Id of the variable. varIdString

Type
string

(static) changeName(varIdString, name) → {object}

Changes the name of a variable.

Example
import {SideeX} from "@sideex/api"
var sideex = new SideeX();
sideex.variables.add("var-0", "hello");
console.log(sideex.variables.changeName("var-0", "var-1"));
console.log(sideex.variables.get("vars"));
Parameters:
Name Type Description
varIdString string

Id of the variable. varIdString

name string

New name of the variable


Returns:

{varIdString, name}. varIdString

Type
object

(static) changeValue(varIdString, value) → {object}

Changes the value of a variable.

Example
import {SideeX} from "@sideex/api"
var sideex = new SideeX();
sideex.variables.add("var-0", "hello");
console.log(sideex.variables.changeValue("var-0", "hi"));
console.log(sideex.variables.get("vars"));
Parameters:
Name Type Description
varIdString string

Id of the variable. varIdString

value string

New value of the variable


Returns:

{varIdString, value}. varIdString

Type
object

(static) clearAll()

Deletes all variables.

Example
import {SideeX} from "@sideex/api"
var sideex = new SideeX();
sideex.variables.add();
sideex.variables.add();
sideex.variables.add();
console.log(sideex.variables.get("vars"));
sideex.variables.clearAll();
console.log(sideex.variables.get("vars"));

(static) delete(varIdString) → {string}

Deletes a variable by id.

Example
import {SideeX} from "@sideex/api"
var sideex = new SideeX();
sideex.variables.add();
console.log(sideex.variables.get("vars"));
console.log(sideex.variables.delete("var-0"));
console.log(sideex.variables.get("vars"));
Parameters:
Name Type Description
varIdString string

Id of the variable. varIdString


Returns:

varIdString - Id of the variable. varIdString

Type
string

(static) get(targetopt) → {number|object}

Gets the variables’ details.

Example
import {SideeX} from "@sideex/api"
var sideex = new SideeX();
sideex.variables.add();
sideex.variables.add();
sideex.variables.add();
console.log(sideex.variables.get("vars"));
console.log(sideex.variables.get("count"));
console.log(sideex.variables.get("startNum"));
console.log(sideex.variables.get("varNames"));
Parameters:
Name Type Attributes Default Description
target "count" | "startNum" | "varNames" | "vars" <optional>
"vars"

The target to get the result


Returns:

count | vars | varNames | startNum. count vars varNames startNum

Type
number | object

Type Definitions

count

count

  • The count of variables.
Type:
  • number

startNum

startNum

  • The next variable's starting number.
Type:
  • number

varIdString

varIdString

  • Id of the variable.
Type:
  • string

varNames

Properties:
Name Type Description
varNames.name Array.<boolean>

Whether the name has been used before

varNames

  • The name of all variables.
Type:
  • object

vars

Properties:
Name Type Description
vars.variableData object

Variable's data

Properties
Name Type Description
index index

Variable's index

name string

Variable's name

value *

Variable's value

vars

  • All of the variables.
Type:
  • object