get-scopes.js 321 B

1234567891011121314
  1. 'use strict';
  2. /**
  3. Gather a list of all Scopes starting recursively from the input Scope.
  4. @param {Scope} scope - The Scope to start checking from.
  5. @returns {Scope[]} - The resulting Scopes.
  6. */
  7. const getScopes = scope => [
  8. scope,
  9. ...scope.childScopes.flatMap(scope => getScopes(scope)),
  10. ];
  11. module.exports = getScopes;