# ast-children

> get the children of an AST node

Latest version **1.0.5** (published 2015-10-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install ast-children
pnpm add ast-children
yarn add ast-children
bun add ast-children
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2015-10-12 |
| First published | 2014-05-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Jake Rosoman |
| Maintainers | jkroso |
| Keywords | ast, children |

## Links

- npm: https://www.npmjs.com/package/ast-children
- Repository: https://github.com/jkroso/ast-children
- Homepage: https://github.com/jkroso/ast-children#readme
- Issues: https://github.com/jkroso/ast-children/issues
- npm.io page: https://npm.io/package/ast-children

## Alternatives

- [update-check](https://npm.io/package/update-check.md) — 4.0M weekly downloads
- [react-native-onesignal](https://npm.io/package/react-native-onesignal.md) — 134.5K weekly downloads
- [react-redux-toastr](https://npm.io/package/react-redux-toastr.md) — 33.7K weekly downloads
- [@nocobase/plugin-notification-manager](https://npm.io/package/@nocobase/plugin-notification-manager.md) — 2.0K weekly downloads
- [react-simple-toasts](https://npm.io/package/react-simple-toasts.md) — 1.9K weekly downloads

## Recent versions

- 1.0.5 (latest) — 2015-10-12
- 1.0.4 — 2015-09-06
- 1.0.3 — 2015-09-06
- 1.0.2 — 2015-09-06
- 1.0.1 — 2015-09-06
- 1.0.0 — 2015-09-06
- 0.2.0 — 2014-10-28
- 0.1.2 — 2014-05-20
- 0.1.1 — 2014-05-17
- 0.1.0 — 2014-05-17

## README

# ast-children

get the children of an AST node

## Installation

`npm install ast-children`

then in your app:

```js
const children = require('ast-children')
```

## API

### children(node)

Takes a [standard](https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Parser_API) AST node and returns an `Array` of its child nodes

```js
var ast = {
  type: 'Program',
  body: [
    {
      type: 'VariableDeclaration',
      declarations: [
        {
          type: 'VariableDeclarator',
          id: {type: 'Identifier', name: 'a'},
          init: {type: 'Literal', value: 1}
        },
        {
          type: 'VariableDeclarator',
          id: {type: 'Identifier', name: 'b'}
        }
      ]
    }
  ]
}
children(ast) // => ast.body
children(ast.body[0]) // => ast.body[0].declarations
var decs = ast.body[0].declarations
children(decs[0]) // => [decs[0].id, decs[0].init]
children(decs[1]) // => [decs[1].id]
```

---
_Source: https://npm.io/package/ast-children · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
