Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // search recursive for the id and return object
- getObject(data, id)
- {
- var result = null;
- for(var prop in data)
- {
- if(data[prop] instanceof Object)
- {
- for(var index in data[prop].options)
- {
- if(data[prop].options[index].id == id)
- {
- return data[prop];
- }
- }
- result = this.getObject(data[prop], id);
- if (result)
- {
- break;
- }
- }
- }
- return result;
- }
Add Comment
Please, Sign In to add comment