Methods

arrayEquals(a1, a2) → {boolean}

Check if both array are equals

Parameters:
NameTypeDescription
a1Array

array 1

a2Array

array 2

Returns:
  • true if equals
Type: 
boolean

arrayPushOnce(array, element) → {boolean}

Check if the element is alreeady included in the array if not push it

Parameters:
NameTypeDescription
arrayArray

array where to push the element

element*

element to push

Returns:

true if pushed false otherwise

Type: 
boolean

checkIfSubStringIsEuler(subString) → {boolean}

Take an array of string and check if it is in euler format

Parameters:
NameTypeDescription
subStringArray.<string>

array of string

Returns:
  • true if it is euler format
Type: 
boolean

checkIfSubStringIsMatrix4(subString) → {boolean}

Take an array of string and check if it is in matrix4 format

Parameters:
NameTypeDescription
subStringArray.<string>

array of string

Returns:
  • true if it is matrix4 format
Type: 
boolean

checkIfSubStringIsVector3(subString) → {boolean}

Take an array of string and check if it is in vector3 format

Parameters:
NameTypeDescription
subStringArray.<string>

array of string

Returns:
  • true if it is vector3 format
Type: 
boolean

computeFileFormat(filename) → {string}

Compute the last string after the . in the filename

Parameters:
NameTypeDescription
filenamestring

file name

Returns:
  • file format
Type: 
string

computeFilenameFromPath(path) → {string}

Compute filename from path

Parameters:
NameTypeDescription
pathstring

path

Returns:

filename

Type: 
string

dataUriToBuffer(uri) → {Buffer|null}

Convert a data URI into a Buffer

Parameters:
NameTypeDescription
uristring

data uri to convert

Returns:
  • the buffer of the data uri or null if uri is not a data uri
Type: 
Buffer | null

eulerArrayFromURIComponent(uriComp) → {Array.<string>}

Taking a string from the unpacking URI and splitting it into an array of strings.

Parameters:
NameTypeDescription
uriCompstring

The string from the unpacking URI

Returns:
  • returns the array of strings if it is in euler format, otherwise returns null
Type: 
Array.<string>

getAttributeByPath(obj, path) → {*}

Gets an attribute of an object from the given path. To get nested attributes, the path qualifiers must be separated by dots ('.'). If the path is not nested (does not contain any dot), the function is equivalent to obj[path].

Parameters:
NameTypeDescription
objobject

object to get attribute

pathstring

path to get the attribute

Returns:
  • attribute vaue
Type: 
*
Example
const obj = {test: {msg: "Hello world !"}};
console.log(getAttributeByPath(obj, "test.msg")); // prints "Hello world !";
console.log(getAttributeByPath(obj, "other")); // undefined

imageToDataURI(arrayBuffer, mimeType, chunkSize) → {string}

Converts the raw content of an array buffer (as retrieved by a GET request on a file) to a data URI. This is required, for example, to display images fetched from the server. As we need authentication headers to retrieve some protected files, we get the raw data dynamically and need to convert it to a data URI do display it. The basic scheme of the URI is defined in the RFC 2397, with the mediaType set to mimeType and the raw data converted to base64.

Parameters:
NameTypeDescription
arrayBufferArrayBuffer

The binary data of the file.

mimeTypestring

The media type. Any type supported by a data URI should work. For images, use image/png or image/jpeg for instance.

chunkSizenumber

The size of the chunks used to process the raw data. If you get an exception saying that too many arguments were passed as parameters, try reducing this value.

Returns:
  • data uri
Type: 
string

insert(originalString, index, string) → {string}

Parameters:
NameTypeDescription
originalStringstring

string to modify

indexnumber

where to insert

stringstring

to insert

Returns:
  • string injected
Type: 
string

int32ArrayToObject(array) → {object}

Convert a Int32Array into an Object

Parameters:
NameTypeDescription
arrayInt32Array

array to convert

Returns:
  • object converted
Type: 
object

isNumeric(str) → {boolean}

Check if a string is a valid number inspired of https://stackoverflow.com/questions/175739/built-in-way-in-javascript-to-check-if-a-string-is-a-valid-number

Parameters:
NameTypeDescription
strstring

string to check

Returns:

true if it's a valid number

Type: 
boolean

matrix4ArrayFromURIComponent(uriComp) → {Array.<string>}

Taking a string from the unpacking URI and splitting it into an array of strings.

Parameters:
NameTypeDescription
uriCompstring

The string from the unpacking URI

Returns:
  • returns the array of strings if it is in matrix4 format, otherwise returns null
Type: 
Array.<string>

objectEquals(json1, json2) → {boolean}

Check if two json object are equals

Parameters:
NameTypeDescription
json1object

first json object

json2object

second json object

Returns:
  • true if both json are equals, false otherwise
Type: 
boolean

objectOverWrite(jsonOverWrited, jsonModel) → {object}

Overwrite identical key of jsonOverWrited with the one matching in jsonModel Create key of jsonModel which are not in jsonOverWrited

Parameters:
NameTypeDescription
jsonOverWritedobject

json object overwrited

jsonModelobject

json object used as model to overwrite

Returns:
  • json object overwrited
Type: 
object

objectParse(object, cb) → {object}

Apply a callback to each key value couple of an object

Parameters:
NameTypeDescription
objectobject

object to parse

cbfunction

callback to apply (first argument is the object containing the key and second is the key)

Returns:
  • object parsed
Type: 
object

objectParseNumeric(json) → {object}

Replace all valid number string in a json object by a float

Parameters:
NameTypeDescription
jsonobject

json object to parse

Returns:
  • json object parsed
Type: 
object

objectToInt32Array(obj) → {Int32Array}

Convert an Object into a Int32Array

Parameters:
NameTypeDescription
objobject

object to convert

Returns:
  • array converted
Type: 
Int32Array

polygon2DArea(points) → {number}

Parameters:
NameTypeDescription
pointsArray.<{x:number, y:number}>

points of your polygon not closed

Returns:

the area of your polygon

Type: 
number

removeEmptyValues(formData) → {FormData}

Removes empty fields from a FormData. Useful for update requests that would update those fields to an empty string if they were sent in the body. To check if a value is empty, this function just convert it into a boolean.

Parameters:
NameTypeDescription
formDataFormData

The form data.

Returns:

The same data, without the fields containing an empty value.

Type: 
FormData

removeFromArray(array, element) → {boolean}

Remove an element if it's present in an array

Parameters:
NameTypeDescription
arrayArray

array to remove element from

element*

element to remove

Returns:

true if removed false otherwise

Type: 
boolean

rotate2DCoord(x, y, angle) → {Object}

Parameters:
NameTypeDescription
xnumber

x coor

ynumber

y coord

anglenumber

rotation angle in radian

Returns:
  • x y rotated by angle
Type: 
Object

round(number) → {string}

Parameters:
NameTypeDescription
numbernumber

number to round

Returns:

rounded number

Type: 
string

throttle(fn, delay) → {*}

Limit the execution of a function every delay ms

Parameters:
NameTypeDescription
fnfunction

function to be throttled

delaynumber

delay in ms

Returns:
  • return what the function should return every delay ms
Type: 
*

vector3ArrayFromURIComponent(uriComp) → {Array.<string>}

Taking a string from the unpacking URI and splitting it into an array of strings.

Parameters:
NameTypeDescription
uriCompstring

The string from the unpacking URI

Returns:
  • returns the array of strings if it is in vector3 format, otherwise returns null
Type: 
Array.<string>

vector3ToLabel(v) → {string}

Parameters:
NameTypeDescription
vObject

vector 3 to labelize

Returns:

vector labelified

Type: 
string

Type Definitions

ProcessIntervalTickRequester(dt)

Callback function for ProcessInterval to execute on each tick.

Parameters:
NameTypeDescription
dtnumber

The time elapsed since the last tick in milliseconds.