Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/babel-utils/babel-flow-scope

[Deprecated] Use babel-utils/babel-type-scopes for both Flow & TypeScript support
https://github.com/babel-utils/babel-flow-scope

babel babel-flow babel-util flow flowtype

Last synced: about 3 hours ago
JSON representation

[Deprecated] Use babel-utils/babel-type-scopes for both Flow & TypeScript support

Awesome Lists containing this project

README

        

# babel-flow-scope

> Collect [Flow](https://flow.org/) bindings in a given scope

```js
import type foo from "mod";
type baz = {};
```

```js
import {getFlowBindingsInScope} from 'babel-flow-scope';

getFlowBindingsInScope(path);
// {
// foo: {
// kind: 'import',
// path: (Identifier)
// },
// bar: {
// kind: 'param',
// path: (TypeParameter)
// },
// baz: {
// kind: 'declaration',
// path: (Identifier)
// }
// }
```

## API

#### `getFlowScopePath(path)`

Find the closest path to a Flow scope.

#### `getFlowBindingsInScope(path)`

Retreive all the Flow bindings in the local Flow scope.

#### `findFlowBinding(path, name)`

Search for a binding in the current scope and parent scopes.