Skip to content

Releases: jwalton/js-promise-breaker

v7.0.0

08 Jun 17:39
v7.0.0
889b20b

Choose a tag to compare

A lot has changed in the world of javascript since promise-breaker v6. Async and promise based code is now the default instead of the other way around, and typescript has gained a lot of popularity.

promise-breaker v7 is a complete rewrite of promise-breaker, focusing on better typescript support, and simplified developer experience. Earlier versions of promise-breaker focused quite a bit on preserving the .length of a function, and frequently required passing in the expected number of parameters a function would require. v6 also required heavy usage of new Function as a result.

promise-breaker v7 renames make and break (which were always confusing names) to promisify and callbackify. promisify basically works the same way as node.js's util.promisify() but makes it so the provided function can be called
with a callback or will return a promise if one is not provided. Like util.promisify(), it works by taking the parameters passed in and adding a "promise callback" to the parameter list before passing it on to the underlying funciton. If the caller doesn't provide a callback, the promimse callback will be used by the underlying function causing the returned promise to eventually resolve or reject. If the caller does provide a callback, the promise callback will end up being ignored by the underlying function and the caller provided callback will be called instead. This works well in most cases, but can fall short for cases where the underlying function takes a variable number of parameters. For these cases, promise-breaker still provides addPromise and addCallback
functions which can be used to give you greater control.

Breaking Changes

  • Rewrite.
  • make and break are now aliases for promisify and callbackify.
  • promisify no longer allows options as first argument.
  • promisify and callbackify now use a different algorithm which makes them simpler to use.
  • The .length of functions generated by promisify and callbackify are no longer related to the function passed in.
  • This is now published only as an ESM library.

v6.0.0

11 Aug 20:12

Choose a tag to compare

6.0.0 (2022-08-11)

Bug Fixes

  • Update typescript types to use modules instead of export=. (a9cdb29)

BREAKING CHANGES

  • For 99% of users, this should have no effect, but I'll bump the major version just to be safe.

v5.0.0

25 Jun 15:30

Choose a tag to compare

5.0.0 (2019-06-25)

  • feat(Drop support for node v6 and node v8.): (187b75d)

BREAKING CHANGES

  • Drop support for node v6 and node v8.

v4.1.13

29 Nov 20:30

Choose a tag to compare

4.1.13 (2018-11-29)

Bug Fixes

  • Fix typescript def for addPromise. (fa4fb38)

v4.1.12

29 Nov 19:49

Choose a tag to compare

4.1.12 (2018-11-29)

Bug Fixes

  • Better typescript definitions. (604b106)

v4.1.11

07 May 16:14

Choose a tag to compare

4.1.11 (2018-05-07)

Bug Fixes

  • typescript: Add generic to addPromise(). (de41bf2)