explaingit

boneskull/promwrap

Analysis updated 2026-07-05 · repo last pushed 2020-07-21

7JavaScriptAudience · developerComplexity · 2/5DormantSetup · easy

TLDR

A small JavaScript utility that converts old callback-style functions into modern promise-based ones so you can use await instead of nesting callbacks.

Mindmap

mindmap
  root((repo))
    What it does
      Wraps callback functions
      Returns promises
      Uses JS Proxy
    Tech stack
      JavaScript
      Node.js
    Use cases
      Modernize old libraries
      Avoid callback nesting
      Wrap individual functions
    Audience
      JavaScript developers
      Legacy code maintainers
    Features
      Exclude specific properties
      Skip inherited properties
      Wrap whole modules
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Modernize an older callback-based JavaScript library so you can write await-style code.

USE CASE 2

Avoid deeply nested callbacks by wrapping individual functions to return promises.

USE CASE 3

Selectively convert a module's functions to promises while excluding specific properties.

What is it built with?

JavaScriptNode.js

How does it compare?

boneskull/promwraploafdaddy/discoverr-botadm1nsys/safari-ai-extension
Stars778
LanguageJavaScriptJavaScriptJavaScript
Last pushed2020-07-21
MaintenanceDormant
Setup difficultyeasymoderatehard
Complexity2/52/52/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

Install via npm and import it into your JavaScript project, no extra infrastructure needed.

In plain English

Promwrap is a small JavaScript utility that converts old-style functions into modern promise-based ones. Many existing code libraries use a pattern where functions accept a "callback", a function you pass in that gets triggered when the work is done, often returning errors as the first argument. This was the standard way to handle asynchronous tasks before promises became common. This tool automatically wraps those callback-style functions so you can use them with await instead, making your code cleaner and easier to read. At a high level, it inspects an object or module and looks for functions that use callbacks. When you call one of those functions through the wrapper, it intercepts the call, runs the original function, and returns a promise. That promise resolves with the result once the callback fires, or rejects if an error occurs. It uses a JavaScript feature called a Proxy to dynamically wrap the object, meaning it returns a modified version that behaves like the original but with promise support added. This is useful for developers working with older JavaScript packages that haven't been updated to support promises. For example, if you're using a library from a few years ago that relies entirely on callbacks, wrapping it with this tool lets you write await-style code instead of nesting callback after callback. It can also handle individual functions, not just whole modules. The tool gives you some control over what gets converted. You can exclude specific properties from being wrapped, or choose to only convert properties that belong directly to the object rather than inherited ones. The README doesn't go into detail on specific performance tradeoffs, but the Proxy-based approach means the wrapper dynamically intercepts property access rather than creating a static copy.

Copy-paste prompts

Prompt 1
I have an old Node.js module called myLib that uses callbacks. Show me how to use promwrap to wrap it so I can call its methods with await instead.
Prompt 2
I want to wrap only certain functions from a callback-based module and exclude specific properties. Show me how to do that with promwrap's options.
Prompt 3
Help me use promwrap to convert a single callback-style function into a promise so I can await it directly.

Frequently asked questions

What is promwrap?

A small JavaScript utility that converts old callback-style functions into modern promise-based ones so you can use await instead of nesting callbacks.

What language is promwrap written in?

Mainly JavaScript. The stack also includes JavaScript, Node.js.

Is promwrap actively maintained?

Dormant — no commits in 2+ years (last push 2020-07-21).

How hard is promwrap to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is promwrap for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Scan in gitsafehub Deploy in gitdeployhub boneskull on gitmyhub

Verify against the repo before relying on details.