Mangler.getGetter() - DarthJDG/Mangler.js GitHub Wiki
Returns the getter function for an object.
Mangler.getGetter(object)| Parameter | Type | Default | Description |
|---|---|---|---|
| object | Instance | An object instance or its constructor to get the getter function for. |
Returns a getter function in the form of function(object, key), or null if object does not have a getter interface.
Gets a getter function for any object that's supported by Mangler.js. To read an item from an object a with the key of 1, you can manually get the getter function and use it:
getter = Mangler.getGetter(a);
secondItem = getter ? getter(a, 1) : undefined;The above can be shortened by using Mangler.get():
secondItem = Mangler.get(a, 1);To check whether an object has a getter inteface:
hasGet = !!Mangler.getGetter(Array); // trueFor supported object types and to add support for other objects, see Mangler.registerType().