Namespace NaosTools
The NaosTools namespace provides useful tool methods
for object handling and similar stuff.
Defined in: tools.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
The NaosTools namespace provides useful tool methods
for object handling and similar stuff.
|
| Method Attributes | Method Name and Description |
|---|---|
| <static> |
NaosTools.fromJSON(json)
Converts a JSON string to a vanilla object.
|
| <static> |
NaosTools.insertFreeObjectAttribute(object, value)
Modifies the object by adding the value to an free attribute name.
|
| <static> |
NaosTools.removeObjectAttribute(object, attribute)
Creates a copy of an object which does not contain the attribute given
as parameter.
|
| <static> |
NaosTools.toJSON(object)
Converts a data structure to a JSON string.
|
| <static> |
NaosTools.toVanillaObject(object)
Copies all attributes of objects and all entries of
arrays to a vanilla object.
|
Namespace Detail
NaosTools
The NaosTools namespace provides useful tool methods
for object handling and similar stuff.
Method Detail
<static>
{Object}
NaosTools.fromJSON(json)
Converts a JSON string to a vanilla object. Arrays are converted
to vanilla objects automatically.
- Parameters:
- {String} json
- JSON string
<static>
{Object}
NaosTools.insertFreeObjectAttribute(object, value)
Modifies the object by adding the value to an free attribute name. This
is a convenient method to simulate Array behaviour on vanilla objects.
It returns a pointer to the modified object for convenience.
- Parameters:
- {Object} object
- Object in charge.
- value
- Value to be added to the object.
<static>
{Object}
NaosTools.removeObjectAttribute(object, attribute)
Creates a copy of an object which does not contain the attribute given
as parameter.
- Parameters:
- {Object} object
- Object in charge.
- {String} attribute
- Name of atttribute to be removed from the object.
<static>
{String}
NaosTools.toJSON(object)
Converts a data structure to a JSON string.
- Parameters:
- object
- Data structure
<static>
{Object}
NaosTools.toVanillaObject(object)
Copies all attributes of objects and all entries of
arrays to a vanilla object. This is done recursively.
Because Prototype pollutes most of the JavaScript classes with several methods it is necesarry to get rid of all these methods if you want to handle plain data in an vanilla object. Additionally arrays are converted to a vanilla object too.
Because Prototype pollutes most of the JavaScript classes with several methods it is necesarry to get rid of all these methods if you want to handle plain data in an vanilla object. Additionally arrays are converted to a vanilla object too.
- Parameters:
- {Object|Array} object
- Data to be converted to a vanilla object