# @tmplx/promisify

> Turn function into a promise.

Latest version **1.2.1** (published 2020-07-10) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @tmplx/promisify
pnpm add @tmplx/promisify
yarn add @tmplx/promisify
bun add @tmplx/promisify
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2020-07-10 |
| First published | 2020-07-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Richard O. Sandberg |
| Maintainers | ihack2712 |

## Links

- npm: https://www.npmjs.com/package/@tmplx/promisify
- Repository: https://ihacks.dev/tmplx/promisify
- npm.io page: https://npm.io/package/@tmplx/promisify

## Recent versions

- 1.2.1 (latest) — 2020-07-10
- 1.1.1 — 2020-07-10
- 1.1.0 — 2020-07-04
- 1.0.0 — 2020-07-04
- 0.4.0 — 2020-07-04

## README

# @tmplx/promisify

> Turn function into a promise.

```ts
// Imports
import { promisify } from "@tmplx/promisify";
import Axios from "axios";

const getMSIn = (ms: number) => new Promise<number>(async resolve => {
	const id = setInterval(() => {
		resolve(Date.now());
		clearInterval(id);
	}, ms);
});

const getNum = promisify(async () => {
	let init = Math.floor(Math.min(0, Math.max(1000, Math.random() * 1000)));
	const ms = await getMSIn(init);
	return ms;
});

getNum().then(console.log).catch(console.error);

```

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