@await-to/ky
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

@await-to/ky

Install

npm i @await-to/chainable
npm i @await-to/ky

Example

import { to, OkResult } from '@await-to/chainable';
import { awaitToKy } from '@await-to/ky';
import { ky } from 'ky';

const result = await to(ky.get('https://example.com').json())
	.and(awaitToKy())
	.get();

if (!result.ok) {
	// if ky resolved with a HTTPError, `awaitToKy` will resolve it
	// first as error.response.json()
	// or as secodnd option as error.response.text()
	result.error;
}

Readme

Keywords

none

Package Sidebar

Install

npm i @await-to/ky

Weekly Downloads

3

Version

2.0.0

License

MIT

Unpacked Size

9.58 kB

Total Files

7

Last publish

Collaborators

  • albizures