@cbnsndwch/zero-sources

isSimpleMapping() function

Home > @cbnsndwch/zero-contracts > isSimpleMapping

isSimpleMapping() function

Type guard to check if a table mapping uses the simple filter-based approach.

Signature:

declare function isSimpleMapping<T>(
    mapping: TableMapping<T>
): mapping is SimpleTableMapping<T>;

Parameters

Parameter

Type

Description

mapping

TableMapping<T>

The table mapping to check

Returns:

mapping is SimpleTableMapping<T>

True if the mapping uses simple filter, false if it uses pipeline

Example

const mapping: TableMapping = { source: 'accounts', filter: {...} };

if (isSimpleMapping(mapping)) {
  // mapping is SimpleTableMapping
  console.log(mapping.filter);
}

How was this page?