UNPKG

354 BJavaScriptView Raw
1'use strict';
2
3module.exports = function findApp(addon) {
4 let current = addon;
5 let app;
6
7 // Keep iterating upward until we don't have a grandparent.
8 // Has to do this grandparent check because at some point we hit the project.
9 do {
10 app = current.app || app;
11 } while (current.parent.parent && (current = current.parent));
12
13 return app;
14}