Find a file
Evan Hahn f5c0188b5e
std/node: add util.callbackify (#5415)
This adds [Node's `util.callbackify`][0] to `std/node/util.ts`.

I lifted most of this from the [original Node source code][1] (and [its
tests][2]). I tried to make minimal modifications to the source.

I made a few arbitrary decisions:

- I was unable to do the function's types elegantly. I made overloads
  for functions that have 0 to 5 (inclusive) arguments, excluding the
  callback. I would love to know a better way to do this. (It seems that
  the folks at DefinitelyTyped [were also stumped][3], though maybe
  their solution is deliberate.)
- There are a few edge cases that cause custom Node errors to be
  produced. Instead of re-implementing those errors completely, I
  created simplified classes. These are mostly correct but are not
  identical to the real Node errors.
- The tests implement a possibly-arcane `TestQueue` class. I originally
  used a lot of inline promises but found it too repetitive.

Closes [#5366][4].

[0]: https://nodejs.org/api/util.html#util_util_callbackify_original
[1]: 4780493301/lib/util.js (L183-L226)
[2]: 4780493301/test/parallel/test-util-callbackify.js
[3]: 7d24857ddb/types/node/util.d.ts (L61-L84)
[4]: https://github.com/denoland/deno/issues/5366
2020-05-20 10:29:05 -04:00
.cargo Statically link the C runtime library on Windows (#4469) 2020-03-23 20:31:29 +01:00
.github ci: don't fail-fast on tag build (#5189) 2020-05-10 12:39:27 -04:00
cli refactor: reorganize TS compiler (#5603) 2020-05-20 16:25:40 +02:00
core Miscellaneous documentation and spelling improvements (#5527) 2020-05-17 19:24:39 +02:00
deno_typescript Fix typos across the repo (#5295) 2020-05-14 06:38:42 +02:00
docs fix url (#5637) 2020-05-19 15:25:38 -04:00
std std/node: add util.callbackify (#5415) 2020-05-20 10:29:05 -04:00
test_plugin Change plugin interface to prevent segfaults when unloading plugin (#5210) 2020-05-11 22:39:13 +02:00
third_party@9ad53352a9 Update to TypeScript 3.9 (#4510) 2020-05-13 08:03:04 -04:00
tools Remove dead code: tools/sha256sum.py (#5502) 2020-05-16 20:37:41 +02:00
.editorconfig editorconfig: Don't insert final newline in .out files (#1686) 2019-02-07 11:31:49 -05:00
.eslintignore feat: dprint formatter (#3820) 2020-01-29 21:16:48 -05:00
.eslintrc.json Add no-async-promise-executor lint rule (#4809) 2020-04-20 11:29:37 +02:00
.gitattributes Upgrade node_modules, change tagline, clean up root directory (#3247) 2019-10-31 19:33:27 -07:00
.gitignore Statically link the C runtime library on Windows (#4469) 2020-03-23 20:31:29 +01:00
.gitmodules Replace libdeno with rusty_v8 (#3556) 2020-01-05 09:19:29 -05:00
.prettierignore Loader: support .wasm imports (#3328) 2019-11-14 08:31:39 -05:00
.prettierrc.json tools/format: format markdown files with prettier 2018-10-04 02:02:23 -07:00
.rustfmt.toml change copyrights from 2019 to 2020 (#3733) 2020-01-21 10:01:55 -05:00
Cargo.lock Update to dprint 0.18.3 and the latest version of swc (#5509) 2020-05-17 18:56:22 +02:00
Cargo.toml feat: first pass at native plugins (#3372) 2019-12-05 15:30:20 -05:00
LICENSE change copyrights from 2019 to 2020 (#3733) 2020-01-21 10:01:55 -05:00
README.md chore: remove typedoc (#5497) 2020-05-16 16:02:03 +02:00
Releases.md Fix a bunch of spelling errors (#5314) 2020-05-16 00:36:49 +02:00

Deno

A secure runtime for JavaScript and TypeScript.

Build Status

Deno aims to provide a productive and secure scripting environment for the modern programmer. It is built on top of V8, Rust, and TypeScript.

Please read the introduction for more specifics.

Website

Manual

Install

API Reference

Style Guide

Module Repository

Releases

Chat

More links