# hoister

> Put all function and variable declarations at the top of the scope in an AST

Latest version **0.0.2** (published 2013-11-26) · MIT license · 0 weekly downloads

## Install

```sh
npm install hoister
pnpm add hoister
yarn add hoister
bun add hoister
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2013-11-26 |
| First published | 2013-11-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Matt McKegg |
| Maintainers | mmckegg |
| Keywords | ast, hoist, esprima, javascript |

## Links

- npm: https://www.npmjs.com/package/hoister
- Repository: https://github.com/mmckegg/hoister
- Issues: https://github.com/mmckegg/hoister/issues
- npm.io page: https://npm.io/package/hoister

## 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

- 0.0.2 (latest) — 2013-11-26
- 0.0.1 — 2013-11-25

## README

hoister
=======

Put all function and variable declarations at the top of the scope in an AST 

[![NPM](https://nodei.co/npm/hoister.png?compact=true)](https://nodei.co/npm/hoister/)

## Example

```js
var parse = require('esprima').parse
var generate = require('escodegen').generate
var hoist = require('hoist')

var src = 'a = func(123); var a = "test"; function func(x){return x}'
var ast = parse(src)
hoist(ast)

console.log(generate(ast))
```

Console result:

```js
function func(x) {
  return x;
}
var a;
a = func(123);
var a = 'test';
```

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