Methods
arrayEquals(a1, a2) → {boolean}
Check if both array are equals
Name | Type | Description |
---|---|---|
a1 | Array | array 1 |
a2 | Array | array 2 |
- true if equals
- Type:
- boolean
arrayPushOnce(array, element) → {boolean}
Check if the element is alreeady included in the array if not push it
Name | Type | Description |
---|---|---|
array | Array | array where to push the element |
element | * | element to push |
true if pushed false otherwise
- Type:
- boolean
checkIfSubStringIsEuler(subString) → {boolean}
Take an array of string and check if it is in euler format
Name | Type | Description |
---|---|---|
subString | Array.<string> | array of string |
- true if it is euler format
- Type:
- boolean
checkIfSubStringIsMatrix4(subString) → {boolean}
Take an array of string and check if it is in matrix4 format
Name | Type | Description |
---|---|---|
subString | Array.<string> | array of string |
- true if it is matrix4 format
- Type:
- boolean
checkIfSubStringIsVector3(subString) → {boolean}
Take an array of string and check if it is in vector3 format
Name | Type | Description |
---|---|---|
subString | Array.<string> | array of string |
- true if it is vector3 format
- Type:
- boolean
computeFileFormat(filename) → {string}
Compute the last string after the . in the filename
Name | Type | Description |
---|---|---|
filename | string | file name |
- file format
- Type:
- string
computeFilenameFromPath(path) → {string}
Compute filename from path
Name | Type | Description |
---|---|---|
path | string | path |
filename
- Type:
- string
dataUriToBuffer(uri) → {Buffer|null}
Convert a data URI into a Buffer
Name | Type | Description |
---|---|---|
uri | string | data uri to convert |
- 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.
Name | Type | Description |
---|---|---|
uriComp | string | The string from the unpacking URI |
- 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]
.
Name | Type | Description |
---|---|---|
obj | object | object to get attribute |
path | string | path to get the attribute |
- attribute vaue
- Type:
- *
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.
Name | Type | Description |
---|---|---|
arrayBuffer | ArrayBuffer | The binary data of the file. |
mimeType | string | The media type. Any type supported by a data URI should work. For images, use |
chunkSize | number | 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. |
- data uri
- Type:
- string
insert(originalString, index, string) → {string}
Name | Type | Description |
---|---|---|
originalString | string | string to modify |
index | number | where to insert |
string | string | to insert |
- string injected
- Type:
- string
int32ArrayToObject(array) → {object}
Convert a Int32Array into an Object
Name | Type | Description |
---|---|---|
array | Int32Array | array to convert |
- 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
Name | Type | Description |
---|---|---|
str | string | string to check |
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.
Name | Type | Description |
---|---|---|
uriComp | string | The string from the unpacking URI |
- 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
Name | Type | Description |
---|---|---|
json1 | object | first json object |
json2 | object | second json object |
- 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
Name | Type | Description |
---|---|---|
jsonOverWrited | object | json object overwrited |
jsonModel | object | json object used as model to overwrite |
- json object overwrited
- Type:
- object
objectParse(object, cb) → {object}
Apply a callback to each key value couple of an object
Name | Type | Description |
---|---|---|
object | object | object to parse |
cb | function | callback to apply (first argument is the object containing the key and second is the key) |
- object parsed
- Type:
- object
objectParseNumeric(json) → {object}
Replace all valid number string in a json object by a float
Name | Type | Description |
---|---|---|
json | object | json object to parse |
- json object parsed
- Type:
- object
objectToInt32Array(obj) → {Int32Array}
Convert an Object into a Int32Array
Name | Type | Description |
---|---|---|
obj | object | object to convert |
- array converted
- Type:
- Int32Array
polygon2DArea(points) → {number}
Name | Type | Description |
---|---|---|
points | Array.<{x:number, y:number}> | points of your polygon not closed |
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.
Name | Type | Description |
---|---|---|
formData | FormData | The form data. |
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
Name | Type | Description |
---|---|---|
array | Array | array to remove element from |
element | * | element to remove |
true if removed false otherwise
- Type:
- boolean
rotate2DCoord(x, y, angle) → {Object}
Name | Type | Description |
---|---|---|
x | number | x coor |
y | number | y coord |
angle | number | rotation angle in radian |
- x y rotated by angle
- Type:
- Object
round(number) → {string}
Name | Type | Description |
---|---|---|
number | number | number to round |
rounded number
- Type:
- string
throttle(fn, delay) → {*}
Limit the execution of a function every delay ms
Name | Type | Description |
---|---|---|
fn | function | function to be throttled |
delay | number | delay in ms |
- 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.
Name | Type | Description |
---|---|---|
uriComp | string | The string from the unpacking URI |
- returns the array of strings if it is in vector3 format, otherwise returns null
- Type:
- Array.<string>
vector3ToLabel(v) → {string}
Name | Type | Description |
---|---|---|
v | Object | vector 3 to labelize |
vector labelified
- Type:
- string
Type Definitions
ProcessIntervalTickRequester(dt)
Callback function for ProcessInterval to execute on each tick.
Name | Type | Description |
---|---|---|
dt | number | The time elapsed since the last tick in milliseconds. |
- Source