1.0.7 • Published 4 years ago

@pengyin/tools v1.0.7

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

npm.io npm.io npm.io npm.io

yarn add @pengyin/tools

# npm install @pengyin/tools

Usage

import { to  } from "@pengyin/tools";

interface ServerResponse {
  test: number;
}

const p = Promise.resolve({test: 123});

const [err, data] = await to<ServerResponse>(p);

async function asyncFunctionWithThrow() {
  const [err, user] = await to(UserModel.findById(1));
  if (!user) throw new Error('User not found');
}

feature

  • docs
  • jest

License

MIT License

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago