UNPKG

1.11 kBSource Map (JSON)View Raw
1{"version":3,"sources":["iterable/throwerror.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,aAAuB,SAAQ,SAAkB;IAGrD,YAAY,KAAU;QACpB,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;IACtB,CAAC;IAED,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;QAChB,MAAM,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;CACF;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAgB,KAAU;IAClD,OAAO,IAAI,aAAa,CAAU,KAAK,CAAC,CAAC;AAC3C,CAAC","file":"throwerror.js","sourcesContent":["import { IterableX } from './iterablex';\n\nclass ThrowIterable<TSource> extends IterableX<TSource> {\n private _error: any;\n\n constructor(error: any) {\n super();\n this._error = error;\n }\n\n *[Symbol.iterator](): Iterator<TSource> {\n throw this._error;\n }\n}\n\n/**\n * Creates an async-iterable that throws the specified error upon iterating.\n *\n * @export\n * @param {*} error The error to throw upon iterating the iterable.\n * @returns {AsyncIterableX<never>} An iterable that throws when iterated.\n */\nexport function throwError<TSource = any>(error: any): IterableX<TSource> {\n return new ThrowIterable<TSource>(error);\n}\n"]}
\No newline at end of file