How to use the @ts-common/iterator.empty function in @ts-common/iterator

To help you get started, we’ve selected a few @ts-common/iterator 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 Azure / oav / lib / util / scenarioReducer.ts View on Github external
}
  // process request separately since its unique
  const processedErrors = processValidationResult(rawValidationResult)

  if (processedErrors.requestValidationResult.errors === undefined) {
    throw new Error("ICE: processedErrors.requestValidationResult.errors === undefined")
  }
  const modelErrors = !request.isValid
    ? toModelErrors(
        processedErrors.requestValidationResult.errors,
        operationId,
        scenarioName,
        ValidationResultSource.REQUEST,
        "ALL"
      )
    : it.empty()

  // process responses
  rawValidationResult.requestValidationResult.errors = []

  const entries = sm.entries(scenario.responses)
  const invalidResponses = entries.filter(entry => {
    const [, response] = entry
    return !response.isValid
  })
  const result = invalidResponses.flatMap(response => {
    const [responseCode] = response
    return responseReducer(responseCode, scenario, rawValidationResult, operationId, scenarioName)
  })
  return modelErrors.concat(result)
}