UNPKG

@kentcdodds/tmp-remix-utils

Version:

This package contains simple utility functions to use with [Remix.run](https://remix.run).

16 lines (15 loc) 488 B
import { json as remixJson } from "@remix-run/server-runtime"; export async function jsonHash(input, init) { let result = {}; let resolvedResults = await Promise.all( Object.entries(input).map(async ([key, value]) => { if (value instanceof Function) value = value(); if (value instanceof Promise) value = await value; return [key, value]; }) ); for (let [key, value] of resolvedResults) { result[key] = value; } return remixJson(result, init); }