@rhombus-toolkit/type-guards 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/.heft/build-cache/heft-jest-data.json +7 -0
  2. package/.rush/temp/package-deps_build.json +24 -0
  3. package/.rush/temp/shrinkwrap-deps.json +873 -0
  4. package/config/rig.json +6 -0
  5. package/lib/assert-never.d.ts +2 -0
  6. package/lib/assert-never.d.ts.map +1 -0
  7. package/lib/assert-never.js +4 -0
  8. package/lib/assert-never.js.map +1 -0
  9. package/lib/index.d.ts +8 -0
  10. package/lib/index.d.ts.map +1 -0
  11. package/lib/index.js +8 -0
  12. package/lib/index.js.map +1 -0
  13. package/lib/is-array.d.ts +2 -0
  14. package/lib/is-array.d.ts.map +1 -0
  15. package/lib/is-array.js +4 -0
  16. package/lib/is-array.js.map +1 -0
  17. package/lib/is-defined.d.ts +3 -0
  18. package/lib/is-defined.d.ts.map +1 -0
  19. package/lib/is-defined.js +7 -0
  20. package/lib/is-defined.js.map +1 -0
  21. package/lib/is-function.d.ts +2 -0
  22. package/lib/is-function.d.ts.map +1 -0
  23. package/lib/is-function.js +4 -0
  24. package/lib/is-function.js.map +1 -0
  25. package/lib/is-promise.d.ts +2 -0
  26. package/lib/is-promise.d.ts.map +1 -0
  27. package/lib/is-promise.js +7 -0
  28. package/lib/is-promise.js.map +1 -0
  29. package/lib/is-url.d.ts +2 -0
  30. package/lib/is-url.d.ts.map +1 -0
  31. package/lib/is-url.js +4 -0
  32. package/lib/is-url.js.map +1 -0
  33. package/lib/iterables/_isIterator.d.ts +2 -0
  34. package/lib/iterables/_isIterator.d.ts.map +1 -0
  35. package/lib/iterables/_isIterator.js +9 -0
  36. package/lib/iterables/_isIterator.js.map +1 -0
  37. package/lib/iterables/index.d.ts +7 -0
  38. package/lib/iterables/index.d.ts.map +1 -0
  39. package/lib/iterables/index.js +7 -0
  40. package/lib/iterables/index.js.map +1 -0
  41. package/lib/iterables/is-async-generator.d.ts +2 -0
  42. package/lib/iterables/is-async-generator.d.ts.map +1 -0
  43. package/lib/iterables/is-async-generator.js +10 -0
  44. package/lib/iterables/is-async-generator.js.map +1 -0
  45. package/lib/iterables/is-async-iterable.d.ts +2 -0
  46. package/lib/iterables/is-async-iterable.d.ts.map +1 -0
  47. package/lib/iterables/is-async-iterable.js +4 -0
  48. package/lib/iterables/is-async-iterable.js.map +1 -0
  49. package/lib/iterables/is-async-iterator.d.ts +2 -0
  50. package/lib/iterables/is-async-iterator.d.ts.map +1 -0
  51. package/lib/iterables/is-async-iterator.js +6 -0
  52. package/lib/iterables/is-async-iterator.js.map +1 -0
  53. package/lib/iterables/is-generator.d.ts +2 -0
  54. package/lib/iterables/is-generator.d.ts.map +1 -0
  55. package/lib/iterables/is-generator.js +10 -0
  56. package/lib/iterables/is-generator.js.map +1 -0
  57. package/lib/iterables/is-iterable.d.ts +2 -0
  58. package/lib/iterables/is-iterable.d.ts.map +1 -0
  59. package/lib/iterables/is-iterable.js +4 -0
  60. package/lib/iterables/is-iterable.js.map +1 -0
  61. package/lib/iterables/is-iterator.d.ts +2 -0
  62. package/lib/iterables/is-iterator.d.ts.map +1 -0
  63. package/lib/iterables/is-iterator.js +6 -0
  64. package/lib/iterables/is-iterator.js.map +1 -0
  65. package/lib-commonjs/assert-never.js +8 -0
  66. package/lib-commonjs/assert-never.js.map +1 -0
  67. package/lib-commonjs/index.js +11 -0
  68. package/lib-commonjs/index.js.map +1 -0
  69. package/lib-commonjs/is-array.js +8 -0
  70. package/lib-commonjs/is-array.js.map +1 -0
  71. package/lib-commonjs/is-defined.js +12 -0
  72. package/lib-commonjs/is-defined.js.map +1 -0
  73. package/lib-commonjs/is-function.js +8 -0
  74. package/lib-commonjs/is-function.js.map +1 -0
  75. package/lib-commonjs/is-promise.js +11 -0
  76. package/lib-commonjs/is-promise.js.map +1 -0
  77. package/lib-commonjs/is-url.js +8 -0
  78. package/lib-commonjs/is-url.js.map +1 -0
  79. package/lib-commonjs/iterables/_isIterator.js +13 -0
  80. package/lib-commonjs/iterables/_isIterator.js.map +1 -0
  81. package/lib-commonjs/iterables/index.js +10 -0
  82. package/lib-commonjs/iterables/index.js.map +1 -0
  83. package/lib-commonjs/iterables/is-async-generator.js +14 -0
  84. package/lib-commonjs/iterables/is-async-generator.js.map +1 -0
  85. package/lib-commonjs/iterables/is-async-iterable.js +8 -0
  86. package/lib-commonjs/iterables/is-async-iterable.js.map +1 -0
  87. package/lib-commonjs/iterables/is-async-iterator.js +10 -0
  88. package/lib-commonjs/iterables/is-async-iterator.js.map +1 -0
  89. package/lib-commonjs/iterables/is-generator.js +14 -0
  90. package/lib-commonjs/iterables/is-generator.js.map +1 -0
  91. package/lib-commonjs/iterables/is-iterable.js +8 -0
  92. package/lib-commonjs/iterables/is-iterable.js.map +1 -0
  93. package/lib-commonjs/iterables/is-iterator.js +10 -0
  94. package/lib-commonjs/iterables/is-iterator.js.map +1 -0
  95. package/package.json +27 -0
  96. package/src/assert-never.ts +3 -0
  97. package/src/index.ts +7 -0
  98. package/src/is-array.ts +3 -0
  99. package/src/is-defined.ts +8 -0
  100. package/src/is-function.ts +3 -0
  101. package/src/is-promise.ts +7 -0
  102. package/src/is-url.ts +4 -0
  103. package/src/iterables/_isIterator.ts +11 -0
  104. package/src/iterables/index.ts +6 -0
  105. package/src/iterables/is-async-generator.ts +10 -0
  106. package/src/iterables/is-async-iterable.ts +4 -0
  107. package/src/iterables/is-async-iterator.ts +6 -0
  108. package/src/iterables/is-generator.ts +10 -0
  109. package/src/iterables/is-iterable.ts +3 -0
  110. package/src/iterables/is-iterator.ts +6 -0
  111. package/tsconfig.json +4 -0
  112. package/type-guards.build.log +21 -0
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",
3
+
4
+ "rigPackageName": "@rushstack/heft-web-rig",
5
+ "rigProfile": "library"
6
+ }
@@ -0,0 +1,2 @@
1
+ export declare function assertNever(x: never): never;
2
+ //# sourceMappingURL=assert-never.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert-never.d.ts","sourceRoot":"","sources":["../src/assert-never.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,GAAG,KAAK,CAE3C"}
@@ -0,0 +1,4 @@
1
+ export function assertNever(x) {
2
+ throw new Error("Unexpected object: " + x);
3
+ }
4
+ //# sourceMappingURL=assert-never.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert-never.js","sourceRoot":"","sources":["../src/assert-never.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,WAAW,CAAC,CAAQ;IAChC,MAAM,IAAI,KAAK,CAAC,qBAAqB,GAAG,CAAC,CAAC,CAAC;AAC/C,CAAC","sourcesContent":["export function assertNever(x: never): never {\n throw new Error(\"Unexpected object: \" + x);\n}\n"]}
package/lib/index.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ export * from './assert-never';
2
+ export * from './is-array';
3
+ export * from './is-defined';
4
+ export * from './is-function';
5
+ export * from './is-promise';
6
+ export * from './is-url';
7
+ export * from './iterables';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,8 @@
1
+ export * from './assert-never';
2
+ export * from './is-array';
3
+ export * from './is-defined';
4
+ export * from './is-function';
5
+ export * from './is-promise';
6
+ export * from './is-url';
7
+ export * from './iterables';
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC","sourcesContent":["export * from './assert-never';\nexport * from './is-array';\nexport * from './is-defined';\nexport * from './is-function';\nexport * from './is-promise';\nexport * from './is-url';\nexport * from './iterables';\n"]}
@@ -0,0 +1,2 @@
1
+ export declare function isArray(value: any): value is Array<any>;
2
+ //# sourceMappingURL=is-array.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-array.d.ts","sourceRoot":"","sources":["../src/is-array.ts"],"names":[],"mappings":"AAAA,wBAAgB,OAAO,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,KAAK,CAAC,GAAG,CAAC,CAEvD"}
@@ -0,0 +1,4 @@
1
+ export function isArray(value) {
2
+ return Array.isArray(value);
3
+ }
4
+ //# sourceMappingURL=is-array.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-array.js","sourceRoot":"","sources":["../src/is-array.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,OAAO,CAAC,KAAU;IAC9B,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC","sourcesContent":["export function isArray(value: any): value is Array<any>{\n return Array.isArray(value);\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export declare function isDefined<T>(p: T | null | undefined): p is T;
2
+ export declare function isNotDefined<T>(p: T | null | undefined): p is undefined | null;
3
+ //# sourceMappingURL=is-defined.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-defined.d.ts","sourceRoot":"","sources":["../src/is-defined.ts"],"names":[],"mappings":"AACA,wBAAgB,SAAS,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,CAAC,IAAI,CAAC,CAE5D;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,IAAI,GAAG,SAAS,GAAG,CAAC,IAAI,SAAS,GAAG,IAAI,CAE5E"}
@@ -0,0 +1,7 @@
1
+ export function isDefined(p) {
2
+ return p !== undefined && p !== null;
3
+ }
4
+ export function isNotDefined(p) {
5
+ return p === undefined || p === null;
6
+ }
7
+ //# sourceMappingURL=is-defined.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-defined.js","sourceRoot":"","sources":["../src/is-defined.ts"],"names":[],"mappings":"AACA,MAAM,UAAU,SAAS,CAAI,CAAuB;IAClD,OAAO,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,IAAI,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,YAAY,CAAI,CAAuB;IACnD,OAAO,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,IAAI,CAAC;AACvC,CAAC","sourcesContent":["\nexport function isDefined<T>(p: T | null | undefined): p is T {\n return p !== undefined && p !== null;\n}\n\nexport function isNotDefined<T>(p: T | null | undefined): p is undefined | null {\n return p === undefined || p === null;\n }\n"]}
@@ -0,0 +1,2 @@
1
+ export declare function isFunction(value: any): value is (...args: any[]) => any;
2
+ //# sourceMappingURL=is-function.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-function.d.ts","sourceRoot":"","sources":["../src/is-function.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,CAAC,GAAG,IAAI,EAAC,GAAG,EAAE,KAAG,GAAG,CAEpE"}
@@ -0,0 +1,4 @@
1
+ export function isFunction(value) {
2
+ return typeof (value) === 'function';
3
+ }
4
+ //# sourceMappingURL=is-function.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-function.js","sourceRoot":"","sources":["../src/is-function.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,UAAU,CAAC,KAAU;IACjC,OAAO,OAAO,CAAC,KAAK,CAAC,KAAK,UAAU,CAAC;AACzC,CAAC","sourcesContent":["export function isFunction(value: any): value is (...args:any[])=>any {\n return typeof (value) === 'function';\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export declare function isPromiseLike(value: any): value is PromiseLike<any>;
2
+ //# sourceMappingURL=is-promise.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-promise.d.ts","sourceRoot":"","sources":["../src/is-promise.ts"],"names":[],"mappings":"AAEA,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,WAAW,CAAC,GAAG,CAAC,CAInE"}
@@ -0,0 +1,7 @@
1
+ import { isFunction } from './is-function';
2
+ export function isPromiseLike(value) {
3
+ return value instanceof Promise
4
+ || /\bPromise\b/.test(Object.prototype.toString.call(value))
5
+ || 'then' in value && isFunction(value?.then);
6
+ }
7
+ //# sourceMappingURL=is-promise.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-promise.js","sourceRoot":"","sources":["../src/is-promise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,UAAU,aAAa,CAAC,KAAU;IACtC,OAAO,KAAK,YAAY,OAAO;WAC1B,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;WACzD,MAAM,IAAI,KAAK,IAAI,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AAClD,CAAC","sourcesContent":["import { isFunction } from './is-function';\n\nexport function isPromiseLike(value: any): value is PromiseLike<any> {\n return value instanceof Promise\n || /\\bPromise\\b/.test(Object.prototype.toString.call(value))\n || 'then' in value && isFunction(value?.then);\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export declare function isUrl(url: any): url is URL;
2
+ //# sourceMappingURL=is-url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-url.d.ts","sourceRoot":"","sources":["../src/is-url.ts"],"names":[],"mappings":"AACA,wBAAgB,KAAK,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,GAAG,CAE1C"}
package/lib/is-url.js ADDED
@@ -0,0 +1,4 @@
1
+ export function isUrl(url) {
2
+ return url instanceof URL;
3
+ }
4
+ //# sourceMappingURL=is-url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-url.js","sourceRoot":"","sources":["../src/is-url.ts"],"names":[],"mappings":"AACA,MAAM,UAAU,KAAK,CAAC,GAAQ;IAC5B,OAAO,GAAG,YAAY,GAAG,CAAC;AAC5B,CAAC","sourcesContent":["\nexport function isUrl(url: any): url is URL {\n return url instanceof URL;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export declare function _isIterator(value: any): value is Iterator<any>;
2
+ //# sourceMappingURL=_isIterator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_isIterator.d.ts","sourceRoot":"","sources":["../../src/iterables/_isIterator.ts"],"names":[],"mappings":"AAEA,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,QAAQ,CAAC,GAAG,CAAC,CAQ9D"}
@@ -0,0 +1,9 @@
1
+ import { isFunction } from '../is-function';
2
+ export function _isIterator(value) {
3
+ if (value?.[Symbol.toStringTag]?.split(/\s+/)?.includes('Iterator'))
4
+ return true;
5
+ if (/\bIterator\b/.test(Object.prototype.toString.call(value)))
6
+ return true;
7
+ return isFunction(value?.next);
8
+ }
9
+ //# sourceMappingURL=_isIterator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_isIterator.js","sourceRoot":"","sources":["../../src/iterables/_isIterator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,UAAU,WAAW,CAAC,KAAU;IACpC,IAAI,KAAK,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC;QACjE,OAAO,IAAI,CAAC;IAEd,IAAI,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5D,OAAO,IAAI,CAAC;IAEd,OAAO,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AACjC,CAAC","sourcesContent":["import { isFunction } from '../is-function';\n\nexport function _isIterator(value: any): value is Iterator<any> {\n if (value?.[Symbol.toStringTag]?.split(/\\s+/)?.includes('Iterator'))\n return true;\n\n if (/\\bIterator\\b/.test(Object.prototype.toString.call(value)))\n return true;\n\n return isFunction(value?.next);\n}\n"]}
@@ -0,0 +1,7 @@
1
+ export * from './is-async-generator';
2
+ export * from './is-async-iterable';
3
+ export * from './is-async-iterator';
4
+ export * from './is-generator';
5
+ export * from './is-iterable';
6
+ export * from './is-iterator';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/iterables/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
@@ -0,0 +1,7 @@
1
+ export * from './is-async-generator';
2
+ export * from './is-async-iterable';
3
+ export * from './is-async-iterator';
4
+ export * from './is-generator';
5
+ export * from './is-iterable';
6
+ export * from './is-iterator';
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/iterables/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC","sourcesContent":["export * from './is-async-generator';\nexport * from './is-async-iterable';\nexport * from './is-async-iterator';\nexport * from './is-generator';\nexport * from './is-iterable';\nexport * from './is-iterator';\n"]}
@@ -0,0 +1,2 @@
1
+ export declare function isAsyncGenerator(value: any): value is AsyncGenerator<any, any, any>;
2
+ //# sourceMappingURL=is-async-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-async-generator.d.ts","sourceRoot":"","sources":["../../src/iterables/is-async-generator.ts"],"names":[],"mappings":"AAGA,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAMnF"}
@@ -0,0 +1,10 @@
1
+ import { isAsyncIterator } from "./is-async-iterator";
2
+ const AsyncGeneratorFunction = (async function* () { }()).constructor;
3
+ export function isAsyncGenerator(value) {
4
+ if (value?.constructor === AsyncGeneratorFunction)
5
+ return true;
6
+ if (/\bAsyncGenerator\b/.test(Object.prototype.toString.call(value)))
7
+ return true;
8
+ return isAsyncIterator(value) && value?.next?.length === 1;
9
+ }
10
+ //# sourceMappingURL=is-async-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-async-generator.js","sourceRoot":"","sources":["../../src/iterables/is-async-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,sBAAsB,GAAG,CAAC,KAAK,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,WAAqC,CAAC;AAChG,MAAM,UAAU,gBAAgB,CAAC,KAAU;IACzC,IAAI,KAAK,EAAE,WAAW,KAAK,sBAAsB;QAC/C,OAAO,IAAI,CAAC;IACd,IAAI,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAClE,OAAO,IAAI,CAAC;IACd,OAAO,eAAe,CAAC,KAAK,CAAC,IAAI,KAAK,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC,CAAC;AAC7D,CAAC","sourcesContent":["import { isAsyncIterator } from \"./is-async-iterator\";\n\nconst AsyncGeneratorFunction = (async function* () { }()).constructor as AsyncGeneratorFunction;\nexport function isAsyncGenerator(value: any): value is AsyncGenerator<any, any, any> {\n if (value?.constructor === AsyncGeneratorFunction)\n return true;\n if (/\\bAsyncGenerator\\b/.test(Object.prototype.toString.call(value)))\n return true;\n return isAsyncIterator(value) && value?.next?.length === 1;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export declare function isAsyncIterable(value: any): value is AsyncIterable<any>;
2
+ //# sourceMappingURL=is-async-iterable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-async-iterable.d.ts","sourceRoot":"","sources":["../../src/iterables/is-async-iterable.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,aAAa,CAAC,GAAG,CAAC,CAEvE"}
@@ -0,0 +1,4 @@
1
+ export function isAsyncIterable(value) {
2
+ return Symbol.asyncIterator in value;
3
+ }
4
+ //# sourceMappingURL=is-async-iterable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-async-iterable.js","sourceRoot":"","sources":["../../src/iterables/is-async-iterable.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,eAAe,CAAC,KAAU;IACxC,OAAO,MAAM,CAAC,aAAa,IAAI,KAAK,CAAC;AACvC,CAAC","sourcesContent":["export function isAsyncIterable(value: any): value is AsyncIterable<any> {\n return Symbol.asyncIterator in value;\n}\n\n"]}
@@ -0,0 +1,2 @@
1
+ export declare function isAsyncIterator(value: any): value is AsyncIterableIterator<any>;
2
+ //# sourceMappingURL=is-async-iterator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-async-iterator.d.ts","sourceRoot":"","sources":["../../src/iterables/is-async-iterator.ts"],"names":[],"mappings":"AAGA,wBAAgB,eAAe,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,qBAAqB,CAAC,GAAG,CAAC,CAE/E"}
@@ -0,0 +1,6 @@
1
+ import { _isIterator } from './_isIterator';
2
+ import { isAsyncIterable } from "./is-async-iterable";
3
+ export function isAsyncIterator(value) {
4
+ return isAsyncIterable(value) && _isIterator(value);
5
+ }
6
+ //# sourceMappingURL=is-async-iterator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-async-iterator.js","sourceRoot":"","sources":["../../src/iterables/is-async-iterator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,MAAM,UAAU,eAAe,CAAC,KAAU;IACxC,OAAO,eAAe,CAAC,KAAK,CAAC,IAAI,WAAW,CAAC,KAAK,CAAC,CAAC;AACtD,CAAC","sourcesContent":["import { _isIterator } from './_isIterator';\nimport { isAsyncIterable } from \"./is-async-iterable\";\n\nexport function isAsyncIterator(value: any): value is AsyncIterableIterator<any> {\n return isAsyncIterable(value) && _isIterator(value);\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export declare function isGenerator(value: any): value is Generator<any, any, any>;
2
+ //# sourceMappingURL=is-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-generator.d.ts","sourceRoot":"","sources":["../../src/iterables/is-generator.ts"],"names":[],"mappings":"AAGA,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAMzE"}
@@ -0,0 +1,10 @@
1
+ import { isIterator } from "./is-iterator";
2
+ const GeneratorFunction = (function* () { }()).constructor;
3
+ export function isGenerator(value) {
4
+ if (value?.constructor === GeneratorFunction)
5
+ return true;
6
+ if (/\bGenerator\b/.test(Object.prototype.toString.call(value)))
7
+ return true;
8
+ return isIterator(value) && value?.next?.length === 1;
9
+ }
10
+ //# sourceMappingURL=is-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-generator.js","sourceRoot":"","sources":["../../src/iterables/is-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,MAAM,iBAAiB,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,WAAgC,CAAC;AAEhF,MAAM,UAAU,WAAW,CAAC,KAAU;IACpC,IAAI,KAAK,EAAE,WAAW,KAAK,iBAAiB;QAC1C,OAAO,IAAI,CAAC;IACd,IAAI,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7D,OAAO,IAAI,CAAC;IACd,OAAO,UAAU,CAAC,KAAK,CAAC,IAAI,KAAK,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC,CAAC;AACxD,CAAC","sourcesContent":["import { isIterator } from \"./is-iterator\";\nconst GeneratorFunction = (function* () { }()).constructor as GeneratorFunction;\n\nexport function isGenerator(value: any): value is Generator<any, any, any> {\n if (value?.constructor === GeneratorFunction)\n return true;\n if (/\\bGenerator\\b/.test(Object.prototype.toString.call(value)))\n return true;\n return isIterator(value) && value?.next?.length === 1;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export declare function isIterable(value: any): value is Iterable<any>;
2
+ //# sourceMappingURL=is-iterable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-iterable.d.ts","sourceRoot":"","sources":["../../src/iterables/is-iterable.ts"],"names":[],"mappings":"AAAA,wBAAgB,UAAU,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,QAAQ,CAAC,GAAG,CAAC,CAE7D"}
@@ -0,0 +1,4 @@
1
+ export function isIterable(value) {
2
+ return Symbol.iterator in value;
3
+ }
4
+ //# sourceMappingURL=is-iterable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-iterable.js","sourceRoot":"","sources":["../../src/iterables/is-iterable.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,UAAU,CAAC,KAAU;IACnC,OAAO,MAAM,CAAC,QAAQ,IAAI,KAAK,CAAC;AAClC,CAAC","sourcesContent":["export function isIterable(value: any): value is Iterable<any> {\n return Symbol.iterator in value;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export declare function isIterator(value: any): value is IterableIterator<any>;
2
+ //# sourceMappingURL=is-iterator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-iterator.d.ts","sourceRoot":"","sources":["../../src/iterables/is-iterator.ts"],"names":[],"mappings":"AAGA,wBAAgB,UAAU,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,gBAAgB,CAAC,GAAG,CAAC,CAErE"}
@@ -0,0 +1,6 @@
1
+ import { isIterable } from './is-iterable';
2
+ import { _isIterator } from './_isIterator';
3
+ export function isIterator(value) {
4
+ return isIterable(value) && _isIterator(value);
5
+ }
6
+ //# sourceMappingURL=is-iterator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-iterator.js","sourceRoot":"","sources":["../../src/iterables/is-iterator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,UAAU,UAAU,CAAC,KAAU;IACnC,OAAO,UAAU,CAAC,KAAK,CAAC,IAAI,WAAW,CAAC,KAAK,CAAC,CAAC;AACjD,CAAC","sourcesContent":["import { isIterable } from './is-iterable';\nimport { _isIterator } from './_isIterator';\n\nexport function isIterator(value: any): value is IterableIterator<any> {\n return isIterable(value) && _isIterator(value);\n}\n"]}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertNever = void 0;
4
+ function assertNever(x) {
5
+ throw new Error("Unexpected object: " + x);
6
+ }
7
+ exports.assertNever = assertNever;
8
+ //# sourceMappingURL=assert-never.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert-never.js","sourceRoot":"","sources":["../src/assert-never.ts"],"names":[],"mappings":";;;AAAA,SAAgB,WAAW,CAAC,CAAQ;IAChC,MAAM,IAAI,KAAK,CAAC,qBAAqB,GAAG,CAAC,CAAC,CAAC;AAC/C,CAAC;AAFD,kCAEC","sourcesContent":["export function assertNever(x: never): never {\n throw new Error(\"Unexpected object: \" + x);\n}\n"]}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./assert-never"), exports);
5
+ tslib_1.__exportStar(require("./is-array"), exports);
6
+ tslib_1.__exportStar(require("./is-defined"), exports);
7
+ tslib_1.__exportStar(require("./is-function"), exports);
8
+ tslib_1.__exportStar(require("./is-promise"), exports);
9
+ tslib_1.__exportStar(require("./is-url"), exports);
10
+ tslib_1.__exportStar(require("./iterables"), exports);
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,yDAA+B;AAC/B,qDAA2B;AAC3B,uDAA6B;AAC7B,wDAA8B;AAC9B,uDAA6B;AAC7B,mDAAyB;AACzB,sDAA4B","sourcesContent":["export * from './assert-never';\nexport * from './is-array';\nexport * from './is-defined';\nexport * from './is-function';\nexport * from './is-promise';\nexport * from './is-url';\nexport * from './iterables';\n"]}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isArray = void 0;
4
+ function isArray(value) {
5
+ return Array.isArray(value);
6
+ }
7
+ exports.isArray = isArray;
8
+ //# sourceMappingURL=is-array.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-array.js","sourceRoot":"","sources":["../src/is-array.ts"],"names":[],"mappings":";;;AAAA,SAAgB,OAAO,CAAC,KAAU;IAC9B,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC;AAFD,0BAEC","sourcesContent":["export function isArray(value: any): value is Array<any>{\n return Array.isArray(value);\n}\n"]}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isNotDefined = exports.isDefined = void 0;
4
+ function isDefined(p) {
5
+ return p !== undefined && p !== null;
6
+ }
7
+ exports.isDefined = isDefined;
8
+ function isNotDefined(p) {
9
+ return p === undefined || p === null;
10
+ }
11
+ exports.isNotDefined = isNotDefined;
12
+ //# sourceMappingURL=is-defined.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-defined.js","sourceRoot":"","sources":["../src/is-defined.ts"],"names":[],"mappings":";;;AACA,SAAgB,SAAS,CAAI,CAAuB;IAClD,OAAO,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,IAAI,CAAC;AACvC,CAAC;AAFD,8BAEC;AAED,SAAgB,YAAY,CAAI,CAAuB;IACnD,OAAO,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,IAAI,CAAC;AACvC,CAAC;AAFH,oCAEG","sourcesContent":["\nexport function isDefined<T>(p: T | null | undefined): p is T {\n return p !== undefined && p !== null;\n}\n\nexport function isNotDefined<T>(p: T | null | undefined): p is undefined | null {\n return p === undefined || p === null;\n }\n"]}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isFunction = void 0;
4
+ function isFunction(value) {
5
+ return typeof (value) === 'function';
6
+ }
7
+ exports.isFunction = isFunction;
8
+ //# sourceMappingURL=is-function.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-function.js","sourceRoot":"","sources":["../src/is-function.ts"],"names":[],"mappings":";;;AAAA,SAAgB,UAAU,CAAC,KAAU;IACjC,OAAO,OAAO,CAAC,KAAK,CAAC,KAAK,UAAU,CAAC;AACzC,CAAC;AAFD,gCAEC","sourcesContent":["export function isFunction(value: any): value is (...args:any[])=>any {\n return typeof (value) === 'function';\n}\n"]}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isPromiseLike = void 0;
4
+ const is_function_1 = require("./is-function");
5
+ function isPromiseLike(value) {
6
+ return value instanceof Promise
7
+ || /\bPromise\b/.test(Object.prototype.toString.call(value))
8
+ || 'then' in value && (0, is_function_1.isFunction)(value?.then);
9
+ }
10
+ exports.isPromiseLike = isPromiseLike;
11
+ //# sourceMappingURL=is-promise.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-promise.js","sourceRoot":"","sources":["../src/is-promise.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAE3C,SAAgB,aAAa,CAAC,KAAU;IACtC,OAAO,KAAK,YAAY,OAAO;WAC1B,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;WACzD,MAAM,IAAI,KAAK,IAAI,IAAA,wBAAU,EAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AAClD,CAAC;AAJD,sCAIC","sourcesContent":["import { isFunction } from './is-function';\n\nexport function isPromiseLike(value: any): value is PromiseLike<any> {\n return value instanceof Promise\n || /\\bPromise\\b/.test(Object.prototype.toString.call(value))\n || 'then' in value && isFunction(value?.then);\n}\n"]}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isUrl = void 0;
4
+ function isUrl(url) {
5
+ return url instanceof URL;
6
+ }
7
+ exports.isUrl = isUrl;
8
+ //# sourceMappingURL=is-url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-url.js","sourceRoot":"","sources":["../src/is-url.ts"],"names":[],"mappings":";;;AACA,SAAgB,KAAK,CAAC,GAAQ;IAC5B,OAAO,GAAG,YAAY,GAAG,CAAC;AAC5B,CAAC;AAFD,sBAEC","sourcesContent":["\nexport function isUrl(url: any): url is URL {\n return url instanceof URL;\n}\n"]}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports._isIterator = void 0;
4
+ const is_function_1 = require("../is-function");
5
+ function _isIterator(value) {
6
+ if (value?.[Symbol.toStringTag]?.split(/\s+/)?.includes('Iterator'))
7
+ return true;
8
+ if (/\bIterator\b/.test(Object.prototype.toString.call(value)))
9
+ return true;
10
+ return (0, is_function_1.isFunction)(value?.next);
11
+ }
12
+ exports._isIterator = _isIterator;
13
+ //# sourceMappingURL=_isIterator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_isIterator.js","sourceRoot":"","sources":["../../src/iterables/_isIterator.ts"],"names":[],"mappings":";;;AAAA,gDAA4C;AAE5C,SAAgB,WAAW,CAAC,KAAU;IACpC,IAAI,KAAK,EAAE,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,UAAU,CAAC;QACjE,OAAO,IAAI,CAAC;IAEd,IAAI,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC5D,OAAO,IAAI,CAAC;IAEd,OAAO,IAAA,wBAAU,EAAC,KAAK,EAAE,IAAI,CAAC,CAAC;AACjC,CAAC;AARD,kCAQC","sourcesContent":["import { isFunction } from '../is-function';\n\nexport function _isIterator(value: any): value is Iterator<any> {\n if (value?.[Symbol.toStringTag]?.split(/\\s+/)?.includes('Iterator'))\n return true;\n\n if (/\\bIterator\\b/.test(Object.prototype.toString.call(value)))\n return true;\n\n return isFunction(value?.next);\n}\n"]}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./is-async-generator"), exports);
5
+ tslib_1.__exportStar(require("./is-async-iterable"), exports);
6
+ tslib_1.__exportStar(require("./is-async-iterator"), exports);
7
+ tslib_1.__exportStar(require("./is-generator"), exports);
8
+ tslib_1.__exportStar(require("./is-iterable"), exports);
9
+ tslib_1.__exportStar(require("./is-iterator"), exports);
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/iterables/index.ts"],"names":[],"mappings":";;;AAAA,+DAAqC;AACrC,8DAAoC;AACpC,8DAAoC;AACpC,yDAA+B;AAC/B,wDAA8B;AAC9B,wDAA8B","sourcesContent":["export * from './is-async-generator';\nexport * from './is-async-iterable';\nexport * from './is-async-iterator';\nexport * from './is-generator';\nexport * from './is-iterable';\nexport * from './is-iterator';\n"]}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isAsyncGenerator = void 0;
4
+ const is_async_iterator_1 = require("./is-async-iterator");
5
+ const AsyncGeneratorFunction = (async function* () { }()).constructor;
6
+ function isAsyncGenerator(value) {
7
+ if (value?.constructor === AsyncGeneratorFunction)
8
+ return true;
9
+ if (/\bAsyncGenerator\b/.test(Object.prototype.toString.call(value)))
10
+ return true;
11
+ return (0, is_async_iterator_1.isAsyncIterator)(value) && value?.next?.length === 1;
12
+ }
13
+ exports.isAsyncGenerator = isAsyncGenerator;
14
+ //# sourceMappingURL=is-async-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-async-generator.js","sourceRoot":"","sources":["../../src/iterables/is-async-generator.ts"],"names":[],"mappings":";;;AAAA,2DAAsD;AAEtD,MAAM,sBAAsB,GAAG,CAAC,KAAK,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,WAAqC,CAAC;AAChG,SAAgB,gBAAgB,CAAC,KAAU;IACzC,IAAI,KAAK,EAAE,WAAW,KAAK,sBAAsB;QAC/C,OAAO,IAAI,CAAC;IACd,IAAI,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAClE,OAAO,IAAI,CAAC;IACd,OAAO,IAAA,mCAAe,EAAC,KAAK,CAAC,IAAI,KAAK,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC,CAAC;AAC7D,CAAC;AAND,4CAMC","sourcesContent":["import { isAsyncIterator } from \"./is-async-iterator\";\n\nconst AsyncGeneratorFunction = (async function* () { }()).constructor as AsyncGeneratorFunction;\nexport function isAsyncGenerator(value: any): value is AsyncGenerator<any, any, any> {\n if (value?.constructor === AsyncGeneratorFunction)\n return true;\n if (/\\bAsyncGenerator\\b/.test(Object.prototype.toString.call(value)))\n return true;\n return isAsyncIterator(value) && value?.next?.length === 1;\n}\n"]}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isAsyncIterable = void 0;
4
+ function isAsyncIterable(value) {
5
+ return Symbol.asyncIterator in value;
6
+ }
7
+ exports.isAsyncIterable = isAsyncIterable;
8
+ //# sourceMappingURL=is-async-iterable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-async-iterable.js","sourceRoot":"","sources":["../../src/iterables/is-async-iterable.ts"],"names":[],"mappings":";;;AAAA,SAAgB,eAAe,CAAC,KAAU;IACxC,OAAO,MAAM,CAAC,aAAa,IAAI,KAAK,CAAC;AACvC,CAAC;AAFD,0CAEC","sourcesContent":["export function isAsyncIterable(value: any): value is AsyncIterable<any> {\n return Symbol.asyncIterator in value;\n}\n\n"]}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isAsyncIterator = void 0;
4
+ const _isIterator_1 = require("./_isIterator");
5
+ const is_async_iterable_1 = require("./is-async-iterable");
6
+ function isAsyncIterator(value) {
7
+ return (0, is_async_iterable_1.isAsyncIterable)(value) && (0, _isIterator_1._isIterator)(value);
8
+ }
9
+ exports.isAsyncIterator = isAsyncIterator;
10
+ //# sourceMappingURL=is-async-iterator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-async-iterator.js","sourceRoot":"","sources":["../../src/iterables/is-async-iterator.ts"],"names":[],"mappings":";;;AAAA,+CAA4C;AAC5C,2DAAsD;AAEtD,SAAgB,eAAe,CAAC,KAAU;IACxC,OAAO,IAAA,mCAAe,EAAC,KAAK,CAAC,IAAI,IAAA,yBAAW,EAAC,KAAK,CAAC,CAAC;AACtD,CAAC;AAFD,0CAEC","sourcesContent":["import { _isIterator } from './_isIterator';\nimport { isAsyncIterable } from \"./is-async-iterable\";\n\nexport function isAsyncIterator(value: any): value is AsyncIterableIterator<any> {\n return isAsyncIterable(value) && _isIterator(value);\n}\n"]}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isGenerator = void 0;
4
+ const is_iterator_1 = require("./is-iterator");
5
+ const GeneratorFunction = (function* () { }()).constructor;
6
+ function isGenerator(value) {
7
+ if (value?.constructor === GeneratorFunction)
8
+ return true;
9
+ if (/\bGenerator\b/.test(Object.prototype.toString.call(value)))
10
+ return true;
11
+ return (0, is_iterator_1.isIterator)(value) && value?.next?.length === 1;
12
+ }
13
+ exports.isGenerator = isGenerator;
14
+ //# sourceMappingURL=is-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-generator.js","sourceRoot":"","sources":["../../src/iterables/is-generator.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAC3C,MAAM,iBAAiB,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,WAAgC,CAAC;AAEhF,SAAgB,WAAW,CAAC,KAAU;IACpC,IAAI,KAAK,EAAE,WAAW,KAAK,iBAAiB;QAC1C,OAAO,IAAI,CAAC;IACd,IAAI,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7D,OAAO,IAAI,CAAC;IACd,OAAO,IAAA,wBAAU,EAAC,KAAK,CAAC,IAAI,KAAK,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC,CAAC;AACxD,CAAC;AAND,kCAMC","sourcesContent":["import { isIterator } from \"./is-iterator\";\nconst GeneratorFunction = (function* () { }()).constructor as GeneratorFunction;\n\nexport function isGenerator(value: any): value is Generator<any, any, any> {\n if (value?.constructor === GeneratorFunction)\n return true;\n if (/\\bGenerator\\b/.test(Object.prototype.toString.call(value)))\n return true;\n return isIterator(value) && value?.next?.length === 1;\n}\n"]}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isIterable = void 0;
4
+ function isIterable(value) {
5
+ return Symbol.iterator in value;
6
+ }
7
+ exports.isIterable = isIterable;
8
+ //# sourceMappingURL=is-iterable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-iterable.js","sourceRoot":"","sources":["../../src/iterables/is-iterable.ts"],"names":[],"mappings":";;;AAAA,SAAgB,UAAU,CAAC,KAAU;IACnC,OAAO,MAAM,CAAC,QAAQ,IAAI,KAAK,CAAC;AAClC,CAAC;AAFD,gCAEC","sourcesContent":["export function isIterable(value: any): value is Iterable<any> {\n return Symbol.iterator in value;\n}\n"]}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isIterator = void 0;
4
+ const is_iterable_1 = require("./is-iterable");
5
+ const _isIterator_1 = require("./_isIterator");
6
+ function isIterator(value) {
7
+ return (0, is_iterable_1.isIterable)(value) && (0, _isIterator_1._isIterator)(value);
8
+ }
9
+ exports.isIterator = isIterator;
10
+ //# sourceMappingURL=is-iterator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-iterator.js","sourceRoot":"","sources":["../../src/iterables/is-iterator.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAC3C,+CAA4C;AAE5C,SAAgB,UAAU,CAAC,KAAU;IACnC,OAAO,IAAA,wBAAU,EAAC,KAAK,CAAC,IAAI,IAAA,yBAAW,EAAC,KAAK,CAAC,CAAC;AACjD,CAAC;AAFD,gCAEC","sourcesContent":["import { isIterable } from './is-iterable';\nimport { _isIterator } from './_isIterator';\n\nexport function isIterator(value: any): value is IterableIterator<any> {\n return isIterable(value) && _isIterator(value);\n}\n"]}