/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ 'use strict'; export namespace Iterables { export function* filterMap( source: Iterable | IterableIterator, predicateMapper: (item: T) => TMapped | undefined | null, ): Iterable { for (const item of source) { const mapped = predicateMapper(item); // eslint-disable-next-line eqeqeq if (mapped != null) { yield mapped; } } } export function* map( source: Iterable | IterableIterator, mapper: (item: T) => TMapped, ): Iterable { for (const item of source) { yield mapper(item); } } }