How to use the ix/asynciterable/pipe/index.map function in ix

To help you get started, we’ve selected a few ix 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 sourcegraph / sourcegraph-typescript / src / extension / extension.ts View on Github external
logger.error('Could not find external references', err)
                            }
                        })

                    yield* merge(findLocalReferences(), findExternalReferences()).pipe(
                        // Same-repo references
                        // Cross-repo references
                        // Find canonical source location
                        filter(chunk => chunk.length > 0),
                        tap({
                            next: chunk => {
                                span.log({ event: 'chunk', count: chunk.length })
                            },
                        }),
                        // Rewrite URIs and convert from LSP to Sourcegraph Location
                        map(chunk =>
                            chunk
                                .map(location => {
                                    try {
                                        return convertLocation({
                                            ...location,
                                            uri: toSourcegraphTextDocumentUri(new URL(location.uri)).href,
                                        })
                                    } catch (err) {
                                        return undefined
                                    }
                                })
                                .filter((location): location is Exclude => !!location)
                        ),
                        // Aggregate individual chunks into a growing array (which is what Sourcegraph expects)
                        scan(
                            (allReferences, chunk) => allReferences.concat(chunk),
github neo-one-suite / neo-one / migrate / neo-one-client / src / createSmartContract.js View on Github external
smartContract.iterLogs = (
      actionFilter?: ActionFilter,
    ): AsyncIterable =>
      AsyncIterableX.from(smartContract.iterActions(actionFilter)).pipe(
        map(action => {
          if (action.type === 'Notification') {
            return (null: $FlowFixMe);
          }

          return action.message;
        }),
        filter(Boolean),
      );
github neo-one-suite / neo-one / packages / neo-one-node-vm / src / stackItem / StackItemIterator.js View on Github external
keys(): StackItemEnumerator<> {
    const iterable = AsyncIterableX.from(this.enumerator).pipe(
      map(({ key }) => ({ value: key })),
    );

    return new StackItemEnumerator(this._getIterator(iterable));
  }
github neo-one-suite / neo-one / packages / neo-one-node-vm / src / stackItem / StackItemIterator.js View on Github external
values(): StackItemEnumerator<> {
    const iterable = AsyncIterableX.from(this.enumerator).pipe(
      map(({ value }) => ({ value })),
    );

    return new StackItemEnumerator(this._getIterator(iterable));
  }
}