Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/keyvan-m-sadeghi/babel-plugin-transform-util-promisify

Transforms util.promisify for node versions < 8
https://github.com/keyvan-m-sadeghi/babel-plugin-transform-util-promisify

babel babel-plugin promise promisify

Last synced: about 1 month ago
JSON representation

Transforms util.promisify for node versions < 8

Awesome Lists containing this project

README

        

[![npm version](https://badge.fury.io/js/babel-plugin-transform-util-promisify.svg)](https://www.npmjs.com/package/babel-plugin-transform-util-promisify)
[![Build Status](https://travis-ci.org/assister-ai/babel-plugin-transform-util-promisify.svg?branch=master)](https://travis-ci.org/assister-ai/babel-plugin-transform-util-promisify)

# babel-plugin-transform-util-promisify
Transforms `util.promisify` to a function definition
for node versions < 8, automatically detects if node version >= 8 and does nothing if so.

## Install

```shell
npm install babel-plugin-transform-util-promisify --save-dev
```

## Usage

Add at the top of plugins in `.babelrc`:

```json
{
"plugins": [
"transform-util-promisify"
],
"presets": [
["env", {
"targets": {
"node": "current"
}
}]
]
}
```

The plugin currently transforms code only in these forms:

```js
import { promisify } from 'util';
```

and

```js
const { promisify } = require('promisify');
```

## License

[MIT](https://github.com/assister-ai/babel-plugin-transform-util-promisify/blob/master/LICENSE)