Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Gets a value from the `target` based on the `path` that is needed to be followed.
- * @param target The Object to search
- * @param path The path to follow (as an <code>Array</code> of <code>String</code>), including the final object name
- */
- public static function getObj(target:Object, path:Array):Object {
- if (!path || !(path is Array)) {
- return target;
- }
- var l:uint = path.length;
- for (var i:uint = 0; i < l; i++) {
- target = target[path[i]];
- if (target == null) {
- break;
- }
- }
- return target;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement