From 6300770cc0bfc747b5508a78ae8012f84a5dedc3 Mon Sep 17 00:00:00 2001 From: Dan Connolly Date: Fri, 9 Apr 2021 13:03:18 -0500 Subject: [PATCH] style(swingset): some types for initializeSwingset utilities --- packages/SwingSet/src/initializeSwingset.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/SwingSet/src/initializeSwingset.js b/packages/SwingSet/src/initializeSwingset.js index c88ef2f06df..f8d1ef3f0b9 100644 --- a/packages/SwingSet/src/initializeSwingset.js +++ b/packages/SwingSet/src/initializeSwingset.js @@ -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>} obj + * @returns {Promise>} + * @template V + */ const allValues = async obj => fromEntries(zip(keys(obj), await Promise.all(values(obj))));