npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

return-all

v0.2.1

Published

Merge the return values of multiple functions into a single typed object

Downloads

295

Readme

return-all

Merge the return values of multiple functions into a single fully-typed object.

Installation

npm install return-all

Usage

returnAll

Calls each function synchronously and deeply merges their return values. The result is typed as the intersection of all return types.

import { returnAll } from "return-all";

const result = returnAll(
	() => ({ name: "Alice" }),
	() => ({ age: 30 })
);

// result: { name: string } & { age: number }
console.log(result.name); // 'Alice'
console.log(result.age); // 30

returnAllAsync

Same as returnAll but supports async functions. All functions are invoked concurrently via Promise.all.

import { returnAllAsync } from "return-all";

const result = await returnAllAsync(
	async () => ({ user: await fetchUser() }),
	async () => ({ settings: await fetchSettings() })
);

// result: { user: User } & { settings: Settings }

returnAllWithLabels

Like returnAll but each function is assigned a named label. Results are scoped to their label rather than merged into a flat intersection.

import { returnAllWithLabels } from "return-all";

const { user, settings } = returnAllWithLabels({
	user: () => getUser(),
	settings: () => getSettings()
});

// user: ReturnType<typeof getUser>
// settings: ReturnType<typeof getSettings>

returnAllWithLabelsAsync

Like returnAllWithLabels but supports async functions. All functions are invoked concurrently via Promise.all.

import { returnAllWithLabelsAsync } from "return-all";

const { user, settings } = await returnAllWithLabelsAsync({
	user: async () => fetchUser(),
	settings: async () => fetchSettings()
});

// user: Awaited<ReturnType<typeof fetchUser>>
// settings: Awaited<ReturnType<typeof fetchSettings>>

API

returnAll(...fns)

| Parameter | Type | Description | | --------- | ------------------ | -------------------------------------------- | | ...fns | (() => object)[] | Functions whose return values will be merged |

Returns the merged object typed as the intersection of all return types.

returnAllAsync(...fns)

| Parameter | Type | Description | | --------- | ------------------------------------- | ---------------------------------------------------------- | | ...fns | (() => object \| Promise<object>)[] | Sync or async functions whose return values will be merged |

Returns a Promise that resolves to the merged object typed as the intersection of all awaited return types.

returnAllWithLabels(fns)

| Parameter | Type | Description | | --------- | ------------------------------ | ---------------------------------- | | fns | Record<string, () => object> | Object mapping labels to functions |

Returns an object where each key holds the return value of its corresponding function, typed independently per label.

returnAllWithLabelsAsync(fns)

| Parameter | Type | Description | | --------- | ------------------------------------------------- | ------------------------------------------------ | | fns | Record<string, () => object \| Promise<object>> | Object mapping labels to sync or async functions |

Returns a Promise that resolves to an object where each key holds the awaited return value of its corresponding function, typed independently per label.

License

MIT