How to use the @ts-common/iterator.flat 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 / commands / validate-example.ts View on Github external
await cliSuppressExceptions(async () => {
    log.debug(argv.toString())
    const specPath = argv.specPath
    const operationIds = argv.operationIds
    const vOptions: validate.Options = {
      consoleLogLevel: argv.logLevel,
      logFilepath: argv.f,
      pretty: argv.p
    }
    if (specPath.match(/.*composite.*/gi) !== null) {
      const result = await validate.validateExamplesInCompositeSpec(specPath, vOptions)
      return iterator.flat(result).some(() => true) ? 1 : 0
    } else {
      const result = await validate.validateExamples(specPath, operationIds, vOptions)
      return result.length > 0 ? 1 : 0
    }
  })
}