Skip to content

Commit

Permalink
style(swingset): some types for initializeSwingset utilities
Browse files Browse the repository at this point in the history
  • Loading branch information
dckc committed Apr 9, 2021
1 parent 584a626 commit 6300770
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/SwingSet/src/initializeSwingset.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,19 @@ import { initSwingStore } from '@agoric/swing-store-simple';
import { insistStorageAPI } from './storageAPI';
import { initializeKernel } from './kernel/initializeKernel';

/**
* @param {X[]} xs
* @param {Y[]} ys
* @returns {[X, Y][]}
* @template X, Y
*/
const zip = (xs, ys) => xs.map((x, i) => [x, ys[i]]);
const { keys, values, fromEntries } = Object;
/**
* @param {Record<string, Promise<V>>} obj
* @returns {Promise<Record<string, V>>}
* @template V
*/
const allValues = async obj =>
fromEntries(zip(keys(obj), await Promise.all(values(obj))));

Expand Down

0 comments on commit 6300770

Please sign in to comment.