@typespec/ts-http-runtime
Version:
Isomorphic client library for making HTTP requests in node.js and browser.
1 lines • 1.78 kB
Source Map (JSON)
{"version":3,"file":"typeGuards-react-native.mjs","sourceRoot":"","sources":["../../../src/util/typeGuards-react-native.mts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,CAAU;IAC7C,OAAO,CACL,CAAC,KAAK,IAAI;QACV,CAAC,KAAK,SAAS;QACf,OAAO,CAAC,KAAK,QAAQ;QACrB,MAAM,IAAI,CAAC;QACX,OAAO,CAAC,CAAC,IAAI,KAAK,UAAU;QAC5B,MAAM,IAAI,CAAC;QACX,OAAO,CAAC,CAAC,IAAI,KAAK,UAAU,CAC7B,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,CAAU;IAC5C,OAAO,CACL,CAAC,KAAK,IAAI;QACV,CAAC,KAAK,SAAS;QACf,OAAO,CAAC,KAAK,QAAQ;QACrB,WAAW,IAAI,CAAC;QAChB,OAAO,CAAC,CAAC,SAAS,KAAK,UAAU;QACjC,KAAK,IAAI,CAAC;QACV,OAAO,CAAC,CAAC,GAAG,KAAK,UAAU,CAC5B,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/**\n * Node.js readable streams are not natively available in React Native, but apps\n * may polyfill them (e.g. `readable-stream` for Event Hubs). Use duck-typing\n * so polyfilled streams are detected at runtime.\n *\n * @internal\n */\nexport function isNodeReadableStream(x: unknown): x is never {\n return (\n x !== null &&\n x !== undefined &&\n typeof x === \"object\" &&\n \"pipe\" in x &&\n typeof x.pipe === \"function\" &&\n \"read\" in x &&\n typeof x.read === \"function\"\n );\n}\n\n/**\n * Web ReadableStream is not natively available in React Native, but apps may\n * polyfill it. Use duck-typing so polyfilled streams are detected at runtime.\n *\n * @internal\n */\nexport function isWebReadableStream(x: unknown): x is never {\n return (\n x !== null &&\n x !== undefined &&\n typeof x === \"object\" &&\n \"getReader\" in x &&\n typeof x.getReader === \"function\" &&\n \"tee\" in x &&\n typeof x.tee === \"function\"\n );\n}\n"]}