How to use the @requestnetwork/utils.flatten2DimensionsArray function in @requestnetwork/utils

To help you get started, we’ve selected a few @requestnetwork/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github RequestNetwork / requestNetwork / packages / data-access / src / transaction-index / location-by-topic.ts View on Github external
public async getChannelIdsFromMultipleTopics(topics: string[]): Promise {
    const channelIdsPromises = topics.map(async topic => {
      return Array.from((await this.channelIdByTopics.get(topic)) || []);
    });
    const channelIds = await Promise.all(channelIdsPromises);

    // flatten the array of array and remove the duplicates
    return Utils.unique(Utils.flatten2DimensionsArray(channelIds)).uniqueItems;
  }
  /**