How to use the @ts-common/iterator.map 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 / toModelErrors.ts View on Github external
export function toModelErrors(
  processedErrors: Iterable,
  operationId: string,
  scenario: string,
  source: ValidationResultSource,
  responseCode: string
): it.IterableEx {
  return it.map(processedErrors, value => {
    if (value.code === undefined) {
      value.code = "INTERNAL_ERROR"
    }
    const severity = errorCodeToErrorMetadata(value.code as ExtendedErrorCode).severity
    const modelError: ModelValidationError = {
      operationId,
      scenario,
      source,
      responseCode,
      severity,
      code: value.code,
      details: value
    }
    return modelError
  })
}
github Azure / oav / lib / wireFormatGenerator.ts View on Github external
private async resolveExamples(
    suppression: Suppression | undefined
  ): Promise> {
    const options = {
      relativeBase: this.specDir,
      filter: ["relative", "remote"]
    }

    const allRefsRemoteRelative = JsonRefs.findRefs(this.specInJson as object, options)
    const e = entries(allRefsRemoteRelative as StringMap)
    const promiseFactories = toArray(
      map(e, ([refName, refDetails]) => async () =>
        this.resolveRelativeReference(
          suppression,
          refName,
          refDetails,
          this.specInJson,
          this.specPath
        )
      )
    )
    if (promiseFactories.length) {
      return utils.executePromisesSequentially(promiseFactories)
    } else {
      return this.specInJson
    }
  }