meteor-node-stubs 1.2.17 → 1.2.19

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 (460) hide show
  1. package/node_modules/@meteorjs/browserify-sign/browser/sign.js +1 -1
  2. package/node_modules/@meteorjs/browserify-sign/browser/verify.js +1 -1
  3. package/node_modules/@meteorjs/browserify-sign/elliptic/benchmarks/deps/jodid.js +82 -0
  4. package/node_modules/@meteorjs/browserify-sign/elliptic/benchmarks/deps/secp256k1.js +41 -0
  5. package/node_modules/@meteorjs/browserify-sign/elliptic/benchmarks/index.js +153 -0
  6. package/node_modules/@meteorjs/browserify-sign/elliptic/benchmarks/package.json +21 -0
  7. package/node_modules/@meteorjs/browserify-sign/elliptic/dist/.gitkeep +0 -0
  8. package/node_modules/@meteorjs/browserify-sign/elliptic/dist/elliptic.js +8961 -0
  9. package/node_modules/@meteorjs/browserify-sign/elliptic/dist/elliptic.min.js +1 -0
  10. package/node_modules/{elliptic → @meteorjs/browserify-sign/elliptic}/lib/elliptic.js +1 -1
  11. package/node_modules/@meteorjs/browserify-sign/elliptic/test/api-test.js +20 -0
  12. package/node_modules/@meteorjs/browserify-sign/elliptic/test/curve-test.js +357 -0
  13. package/node_modules/@meteorjs/browserify-sign/elliptic/test/ecdh-test.js +43 -0
  14. package/node_modules/@meteorjs/browserify-sign/elliptic/test/ecdsa-test.js +547 -0
  15. package/node_modules/@meteorjs/browserify-sign/elliptic/test/ed25519-test.js +138 -0
  16. package/node_modules/@meteorjs/browserify-sign/elliptic/test/fixtures/derivation-fixtures.js +3842 -0
  17. package/node_modules/@meteorjs/browserify-sign/elliptic/test/fixtures/sign.input +1024 -0
  18. package/node_modules/@meteorjs/browserify-sign/elliptic/test/index.js +10 -0
  19. package/node_modules/@meteorjs/browserify-sign/elliptic/test/unittests.html +39 -0
  20. package/node_modules/@meteorjs/browserify-sign/package.json +22 -5
  21. package/node_modules/@meteorjs/create-ecdh/browser.js +1 -1
  22. package/node_modules/@meteorjs/create-ecdh/elliptic/README.md +238 -0
  23. package/node_modules/@meteorjs/create-ecdh/elliptic/benchmarks/deps/jodid.js +82 -0
  24. package/node_modules/@meteorjs/create-ecdh/elliptic/benchmarks/deps/secp256k1.js +41 -0
  25. package/node_modules/@meteorjs/create-ecdh/elliptic/benchmarks/index.js +153 -0
  26. package/node_modules/@meteorjs/create-ecdh/elliptic/benchmarks/package.json +21 -0
  27. package/node_modules/@meteorjs/create-ecdh/elliptic/dist/.gitkeep +0 -0
  28. package/node_modules/@meteorjs/create-ecdh/elliptic/dist/elliptic.js +8961 -0
  29. package/node_modules/@meteorjs/create-ecdh/elliptic/dist/elliptic.min.js +1 -0
  30. package/node_modules/@meteorjs/create-ecdh/elliptic/lib/elliptic/curve/base.js +381 -0
  31. package/node_modules/@meteorjs/create-ecdh/elliptic/lib/elliptic/curve/edwards.js +435 -0
  32. package/node_modules/@meteorjs/create-ecdh/elliptic/lib/elliptic/curve/index.js +8 -0
  33. package/node_modules/@meteorjs/create-ecdh/elliptic/lib/elliptic/curve/mont.js +178 -0
  34. package/node_modules/@meteorjs/create-ecdh/elliptic/lib/elliptic/curve/short.js +938 -0
  35. package/node_modules/@meteorjs/create-ecdh/elliptic/lib/elliptic/curves.js +206 -0
  36. package/node_modules/@meteorjs/create-ecdh/elliptic/lib/elliptic/ec/index.js +278 -0
  37. package/node_modules/@meteorjs/create-ecdh/elliptic/lib/elliptic/ec/key.js +121 -0
  38. package/node_modules/@meteorjs/create-ecdh/elliptic/lib/elliptic/ec/signature.js +176 -0
  39. package/node_modules/@meteorjs/create-ecdh/elliptic/lib/elliptic/eddsa/index.js +121 -0
  40. package/node_modules/@meteorjs/create-ecdh/elliptic/lib/elliptic/eddsa/key.js +95 -0
  41. package/node_modules/@meteorjs/create-ecdh/elliptic/lib/elliptic/eddsa/signature.js +66 -0
  42. package/node_modules/@meteorjs/create-ecdh/elliptic/lib/elliptic/precomputed/secp256k1.js +780 -0
  43. package/node_modules/@meteorjs/create-ecdh/elliptic/lib/elliptic/utils.js +122 -0
  44. package/node_modules/@meteorjs/create-ecdh/elliptic/lib/elliptic.js +13 -0
  45. package/node_modules/@meteorjs/create-ecdh/elliptic/test/api-test.js +20 -0
  46. package/node_modules/@meteorjs/create-ecdh/elliptic/test/curve-test.js +357 -0
  47. package/node_modules/@meteorjs/create-ecdh/elliptic/test/ecdh-test.js +43 -0
  48. package/node_modules/@meteorjs/create-ecdh/elliptic/test/ecdsa-test.js +547 -0
  49. package/node_modules/@meteorjs/create-ecdh/elliptic/test/ed25519-test.js +138 -0
  50. package/node_modules/@meteorjs/create-ecdh/elliptic/test/fixtures/derivation-fixtures.js +3842 -0
  51. package/node_modules/@meteorjs/create-ecdh/elliptic/test/fixtures/sign.input +1024 -0
  52. package/node_modules/@meteorjs/create-ecdh/elliptic/test/index.js +10 -0
  53. package/node_modules/@meteorjs/create-ecdh/elliptic/test/unittests.html +39 -0
  54. package/node_modules/@meteorjs/create-ecdh/node_modules/bn.js/lib/bn.js +1 -0
  55. package/node_modules/@meteorjs/create-ecdh/node_modules/bn.js/package.json +1 -1
  56. package/node_modules/@meteorjs/create-ecdh/package.json +23 -5
  57. package/node_modules/asn1.js/node_modules/bn.js/lib/bn.js +6 -5
  58. package/node_modules/asn1.js/node_modules/bn.js/package.json +1 -1
  59. package/node_modules/asn1.js/node_modules/bn.js/util/genCombMulTo.js +65 -0
  60. package/node_modules/asn1.js/node_modules/bn.js/util/genCombMulTo10.js +65 -0
  61. package/node_modules/available-typed-arrays/.eslintrc +0 -4
  62. package/node_modules/available-typed-arrays/CHANGELOG.md +21 -0
  63. package/node_modules/available-typed-arrays/README.md +16 -13
  64. package/node_modules/available-typed-arrays/index.d.ts +8 -0
  65. package/node_modules/available-typed-arrays/index.js +4 -14
  66. package/node_modules/available-typed-arrays/package.json +26 -15
  67. package/node_modules/available-typed-arrays/tsconfig.json +49 -0
  68. package/node_modules/bn.js/README.md +11 -5
  69. package/node_modules/bn.js/lib/bn.js +6 -5
  70. package/node_modules/bn.js/package.json +1 -1
  71. package/node_modules/browserify-rsa/CHANGELOG.md +98 -0
  72. package/node_modules/browserify-rsa/README.md +0 -2
  73. package/node_modules/browserify-rsa/index.js +31 -28
  74. package/node_modules/browserify-rsa/package.json +64 -29
  75. package/node_modules/call-bind/CHANGELOG.md +13 -0
  76. package/node_modules/call-bind/index.js +6 -17
  77. package/node_modules/call-bind/package.json +14 -16
  78. package/node_modules/call-bind/test/index.js +4 -10
  79. package/node_modules/call-bind-apply-helpers/.eslintrc +17 -0
  80. package/node_modules/call-bind-apply-helpers/.github/FUNDING.yml +12 -0
  81. package/node_modules/call-bind-apply-helpers/.nycrc +9 -0
  82. package/node_modules/call-bind-apply-helpers/CHANGELOG.md +30 -0
  83. package/node_modules/{has-proto → call-bind-apply-helpers}/LICENSE +1 -1
  84. package/node_modules/call-bind-apply-helpers/README.md +62 -0
  85. package/node_modules/call-bind-apply-helpers/actualApply.d.ts +1 -0
  86. package/node_modules/call-bind-apply-helpers/actualApply.js +10 -0
  87. package/node_modules/call-bind-apply-helpers/applyBind.d.ts +19 -0
  88. package/node_modules/call-bind-apply-helpers/applyBind.js +10 -0
  89. package/node_modules/call-bind-apply-helpers/functionApply.d.ts +1 -0
  90. package/node_modules/call-bind-apply-helpers/functionApply.js +4 -0
  91. package/node_modules/call-bind-apply-helpers/functionCall.d.ts +1 -0
  92. package/node_modules/call-bind-apply-helpers/functionCall.js +4 -0
  93. package/node_modules/call-bind-apply-helpers/index.d.ts +64 -0
  94. package/node_modules/call-bind-apply-helpers/index.js +15 -0
  95. package/node_modules/call-bind-apply-helpers/package.json +85 -0
  96. package/node_modules/call-bind-apply-helpers/reflectApply.d.ts +3 -0
  97. package/node_modules/call-bind-apply-helpers/reflectApply.js +4 -0
  98. package/node_modules/call-bind-apply-helpers/test/index.js +63 -0
  99. package/node_modules/call-bind-apply-helpers/tsconfig.json +9 -0
  100. package/node_modules/call-bound/.eslintrc +13 -0
  101. package/node_modules/call-bound/.github/FUNDING.yml +12 -0
  102. package/node_modules/call-bound/.nycrc +9 -0
  103. package/node_modules/call-bound/CHANGELOG.md +42 -0
  104. package/node_modules/{@meteorjs/browserify-sign/node_modules/bn.js → call-bound}/LICENSE +3 -1
  105. package/node_modules/call-bound/README.md +53 -0
  106. package/node_modules/call-bound/index.d.ts +94 -0
  107. package/node_modules/call-bound/index.js +19 -0
  108. package/node_modules/call-bound/package.json +99 -0
  109. package/node_modules/call-bound/test/index.js +61 -0
  110. package/node_modules/call-bound/tsconfig.json +10 -0
  111. package/node_modules/cipher-base/.eslintrc +24 -1
  112. package/node_modules/cipher-base/.github/FUNDING.yml +12 -0
  113. package/node_modules/cipher-base/CHANGELOG.md +66 -0
  114. package/node_modules/cipher-base/index.js +145 -77
  115. package/node_modules/cipher-base/package.json +60 -30
  116. package/node_modules/cipher-base/test/index.js +221 -0
  117. package/node_modules/des.js/lib/des/cipher.js +1 -0
  118. package/node_modules/des.js/lib/des/des.js +8 -0
  119. package/node_modules/des.js/package.json +3 -4
  120. package/node_modules/des.js/test/cbc-test.js +5 -5
  121. package/node_modules/des.js/test/des-test.js +9 -9
  122. package/node_modules/des.js/test/ede-test.js +39 -6
  123. package/node_modules/diffie-hellman/node_modules/bn.js/lib/bn.js +6 -5
  124. package/node_modules/diffie-hellman/node_modules/bn.js/package.json +1 -1
  125. package/node_modules/diffie-hellman/node_modules/bn.js/util/genCombMulTo.js +65 -0
  126. package/node_modules/diffie-hellman/node_modules/bn.js/util/genCombMulTo10.js +65 -0
  127. package/node_modules/dunder-proto/.github/FUNDING.yml +12 -0
  128. package/node_modules/dunder-proto/.nycrc +13 -0
  129. package/node_modules/dunder-proto/CHANGELOG.md +24 -0
  130. package/node_modules/{@meteorjs/crypto-browserify/node_modules/hash-base → dunder-proto}/LICENSE +6 -6
  131. package/node_modules/dunder-proto/README.md +54 -0
  132. package/node_modules/dunder-proto/get.d.ts +5 -0
  133. package/node_modules/dunder-proto/get.js +30 -0
  134. package/node_modules/dunder-proto/package.json +76 -0
  135. package/node_modules/dunder-proto/set.d.ts +5 -0
  136. package/node_modules/dunder-proto/set.js +35 -0
  137. package/node_modules/dunder-proto/test/get.js +34 -0
  138. package/node_modules/dunder-proto/test/index.js +4 -0
  139. package/node_modules/dunder-proto/test/set.js +50 -0
  140. package/node_modules/dunder-proto/tsconfig.json +9 -0
  141. package/node_modules/es-define-property/CHANGELOG.md +14 -0
  142. package/node_modules/es-define-property/index.js +1 -3
  143. package/node_modules/es-define-property/package.json +12 -12
  144. package/node_modules/es-define-property/test/index.js +1 -0
  145. package/node_modules/es-define-property/tsconfig.json +2 -42
  146. package/node_modules/es-object-atoms/.eslintrc +16 -0
  147. package/node_modules/es-object-atoms/.github/FUNDING.yml +12 -0
  148. package/node_modules/es-object-atoms/CHANGELOG.md +37 -0
  149. package/node_modules/{elliptic/node_modules/bn.js → es-object-atoms}/LICENSE +3 -1
  150. package/node_modules/es-object-atoms/README.md +63 -0
  151. package/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +3 -0
  152. package/node_modules/es-object-atoms/RequireObjectCoercible.js +11 -0
  153. package/node_modules/es-object-atoms/ToObject.d.ts +7 -0
  154. package/node_modules/es-object-atoms/ToObject.js +10 -0
  155. package/node_modules/es-object-atoms/index.d.ts +3 -0
  156. package/node_modules/es-object-atoms/index.js +4 -0
  157. package/node_modules/es-object-atoms/isObject.d.ts +3 -0
  158. package/node_modules/es-object-atoms/isObject.js +6 -0
  159. package/node_modules/es-object-atoms/package.json +80 -0
  160. package/node_modules/es-object-atoms/test/index.js +38 -0
  161. package/node_modules/es-object-atoms/tsconfig.json +6 -0
  162. package/node_modules/for-each/.eslintrc +16 -2
  163. package/node_modules/{has-proto → for-each}/.github/FUNDING.yml +1 -1
  164. package/node_modules/for-each/.github/SECURITY.md +3 -0
  165. package/node_modules/for-each/.nycrc +8 -0
  166. package/node_modules/for-each/CHANGELOG.md +107 -0
  167. package/node_modules/for-each/README.md +0 -4
  168. package/node_modules/for-each/index.d.ts +35 -0
  169. package/node_modules/for-each/index.js +11 -4
  170. package/node_modules/for-each/package.json +47 -36
  171. package/node_modules/for-each/test/test.js +54 -12
  172. package/node_modules/for-each/tsconfig.json +8 -0
  173. package/node_modules/get-intrinsic/.eslintrc +4 -0
  174. package/node_modules/get-intrinsic/CHANGELOG.md +43 -0
  175. package/node_modules/get-intrinsic/index.js +40 -21
  176. package/node_modules/get-intrinsic/package.json +24 -20
  177. package/node_modules/get-intrinsic/test/GetIntrinsic.js +2 -2
  178. package/node_modules/get-proto/.eslintrc +10 -0
  179. package/node_modules/get-proto/.github/FUNDING.yml +12 -0
  180. package/node_modules/get-proto/.nycrc +9 -0
  181. package/node_modules/get-proto/CHANGELOG.md +21 -0
  182. package/node_modules/get-proto/LICENSE +21 -0
  183. package/node_modules/get-proto/Object.getPrototypeOf.d.ts +5 -0
  184. package/node_modules/get-proto/Object.getPrototypeOf.js +6 -0
  185. package/node_modules/get-proto/README.md +50 -0
  186. package/node_modules/get-proto/Reflect.getPrototypeOf.d.ts +3 -0
  187. package/node_modules/get-proto/Reflect.getPrototypeOf.js +4 -0
  188. package/node_modules/get-proto/index.d.ts +5 -0
  189. package/node_modules/get-proto/index.js +27 -0
  190. package/node_modules/{has-proto → get-proto}/package.json +33 -26
  191. package/node_modules/get-proto/test/index.js +68 -0
  192. package/node_modules/get-proto/tsconfig.json +9 -0
  193. package/node_modules/gopd/CHANGELOG.md +20 -0
  194. package/node_modules/gopd/gOPD.d.ts +1 -0
  195. package/node_modules/gopd/gOPD.js +4 -0
  196. package/node_modules/gopd/index.d.ts +5 -0
  197. package/node_modules/gopd/index.js +2 -3
  198. package/node_modules/gopd/package.json +16 -10
  199. package/node_modules/gopd/test/index.js +2 -1
  200. package/node_modules/gopd/tsconfig.json +9 -0
  201. package/node_modules/has-symbols/CHANGELOG.md +16 -0
  202. package/node_modules/has-symbols/index.d.ts +3 -0
  203. package/node_modules/has-symbols/index.js +1 -0
  204. package/node_modules/has-symbols/package.json +19 -9
  205. package/node_modules/has-symbols/shams.d.ts +3 -0
  206. package/node_modules/has-symbols/shams.js +5 -2
  207. package/node_modules/has-symbols/test/shams/core-js.js +1 -0
  208. package/node_modules/has-symbols/test/shams/get-own-property-symbols.js +1 -0
  209. package/node_modules/has-symbols/test/tests.js +4 -2
  210. package/node_modules/has-symbols/tsconfig.json +10 -0
  211. package/node_modules/has-tostringtag/.eslintrc +0 -6
  212. package/node_modules/has-tostringtag/.nycrc +13 -0
  213. package/node_modules/has-tostringtag/CHANGELOG.md +22 -0
  214. package/node_modules/has-tostringtag/index.d.ts +3 -0
  215. package/node_modules/has-tostringtag/index.js +1 -0
  216. package/node_modules/has-tostringtag/package.json +37 -13
  217. package/node_modules/has-tostringtag/shams.d.ts +3 -0
  218. package/node_modules/has-tostringtag/shams.js +1 -0
  219. package/node_modules/has-tostringtag/test/shams/core-js.js +3 -0
  220. package/node_modules/has-tostringtag/test/shams/get-own-property-symbols.js +2 -0
  221. package/node_modules/has-tostringtag/test/tests.js +2 -1
  222. package/node_modules/has-tostringtag/tsconfig.json +49 -0
  223. package/node_modules/hash-base/README.md +15 -15
  224. package/node_modules/hash-base/index.js +52 -9
  225. package/node_modules/hash-base/package.json +40 -40
  226. package/node_modules/hasown/CHANGELOG.md +20 -0
  227. package/node_modules/hasown/index.d.ts +3 -3
  228. package/node_modules/hasown/index.js +1 -1
  229. package/node_modules/hasown/package.json +16 -15
  230. package/node_modules/hasown/tsconfig.json +3 -46
  231. package/node_modules/is-arguments/.eslintrc +0 -1
  232. package/node_modules/is-arguments/CHANGELOG.md +22 -0
  233. package/node_modules/is-arguments/README.md +11 -11
  234. package/node_modules/is-arguments/index.d.ts +6 -0
  235. package/node_modules/is-arguments/index.js +19 -8
  236. package/node_modules/is-arguments/package.json +25 -11
  237. package/node_modules/is-arguments/test/index.js +4 -1
  238. package/node_modules/is-arguments/tsconfig.json +9 -0
  239. package/node_modules/is-generator-function/.eslintrc +1 -1
  240. package/node_modules/is-generator-function/CHANGELOG.md +21 -0
  241. package/node_modules/is-generator-function/index.d.ts +3 -0
  242. package/node_modules/is-generator-function/index.js +16 -7
  243. package/node_modules/is-generator-function/package.json +30 -11
  244. package/node_modules/is-generator-function/test/corejs.js +1 -0
  245. package/node_modules/is-generator-function/test/index.js +4 -7
  246. package/node_modules/is-generator-function/test/uglified.js +1 -0
  247. package/node_modules/is-generator-function/tsconfig.json +9 -0
  248. package/node_modules/is-regex/.editorconfig +23 -0
  249. package/node_modules/is-regex/.eslintrc +10 -0
  250. package/node_modules/is-regex/.nycrc +10 -0
  251. package/node_modules/is-regex/CHANGELOG.md +233 -0
  252. package/node_modules/is-regex/LICENSE +20 -0
  253. package/node_modules/is-regex/README.md +52 -0
  254. package/node_modules/is-regex/index.d.ts +3 -0
  255. package/node_modules/is-regex/index.js +69 -0
  256. package/node_modules/is-regex/package.json +104 -0
  257. package/node_modules/is-regex/test/index.js +121 -0
  258. package/node_modules/is-regex/tsconfig.json +9 -0
  259. package/node_modules/is-typed-array/CHANGELOG.md +32 -0
  260. package/node_modules/is-typed-array/index.d.ts +9 -0
  261. package/node_modules/is-typed-array/index.js +1 -0
  262. package/node_modules/is-typed-array/package.json +23 -10
  263. package/node_modules/is-typed-array/test/index.js +9 -1
  264. package/node_modules/is-typed-array/tsconfig.json +6 -0
  265. package/node_modules/math-intrinsics/.eslintrc +16 -0
  266. package/node_modules/math-intrinsics/.github/FUNDING.yml +12 -0
  267. package/node_modules/math-intrinsics/CHANGELOG.md +24 -0
  268. package/node_modules/math-intrinsics/LICENSE +21 -0
  269. package/node_modules/math-intrinsics/README.md +50 -0
  270. package/node_modules/math-intrinsics/abs.d.ts +1 -0
  271. package/node_modules/math-intrinsics/abs.js +4 -0
  272. package/node_modules/math-intrinsics/constants/maxArrayLength.d.ts +3 -0
  273. package/node_modules/math-intrinsics/constants/maxArrayLength.js +4 -0
  274. package/node_modules/math-intrinsics/constants/maxSafeInteger.d.ts +3 -0
  275. package/node_modules/math-intrinsics/constants/maxSafeInteger.js +5 -0
  276. package/node_modules/math-intrinsics/constants/maxValue.d.ts +3 -0
  277. package/node_modules/math-intrinsics/constants/maxValue.js +5 -0
  278. package/node_modules/math-intrinsics/floor.d.ts +1 -0
  279. package/node_modules/math-intrinsics/floor.js +4 -0
  280. package/node_modules/math-intrinsics/isFinite.d.ts +3 -0
  281. package/node_modules/math-intrinsics/isFinite.js +12 -0
  282. package/node_modules/math-intrinsics/isInteger.d.ts +3 -0
  283. package/node_modules/math-intrinsics/isInteger.js +16 -0
  284. package/node_modules/math-intrinsics/isNaN.d.ts +1 -0
  285. package/node_modules/math-intrinsics/isNaN.js +6 -0
  286. package/node_modules/math-intrinsics/isNegativeZero.d.ts +3 -0
  287. package/node_modules/math-intrinsics/isNegativeZero.js +6 -0
  288. package/node_modules/math-intrinsics/max.d.ts +1 -0
  289. package/node_modules/math-intrinsics/max.js +4 -0
  290. package/node_modules/math-intrinsics/min.d.ts +1 -0
  291. package/node_modules/math-intrinsics/min.js +4 -0
  292. package/node_modules/math-intrinsics/mod.d.ts +3 -0
  293. package/node_modules/math-intrinsics/mod.js +9 -0
  294. package/node_modules/math-intrinsics/package.json +86 -0
  295. package/node_modules/math-intrinsics/pow.d.ts +1 -0
  296. package/node_modules/math-intrinsics/pow.js +4 -0
  297. package/node_modules/math-intrinsics/round.d.ts +1 -0
  298. package/node_modules/math-intrinsics/round.js +4 -0
  299. package/node_modules/math-intrinsics/sign.d.ts +3 -0
  300. package/node_modules/math-intrinsics/sign.js +11 -0
  301. package/node_modules/math-intrinsics/test/index.js +192 -0
  302. package/node_modules/math-intrinsics/tsconfig.json +3 -0
  303. package/node_modules/miller-rabin/node_modules/bn.js/lib/bn.js +6 -5
  304. package/node_modules/miller-rabin/node_modules/bn.js/package.json +1 -1
  305. package/node_modules/miller-rabin/node_modules/bn.js/util/genCombMulTo.js +65 -0
  306. package/node_modules/miller-rabin/node_modules/bn.js/util/genCombMulTo10.js +65 -0
  307. package/node_modules/object-inspect/CHANGELOG.md +20 -0
  308. package/node_modules/object-inspect/index.js +27 -10
  309. package/node_modules/object-inspect/package.json +9 -8
  310. package/node_modules/object-inspect/test/quoteStyle.js +9 -0
  311. package/node_modules/object-inspect/test/values.js +50 -0
  312. package/node_modules/object-is/.eslintrc +1 -1
  313. package/node_modules/object-is/.nycrc +0 -4
  314. package/node_modules/object-is/CHANGELOG.md +25 -0
  315. package/node_modules/object-is/README.md +20 -20
  316. package/node_modules/object-is/package.json +23 -14
  317. package/node_modules/object.assign/CHANGELOG.md +21 -0
  318. package/node_modules/object.assign/dist/browser.js +495 -135
  319. package/node_modules/object.assign/implementation.js +6 -6
  320. package/node_modules/object.assign/package.json +14 -14
  321. package/node_modules/object.assign/test/tests.js +2 -2
  322. package/node_modules/possible-typed-array-names/.eslintrc +5 -0
  323. package/node_modules/possible-typed-array-names/.github/FUNDING.yml +12 -0
  324. package/node_modules/possible-typed-array-names/CHANGELOG.md +29 -0
  325. package/node_modules/possible-typed-array-names/LICENSE +21 -0
  326. package/node_modules/possible-typed-array-names/README.md +50 -0
  327. package/node_modules/possible-typed-array-names/index.d.ts +16 -0
  328. package/node_modules/possible-typed-array-names/index.js +17 -0
  329. package/node_modules/possible-typed-array-names/package.json +84 -0
  330. package/node_modules/possible-typed-array-names/test/index.js +19 -0
  331. package/node_modules/possible-typed-array-names/tsconfig.json +9 -0
  332. package/node_modules/public-encrypt/node_modules/bn.js/lib/bn.js +6 -5
  333. package/node_modules/public-encrypt/node_modules/bn.js/package.json +1 -1
  334. package/node_modules/public-encrypt/node_modules/bn.js/util/genCombMulTo.js +65 -0
  335. package/node_modules/public-encrypt/node_modules/bn.js/util/genCombMulTo10.js +65 -0
  336. package/node_modules/qs/.eslintrc +1 -0
  337. package/node_modules/qs/CHANGELOG.md +22 -0
  338. package/node_modules/qs/README.md +25 -1
  339. package/node_modules/qs/dist/qs.js +95 -44
  340. package/node_modules/qs/lib/parse.js +44 -12
  341. package/node_modules/qs/lib/stringify.js +11 -6
  342. package/node_modules/qs/lib/utils.js +7 -4
  343. package/node_modules/qs/package.json +9 -7
  344. package/node_modules/qs/test/parse.js +133 -27
  345. package/node_modules/qs/test/stringify.js +19 -11
  346. package/node_modules/qs/test/utils.js +126 -0
  347. package/node_modules/safe-regex-test/.eslintrc +9 -0
  348. package/node_modules/safe-regex-test/.github/FUNDING.yml +12 -0
  349. package/node_modules/safe-regex-test/.nycrc +13 -0
  350. package/node_modules/safe-regex-test/CHANGELOG.md +55 -0
  351. package/node_modules/safe-regex-test/LICENSE +21 -0
  352. package/node_modules/safe-regex-test/README.md +46 -0
  353. package/node_modules/safe-regex-test/index.d.ts +3 -0
  354. package/node_modules/safe-regex-test/index.js +17 -0
  355. package/node_modules/safe-regex-test/package.json +87 -0
  356. package/node_modules/safe-regex-test/test/index.js +41 -0
  357. package/node_modules/safe-regex-test/tsconfig.json +9 -0
  358. package/node_modules/side-channel/.eslintrc +1 -0
  359. package/node_modules/side-channel/CHANGELOG.md +15 -0
  360. package/node_modules/side-channel/README.md +60 -1
  361. package/node_modules/side-channel/index.d.ts +9 -22
  362. package/node_modules/side-channel/index.js +20 -106
  363. package/node_modules/side-channel/package.json +20 -19
  364. package/node_modules/side-channel/test/index.js +76 -55
  365. package/node_modules/side-channel/tsconfig.json +2 -43
  366. package/node_modules/side-channel-list/.editorconfig +9 -0
  367. package/node_modules/side-channel-list/.eslintrc +11 -0
  368. package/node_modules/side-channel-list/.github/FUNDING.yml +12 -0
  369. package/node_modules/side-channel-list/.nycrc +13 -0
  370. package/node_modules/side-channel-list/CHANGELOG.md +15 -0
  371. package/node_modules/side-channel-list/LICENSE +21 -0
  372. package/node_modules/side-channel-list/README.md +62 -0
  373. package/node_modules/side-channel-list/index.d.ts +13 -0
  374. package/node_modules/side-channel-list/index.js +113 -0
  375. package/node_modules/side-channel-list/list.d.ts +14 -0
  376. package/node_modules/side-channel-list/package.json +77 -0
  377. package/node_modules/side-channel-list/test/index.js +104 -0
  378. package/node_modules/side-channel-list/tsconfig.json +9 -0
  379. package/node_modules/side-channel-map/.editorconfig +9 -0
  380. package/node_modules/side-channel-map/.eslintrc +11 -0
  381. package/node_modules/side-channel-map/.github/FUNDING.yml +12 -0
  382. package/node_modules/side-channel-map/.nycrc +13 -0
  383. package/node_modules/side-channel-map/CHANGELOG.md +22 -0
  384. package/node_modules/side-channel-map/LICENSE +21 -0
  385. package/node_modules/side-channel-map/README.md +62 -0
  386. package/node_modules/side-channel-map/index.d.ts +15 -0
  387. package/node_modules/side-channel-map/index.js +68 -0
  388. package/node_modules/side-channel-map/package.json +80 -0
  389. package/node_modules/side-channel-map/test/index.js +114 -0
  390. package/node_modules/side-channel-map/tsconfig.json +9 -0
  391. package/node_modules/side-channel-weakmap/.editorconfig +9 -0
  392. package/node_modules/side-channel-weakmap/.eslintrc +12 -0
  393. package/node_modules/side-channel-weakmap/.github/FUNDING.yml +12 -0
  394. package/node_modules/side-channel-weakmap/.nycrc +13 -0
  395. package/node_modules/side-channel-weakmap/CHANGELOG.md +28 -0
  396. package/node_modules/side-channel-weakmap/LICENSE +21 -0
  397. package/node_modules/side-channel-weakmap/README.md +62 -0
  398. package/node_modules/side-channel-weakmap/index.d.ts +15 -0
  399. package/node_modules/side-channel-weakmap/index.js +84 -0
  400. package/node_modules/side-channel-weakmap/package.json +87 -0
  401. package/node_modules/side-channel-weakmap/test/index.js +114 -0
  402. package/node_modules/side-channel-weakmap/tsconfig.json +9 -0
  403. package/node_modules/which-typed-array/.eslintrc +1 -0
  404. package/node_modules/which-typed-array/CHANGELOG.md +57 -0
  405. package/node_modules/which-typed-array/index.d.ts +62 -0
  406. package/node_modules/which-typed-array/index.js +50 -25
  407. package/node_modules/which-typed-array/package.json +28 -13
  408. package/node_modules/which-typed-array/test/index.js +7 -1
  409. package/node_modules/which-typed-array/tsconfig.json +9 -0
  410. package/package.json +2 -3
  411. package/node_modules/@meteorjs/browserify-sign/node_modules/bn.js/README.md +0 -214
  412. package/node_modules/@meteorjs/browserify-sign/node_modules/bn.js/lib/bn.js +0 -3547
  413. package/node_modules/@meteorjs/browserify-sign/node_modules/bn.js/package.json +0 -39
  414. package/node_modules/@meteorjs/browserify-sign/node_modules/hash-base/LICENSE +0 -21
  415. package/node_modules/@meteorjs/browserify-sign/node_modules/hash-base/README.md +0 -48
  416. package/node_modules/@meteorjs/browserify-sign/node_modules/hash-base/index.js +0 -138
  417. package/node_modules/@meteorjs/browserify-sign/node_modules/hash-base/package.json +0 -42
  418. package/node_modules/@meteorjs/crypto-browserify/node_modules/hash-base/README.md +0 -48
  419. package/node_modules/@meteorjs/crypto-browserify/node_modules/hash-base/index.js +0 -95
  420. package/node_modules/@meteorjs/crypto-browserify/node_modules/hash-base/package.json +0 -41
  421. package/node_modules/available-typed-arrays/.eslintignore +0 -1
  422. package/node_modules/bn.js/CHANGELOG.md +0 -51
  423. package/node_modules/cipher-base/.npmignore +0 -1
  424. package/node_modules/cipher-base/.travis.yml +0 -6
  425. package/node_modules/cipher-base/test.js +0 -111
  426. package/node_modules/elliptic/node_modules/bn.js/README.md +0 -200
  427. package/node_modules/elliptic/node_modules/bn.js/lib/bn.js +0 -3446
  428. package/node_modules/elliptic/node_modules/bn.js/package.json +0 -36
  429. package/node_modules/elliptic/package.json +0 -56
  430. package/node_modules/for-each/.travis.yml +0 -45
  431. package/node_modules/for-each/test/.eslintrc +0 -8
  432. package/node_modules/has-proto/CHANGELOG.md +0 -23
  433. package/node_modules/has-proto/README.md +0 -38
  434. package/node_modules/has-proto/index.js +0 -11
  435. package/node_modules/has-proto/test/index.js +0 -19
  436. package/node_modules/hasown/index.d.ts.map +0 -1
  437. package/node_modules/is-arguments/.eslintignore +0 -1
  438. package/node_modules/is-generator-function/.eslintignore +0 -1
  439. package/node_modules/object-is/.eslintignore +0 -1
  440. package/node_modules/object.assign/test.html +0 -18458
  441. package/node_modules/parse-asn1/node_modules/hash-base/LICENSE +0 -21
  442. package/node_modules/parse-asn1/node_modules/hash-base/README.md +0 -48
  443. package/node_modules/parse-asn1/node_modules/hash-base/index.js +0 -95
  444. package/node_modules/parse-asn1/node_modules/hash-base/package.json +0 -41
  445. /package/node_modules/{elliptic → @meteorjs/browserify-sign/elliptic}/README.md +0 -0
  446. /package/node_modules/{elliptic → @meteorjs/browserify-sign/elliptic}/lib/elliptic/curve/base.js +0 -0
  447. /package/node_modules/{elliptic → @meteorjs/browserify-sign/elliptic}/lib/elliptic/curve/edwards.js +0 -0
  448. /package/node_modules/{elliptic → @meteorjs/browserify-sign/elliptic}/lib/elliptic/curve/index.js +0 -0
  449. /package/node_modules/{elliptic → @meteorjs/browserify-sign/elliptic}/lib/elliptic/curve/mont.js +0 -0
  450. /package/node_modules/{elliptic → @meteorjs/browserify-sign/elliptic}/lib/elliptic/curve/short.js +0 -0
  451. /package/node_modules/{elliptic → @meteorjs/browserify-sign/elliptic}/lib/elliptic/curves.js +0 -0
  452. /package/node_modules/{elliptic → @meteorjs/browserify-sign/elliptic}/lib/elliptic/ec/index.js +0 -0
  453. /package/node_modules/{elliptic → @meteorjs/browserify-sign/elliptic}/lib/elliptic/ec/key.js +0 -0
  454. /package/node_modules/{elliptic → @meteorjs/browserify-sign/elliptic}/lib/elliptic/ec/signature.js +0 -0
  455. /package/node_modules/{elliptic → @meteorjs/browserify-sign/elliptic}/lib/elliptic/eddsa/index.js +0 -0
  456. /package/node_modules/{elliptic → @meteorjs/browserify-sign/elliptic}/lib/elliptic/eddsa/key.js +0 -0
  457. /package/node_modules/{elliptic → @meteorjs/browserify-sign/elliptic}/lib/elliptic/eddsa/signature.js +0 -0
  458. /package/node_modules/{elliptic → @meteorjs/browserify-sign/elliptic}/lib/elliptic/precomputed/secp256k1.js +0 -0
  459. /package/node_modules/{elliptic → @meteorjs/browserify-sign/elliptic}/lib/elliptic/utils.js +0 -0
  460. /package/node_modules/{has-proto → dunder-proto}/.eslintrc +0 -0
@@ -0,0 +1,62 @@
1
+ # side-channel-weakmap <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
2
+
3
+ [![github actions][actions-image]][actions-url]
4
+ [![coverage][codecov-image]][codecov-url]
5
+ [![License][license-image]][license-url]
6
+ [![Downloads][downloads-image]][downloads-url]
7
+
8
+ [![npm badge][npm-badge-png]][package-url]
9
+
10
+ Store information about any JS value in a side channel. Uses WeakMap if available.
11
+
12
+ Warning: this implementation will leak memory until you `delete` the `key`.
13
+ Use [`side-channel`](https://npmjs.com/side-channel) for the best available strategy.
14
+
15
+ ## Getting started
16
+
17
+ ```sh
18
+ npm install --save side-channel-weakmap
19
+ ```
20
+
21
+ ## Usage/Examples
22
+
23
+ ```js
24
+ const assert = require('assert');
25
+ const getSideChannelList = require('side-channel-weakmap');
26
+
27
+ const channel = getSideChannelList();
28
+
29
+ const key = {};
30
+ assert.equal(channel.has(key), false);
31
+ assert.throws(() => channel.assert(key), TypeError);
32
+
33
+ channel.set(key, 42);
34
+
35
+ channel.assert(key); // does not throw
36
+ assert.equal(channel.has(key), true);
37
+ assert.equal(channel.get(key), 42);
38
+
39
+ channel.delete(key);
40
+ assert.equal(channel.has(key), false);
41
+ assert.throws(() => channel.assert(key), TypeError);
42
+ ```
43
+
44
+ ## Tests
45
+
46
+ Clone the repo, `npm install`, and run `npm test`
47
+
48
+ [package-url]: https://npmjs.org/package/side-channel-weakmap
49
+ [npm-version-svg]: https://versionbadg.es/ljharb/side-channel-weakmap.svg
50
+ [deps-svg]: https://david-dm.org/ljharb/side-channel-weakmap.svg
51
+ [deps-url]: https://david-dm.org/ljharb/side-channel-weakmap
52
+ [dev-deps-svg]: https://david-dm.org/ljharb/side-channel-weakmap/dev-status.svg
53
+ [dev-deps-url]: https://david-dm.org/ljharb/side-channel-weakmap#info=devDependencies
54
+ [npm-badge-png]: https://nodei.co/npm/side-channel-weakmap.png?downloads=true&stars=true
55
+ [license-image]: https://img.shields.io/npm/l/side-channel-weakmap.svg
56
+ [license-url]: LICENSE
57
+ [downloads-image]: https://img.shields.io/npm/dm/side-channel-weakmap.svg
58
+ [downloads-url]: https://npm-stat.com/charts.html?package=side-channel-weakmap
59
+ [codecov-image]: https://codecov.io/gh/ljharb/side-channel-weakmap/branch/main/graphs/badge.svg
60
+ [codecov-url]: https://app.codecov.io/gh/ljharb/side-channel-weakmap/
61
+ [actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/side-channel-weakmap
62
+ [actions-url]: https://github.com/ljharb/side-channel-weakmap/actions
@@ -0,0 +1,15 @@
1
+ declare namespace getSideChannelWeakMap {
2
+ type Channel<K, V> = {
3
+ assert: (key: K) => void;
4
+ has: (key: K) => boolean;
5
+ get: (key: K) => V | undefined;
6
+ set: (key: K, value: V) => void;
7
+ delete: (key: K) => boolean;
8
+ }
9
+ }
10
+
11
+ declare function getSideChannelWeakMap<K, V>(): getSideChannelWeakMap.Channel<K, V>;
12
+
13
+ declare const x: false | typeof getSideChannelWeakMap;
14
+
15
+ export = x;
@@ -0,0 +1,84 @@
1
+ 'use strict';
2
+
3
+ var GetIntrinsic = require('get-intrinsic');
4
+ var callBound = require('call-bound');
5
+ var inspect = require('object-inspect');
6
+ var getSideChannelMap = require('side-channel-map');
7
+
8
+ var $TypeError = require('es-errors/type');
9
+ var $WeakMap = GetIntrinsic('%WeakMap%', true);
10
+
11
+ /** @type {<K extends object, V>(thisArg: WeakMap<K, V>, key: K) => V} */
12
+ var $weakMapGet = callBound('WeakMap.prototype.get', true);
13
+ /** @type {<K extends object, V>(thisArg: WeakMap<K, V>, key: K, value: V) => void} */
14
+ var $weakMapSet = callBound('WeakMap.prototype.set', true);
15
+ /** @type {<K extends object, V>(thisArg: WeakMap<K, V>, key: K) => boolean} */
16
+ var $weakMapHas = callBound('WeakMap.prototype.has', true);
17
+ /** @type {<K extends object, V>(thisArg: WeakMap<K, V>, key: K) => boolean} */
18
+ var $weakMapDelete = callBound('WeakMap.prototype.delete', true);
19
+
20
+ /** @type {import('.')} */
21
+ module.exports = $WeakMap
22
+ ? /** @type {Exclude<import('.'), false>} */ function getSideChannelWeakMap() {
23
+ /** @typedef {ReturnType<typeof getSideChannelWeakMap>} Channel */
24
+ /** @typedef {Parameters<Channel['get']>[0]} K */
25
+ /** @typedef {Parameters<Channel['set']>[1]} V */
26
+
27
+ /** @type {WeakMap<K & object, V> | undefined} */ var $wm;
28
+ /** @type {Channel | undefined} */ var $m;
29
+
30
+ /** @type {Channel} */
31
+ var channel = {
32
+ assert: function (key) {
33
+ if (!channel.has(key)) {
34
+ throw new $TypeError('Side channel does not contain ' + inspect(key));
35
+ }
36
+ },
37
+ 'delete': function (key) {
38
+ if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
39
+ if ($wm) {
40
+ return $weakMapDelete($wm, key);
41
+ }
42
+ } else if (getSideChannelMap) {
43
+ if ($m) {
44
+ return $m['delete'](key);
45
+ }
46
+ }
47
+ return false;
48
+ },
49
+ get: function (key) {
50
+ if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
51
+ if ($wm) {
52
+ return $weakMapGet($wm, key);
53
+ }
54
+ }
55
+ return $m && $m.get(key);
56
+ },
57
+ has: function (key) {
58
+ if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
59
+ if ($wm) {
60
+ return $weakMapHas($wm, key);
61
+ }
62
+ }
63
+ return !!$m && $m.has(key);
64
+ },
65
+ set: function (key, value) {
66
+ if ($WeakMap && key && (typeof key === 'object' || typeof key === 'function')) {
67
+ if (!$wm) {
68
+ $wm = new $WeakMap();
69
+ }
70
+ $weakMapSet($wm, key, value);
71
+ } else if (getSideChannelMap) {
72
+ if (!$m) {
73
+ $m = getSideChannelMap();
74
+ }
75
+ // eslint-disable-next-line no-extra-parens
76
+ /** @type {NonNullable<typeof $m>} */ ($m).set(key, value);
77
+ }
78
+ }
79
+ };
80
+
81
+ // @ts-expect-error TODO: figure out why this is erroring
82
+ return channel;
83
+ }
84
+ : getSideChannelMap;
@@ -0,0 +1,87 @@
1
+ {
2
+ "name": "side-channel-weakmap",
3
+ "version": "1.0.2",
4
+ "description": "Store information about any JS value in a side channel. Uses WeakMap if available.",
5
+ "main": "index.js",
6
+ "exports": {
7
+ ".": "./index.js",
8
+ "./package.json": "./package.json"
9
+ },
10
+ "types": "./index.d.ts",
11
+ "scripts": {
12
+ "prepack": "npmignore --auto --commentLines=autogenerated",
13
+ "prepublishOnly": "safe-publish-latest",
14
+ "prepublish": "not-in-publish || npm run prepublishOnly",
15
+ "prelint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')",
16
+ "lint": "eslint --ext=js,mjs .",
17
+ "postlint": "tsc -p . && attw -P",
18
+ "pretest": "npm run lint",
19
+ "tests-only": "nyc tape 'test/**/*.js'",
20
+ "test": "npm run tests-only",
21
+ "posttest": "npx npm@'>=10.2' audit --production",
22
+ "version": "auto-changelog && git add CHANGELOG.md",
23
+ "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
24
+ },
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/ljharb/side-channel-weakmap.git"
28
+ },
29
+ "keywords": [
30
+ "weakmap",
31
+ "map",
32
+ "side",
33
+ "channel",
34
+ "metadata"
35
+ ],
36
+ "author": "Jordan Harband <ljharb@gmail.com>",
37
+ "funding": {
38
+ "url": "https://github.com/sponsors/ljharb"
39
+ },
40
+ "license": "MIT",
41
+ "bugs": {
42
+ "url": "https://github.com/ljharb/side-channel-weakmap/issues"
43
+ },
44
+ "homepage": "https://github.com/ljharb/side-channel-weakmap#readme",
45
+ "dependencies": {
46
+ "call-bound": "^1.0.2",
47
+ "es-errors": "^1.3.0",
48
+ "get-intrinsic": "^1.2.5",
49
+ "object-inspect": "^1.13.3",
50
+ "side-channel-map": "^1.0.1"
51
+ },
52
+ "devDependencies": {
53
+ "@arethetypeswrong/cli": "^0.17.1",
54
+ "@ljharb/eslint-config": "^21.1.1",
55
+ "@ljharb/tsconfig": "^0.2.2",
56
+ "@types/call-bind": "^1.0.5",
57
+ "@types/get-intrinsic": "^1.2.3",
58
+ "@types/object-inspect": "^1.13.0",
59
+ "@types/tape": "^5.6.5",
60
+ "auto-changelog": "^2.5.0",
61
+ "eclint": "^2.8.1",
62
+ "encoding": "^0.1.13",
63
+ "eslint": "=8.8.0",
64
+ "in-publish": "^2.0.1",
65
+ "npmignore": "^0.3.1",
66
+ "nyc": "^10.3.2",
67
+ "safe-publish-latest": "^2.0.0",
68
+ "tape": "^5.9.0",
69
+ "typescript": "next"
70
+ },
71
+ "auto-changelog": {
72
+ "output": "CHANGELOG.md",
73
+ "template": "keepachangelog",
74
+ "unreleased": false,
75
+ "commitLimit": false,
76
+ "backfillLimit": false,
77
+ "hideCredit": true
78
+ },
79
+ "publishConfig": {
80
+ "ignore": [
81
+ ".github/workflows"
82
+ ]
83
+ },
84
+ "engines": {
85
+ "node": ">= 0.4"
86
+ }
87
+ }
@@ -0,0 +1,114 @@
1
+ 'use strict';
2
+
3
+ var test = require('tape');
4
+
5
+ var getSideChannelWeakMap = require('../');
6
+
7
+ test('getSideChannelMap', { skip: typeof WeakMap !== 'function' && typeof Map !== 'function' }, function (t) {
8
+ var getSideChannel = getSideChannelWeakMap || function () {
9
+ throw new EvalError('should never happen');
10
+ };
11
+
12
+ t.test('export', function (st) {
13
+ st.equal(typeof getSideChannel, 'function', 'is a function');
14
+
15
+ st.equal(getSideChannel.length, 0, 'takes no arguments');
16
+
17
+ var channel = getSideChannel();
18
+ st.ok(channel, 'is truthy');
19
+ st.equal(typeof channel, 'object', 'is an object');
20
+ st.end();
21
+ });
22
+
23
+ t.test('assert', function (st) {
24
+ var channel = getSideChannel();
25
+ st['throws'](
26
+ function () { channel.assert({}); },
27
+ TypeError,
28
+ 'nonexistent value throws'
29
+ );
30
+
31
+ var o = {};
32
+ channel.set(o, 'data');
33
+ st.doesNotThrow(function () { channel.assert(o); }, 'existent value noops');
34
+
35
+ st.end();
36
+ });
37
+
38
+ t.test('has', function (st) {
39
+ var channel = getSideChannel();
40
+ /** @type {unknown[]} */ var o = [];
41
+
42
+ st.equal(channel.has(o), false, 'nonexistent value yields false');
43
+
44
+ channel.set(o, 'foo');
45
+ st.equal(channel.has(o), true, 'existent value yields true');
46
+
47
+ st.equal(channel.has('abc'), false, 'non object value non existent yields false');
48
+
49
+ channel.set('abc', 'foo');
50
+ st.equal(channel.has('abc'), true, 'non object value that exists yields true');
51
+
52
+ st.end();
53
+ });
54
+
55
+ t.test('get', function (st) {
56
+ var channel = getSideChannel();
57
+ var o = {};
58
+ st.equal(channel.get(o), undefined, 'nonexistent value yields undefined');
59
+
60
+ var data = {};
61
+ channel.set(o, data);
62
+ st.equal(channel.get(o), data, '"get" yields data set by "set"');
63
+
64
+ st.end();
65
+ });
66
+
67
+ t.test('set', function (st) {
68
+ var channel = getSideChannel();
69
+ var o = function () {};
70
+ st.equal(channel.get(o), undefined, 'value not set');
71
+
72
+ channel.set(o, 42);
73
+ st.equal(channel.get(o), 42, 'value was set');
74
+
75
+ channel.set(o, Infinity);
76
+ st.equal(channel.get(o), Infinity, 'value was set again');
77
+
78
+ var o2 = {};
79
+ channel.set(o2, 17);
80
+ st.equal(channel.get(o), Infinity, 'o is not modified');
81
+ st.equal(channel.get(o2), 17, 'o2 is set');
82
+
83
+ channel.set(o, 14);
84
+ st.equal(channel.get(o), 14, 'o is modified');
85
+ st.equal(channel.get(o2), 17, 'o2 is not modified');
86
+
87
+ st.end();
88
+ });
89
+
90
+ t.test('delete', function (st) {
91
+ var channel = getSideChannel();
92
+ var o = {};
93
+ st.equal(channel['delete']({}), false, 'nonexistent value yields false');
94
+
95
+ channel.set(o, 42);
96
+ st.equal(channel.has(o), true, 'value is set');
97
+
98
+ st.equal(channel['delete']({}), false, 'nonexistent value still yields false');
99
+
100
+ st.equal(channel['delete'](o), true, 'deleted value yields true');
101
+
102
+ st.equal(channel.has(o), false, 'value is no longer set');
103
+
104
+ st.end();
105
+ });
106
+
107
+ t.end();
108
+ });
109
+
110
+ test('getSideChannelMap, no WeakMaps and/or Maps', { skip: typeof WeakMap === 'function' || typeof Map === 'function' }, function (t) {
111
+ t.equal(getSideChannelWeakMap, false, 'is false');
112
+
113
+ t.end();
114
+ });
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "@ljharb/tsconfig",
3
+ "compilerOptions": {
4
+ "target": "es2021",
5
+ },
6
+ "exclude": [
7
+ "coverage",
8
+ ],
9
+ }
@@ -5,5 +5,6 @@
5
5
 
6
6
  "rules": {
7
7
  "max-statements-per-line": [2, { "max": 2 }],
8
+ "no-extra-parens": 0,
8
9
  },
9
10
  }
@@ -5,6 +5,63 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [v1.1.19](https://github.com/inspect-js/which-typed-array/compare/v1.1.18...v1.1.19) - 2025-03-08
9
+
10
+ ### Commits
11
+
12
+ - [Refactor] use `get-proto`, improve types [`e05d535`](https://github.com/inspect-js/which-typed-array/commit/e05d535fe4e4c4e674937718fe1cae90abff3606)
13
+ - [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/tsconfig`, `@types/tape` [`0dade9c`](https://github.com/inspect-js/which-typed-array/commit/0dade9c4c334f37ed14083a35724eea56a496991)
14
+ - [Deps] update `call-bound`, `for-each` [`490791a`](https://github.com/inspect-js/which-typed-array/commit/490791af49605390f9805660492976f86c64feb1)
15
+ - [Tests] skip `npm ls` in older nodes [`f83aaca`](https://github.com/inspect-js/which-typed-array/commit/f83aaca6b6634ce795f8caf9a1e14ab15d35161c)
16
+ - [Dev Deps] update `@ljharb/tsconfig` [`63c4795`](https://github.com/inspect-js/which-typed-array/commit/63c479564e5f3cb022c784ffe505673597341aab)
17
+
18
+ ## [v1.1.18](https://github.com/inspect-js/which-typed-array/compare/v1.1.17...v1.1.18) - 2024-12-18
19
+
20
+ ### Commits
21
+
22
+ - [types] improve types [`4b57173`](https://github.com/inspect-js/which-typed-array/commit/4b5717349976578c6b48966d581687df5dcc2e9b)
23
+ - [Dev Deps] update `@types/tape` [`81853b0`](https://github.com/inspect-js/which-typed-array/commit/81853b075c018538859a5533578be654fafecdae)
24
+
25
+ ## [v1.1.17](https://github.com/inspect-js/which-typed-array/compare/v1.1.16...v1.1.17) - 2024-12-18
26
+
27
+ ### Commits
28
+
29
+ - [types] improve types [`86bc612`](https://github.com/inspect-js/which-typed-array/commit/86bc61207e5970c2c7e13cdda4ccdeb0981ac40b)
30
+ - [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/tsconfig`, `@types/tape` [`2e9bed6`](https://github.com/inspect-js/which-typed-array/commit/2e9bed67f1d623b176b1a7f06c5eab006c21cf96)
31
+ - [Deps] update `call-bind`, `gopd` [`34579df`](https://github.com/inspect-js/which-typed-array/commit/34579df639e35ceb3a7e54f8e680a4077a950b8b)
32
+ - [Refactor] use `call-bound` directly [`2a2d84e`](https://github.com/inspect-js/which-typed-array/commit/2a2d84e91045266841ddb47afe594899bae2f483)
33
+
34
+ ## [v1.1.16](https://github.com/inspect-js/which-typed-array/compare/v1.1.15...v1.1.16) - 2024-11-27
35
+
36
+ ### Commits
37
+
38
+ - [actions] split out node 10-20, and 20+ [`8e289a9`](https://github.com/inspect-js/which-typed-array/commit/8e289a9665a32f7ea267c3ffed7451b154adbe26)
39
+ - [Dev Deps] update `@arethetypeswrong/cli`, `@ljharb/eslint-config`, `@types/node`, `@types/tape`, `auto-changelog`, `tape` [`3d4a678`](https://github.com/inspect-js/which-typed-array/commit/3d4a67872d0dbecb755e63ba4101e9ec030a5e7e)
40
+ - [Tests] replace `aud` with `npm audit` [`6fbada9`](https://github.com/inspect-js/which-typed-array/commit/6fbada976743192db47000e47eefc07708713ea0)
41
+ - [types] add an additional overload [`db5a791`](https://github.com/inspect-js/which-typed-array/commit/db5a791642cd8b4d78fe4ed4da151c4543ee0840)
42
+ - [Dev Deps] remove an unused DT package [`6bfff4c`](https://github.com/inspect-js/which-typed-array/commit/6bfff4c3b0c415cb32cd12be6fab3cbbe9e10e13)
43
+ - [Dev Deps] add missing peer dep [`05fd582`](https://github.com/inspect-js/which-typed-array/commit/05fd582a703cd68ee7613af0ef2c45546ea5d2ba)
44
+
45
+ ## [v1.1.15](https://github.com/inspect-js/which-typed-array/compare/v1.1.14...v1.1.15) - 2024-03-10
46
+
47
+ ### Commits
48
+
49
+ - [types] use a namespace; improve type [`f42bec3`](https://github.com/inspect-js/which-typed-array/commit/f42bec34d5c47bd9e4ab1b48dcde60c09c666712)
50
+ - [types] use shared config [`464a9e3`](https://github.com/inspect-js/which-typed-array/commit/464a9e358c2597253c747970b12032406a19b8d2)
51
+ - [actions] remove redundant finisher; use reusable workflow [`d114ee8`](https://github.com/inspect-js/which-typed-array/commit/d114ee83ceb6c7898386f4b5935a3ed9e2ec61e4)
52
+ - [Dev Deps] update `@types/node`, `tape`, `typescript`; add `@arethetypeswrong/cli` [`9cc63d8`](https://github.com/inspect-js/which-typed-array/commit/9cc63d8635e80ce6dabcb352d23050111040d747)
53
+ - [types] add a helpful hover description [`29ccf8d`](https://github.com/inspect-js/which-typed-array/commit/29ccf8dab0f805cdac6ec56d7b9cc27476708273)
54
+ - [Deps] update `available-typed-arrays`, `call-bind`, `has-tostringtag` [`7ecfd8e`](https://github.com/inspect-js/which-typed-array/commit/7ecfd8e29d09f8708f7cab7cc41fea9ae5a20867)
55
+
56
+ ## [v1.1.14](https://github.com/inspect-js/which-typed-array/compare/v1.1.13...v1.1.14) - 2024-02-01
57
+
58
+ ### Commits
59
+
60
+ - [patch] add types [`49c4d4c`](https://github.com/inspect-js/which-typed-array/commit/49c4d4c5db9bebb8d6f8c18a01047e44eea15e17)
61
+ - [Dev Deps] update `aud`, `npmignore`, `tape` [`e5fab7b`](https://github.com/inspect-js/which-typed-array/commit/e5fab7b3dc9df2bceb88f15c3d0a2c0176cf2567)
62
+ - [Deps] update `available-typed-arrays`, `call-bind` [`97e2b44`](https://github.com/inspect-js/which-typed-array/commit/97e2b44bad85c9183f1219e28211b3abd167677c)
63
+ - [Deps] update `has-tostringtag` [`1efa8bf`](https://github.com/inspect-js/which-typed-array/commit/1efa8bf910c080c14f011aa7c645ac88bc7a7078)
64
+
8
65
  ## [v1.1.13](https://github.com/inspect-js/which-typed-array/compare/v1.1.12...v1.1.13) - 2023-10-19
9
66
 
10
67
  ### Commits
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Determines the type of the given collection, or returns false.
3
+ *
4
+ * @param {unknown} value The potential collection
5
+ * @returns {TypedArrayName | false | null} 'Int8Array' | 'Uint8Array' | 'Uint8ClampedArray' | 'Int16Array' | 'Uint16Array' | 'Int32Array' | 'Uint32Array' | 'Float32Array' | 'Float64Array' | 'BigInt64Array' | 'BigUint64Array' | false | null
6
+ */
7
+ declare function whichTypedArray(value: Int8Array): 'Int8Array';
8
+ declare function whichTypedArray(value: Uint8Array): 'Uint8Array';
9
+ declare function whichTypedArray(value: Uint8ClampedArray): 'Uint8ClampedArray';
10
+ declare function whichTypedArray(value: Int16Array): 'Int16Array';
11
+ declare function whichTypedArray(value: Uint16Array): 'Uint16Array';
12
+ declare function whichTypedArray(value: Int32Array): 'Int32Array';
13
+ declare function whichTypedArray(value: Uint32Array): 'Uint32Array';
14
+ declare function whichTypedArray(value: Float32Array): 'Float32Array';
15
+ declare function whichTypedArray(value: Float64Array): 'Float64Array';
16
+ declare function whichTypedArray(value: BigInt64Array): 'BigInt64Array';
17
+ declare function whichTypedArray(value: BigUint64Array): 'BigUint64Array';
18
+ declare function whichTypedArray(value: whichTypedArray.TypedArray): whichTypedArray.TypedArrayName;
19
+ declare function whichTypedArray(value: unknown): false | null;
20
+
21
+ declare namespace whichTypedArray {
22
+ export type TypedArrayName =
23
+ | 'Int8Array'
24
+ | 'Uint8Array'
25
+ | 'Uint8ClampedArray'
26
+ | 'Int16Array'
27
+ | 'Uint16Array'
28
+ | 'Int32Array'
29
+ | 'Uint32Array'
30
+ | 'Float32Array'
31
+ | 'Float64Array'
32
+ | 'BigInt64Array'
33
+ | 'BigUint64Array';
34
+
35
+ export type TypedArray =
36
+ | Int8Array
37
+ | Uint8Array
38
+ | Uint8ClampedArray
39
+ | Int16Array
40
+ | Uint16Array
41
+ | Int32Array
42
+ | Uint32Array
43
+ | Float32Array
44
+ | Float64Array
45
+ | BigInt64Array
46
+ | BigUint64Array;
47
+
48
+ export type TypedArrayConstructor =
49
+ | Int8ArrayConstructor
50
+ | Uint8ArrayConstructor
51
+ | Uint8ClampedArrayConstructor
52
+ | Int16ArrayConstructor
53
+ | Uint16ArrayConstructor
54
+ | Int32ArrayConstructor
55
+ | Uint32ArrayConstructor
56
+ | Float32ArrayConstructor
57
+ | Float64ArrayConstructor
58
+ | BigInt64ArrayConstructor
59
+ | BigUint64ArrayConstructor;
60
+ }
61
+
62
+ export = whichTypedArray;
@@ -3,8 +3,9 @@
3
3
  var forEach = require('for-each');
4
4
  var availableTypedArrays = require('available-typed-arrays');
5
5
  var callBind = require('call-bind');
6
- var callBound = require('call-bind/callBound');
6
+ var callBound = require('call-bound');
7
7
  var gOPD = require('gopd');
8
+ var getProto = require('get-proto');
8
9
 
9
10
  var $toString = callBound('Object.prototype.toString');
10
11
  var hasToStringTag = require('has-tostringtag/shams')();
@@ -13,8 +14,8 @@ var g = typeof globalThis === 'undefined' ? global : globalThis;
13
14
  var typedArrays = availableTypedArrays();
14
15
 
15
16
  var $slice = callBound('String.prototype.slice');
16
- var getPrototypeOf = Object.getPrototypeOf; // require('getprototypeof');
17
17
 
18
+ /** @type {<T = unknown>(array: readonly T[], value: unknown) => number} */
18
19
  var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) {
19
20
  for (var i = 0; i < array.length; i += 1) {
20
21
  if (array[i] === value) {
@@ -23,17 +24,23 @@ var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(ar
23
24
  }
24
25
  return -1;
25
26
  };
27
+
28
+ /** @typedef {import('./types').Getter} Getter */
29
+ /** @type {import('./types').Cache} */
26
30
  var cache = { __proto__: null };
27
- if (hasToStringTag && gOPD && getPrototypeOf) {
31
+ if (hasToStringTag && gOPD && getProto) {
28
32
  forEach(typedArrays, function (typedArray) {
29
33
  var arr = new g[typedArray]();
30
- if (Symbol.toStringTag in arr) {
31
- var proto = getPrototypeOf(arr);
34
+ if (Symbol.toStringTag in arr && getProto) {
35
+ var proto = getProto(arr);
36
+ // @ts-expect-error TS won't narrow inside a closure
32
37
  var descriptor = gOPD(proto, Symbol.toStringTag);
33
- if (!descriptor) {
34
- var superProto = getPrototypeOf(proto);
38
+ if (!descriptor && proto) {
39
+ var superProto = getProto(proto);
40
+ // @ts-expect-error TS won't narrow inside a closure
35
41
  descriptor = gOPD(superProto, Symbol.toStringTag);
36
42
  }
43
+ // @ts-expect-error TODO: fix
37
44
  cache['$' + typedArray] = callBind(descriptor.get);
38
45
  }
39
46
  });
@@ -42,41 +49,59 @@ if (hasToStringTag && gOPD && getPrototypeOf) {
42
49
  var arr = new g[typedArray]();
43
50
  var fn = arr.slice || arr.set;
44
51
  if (fn) {
45
- cache['$' + typedArray] = callBind(fn);
52
+ cache[
53
+ /** @type {`$${import('.').TypedArrayName}`} */ ('$' + typedArray)
54
+ ] = /** @type {import('./types').BoundSlice | import('./types').BoundSet} */ (
55
+ // @ts-expect-error TODO FIXME
56
+ callBind(fn)
57
+ );
46
58
  }
47
59
  });
48
60
  }
49
61
 
62
+ /** @type {(value: object) => false | import('.').TypedArrayName} */
50
63
  var tryTypedArrays = function tryAllTypedArrays(value) {
51
- var found = false;
52
- forEach(cache, function (getter, typedArray) {
53
- if (!found) {
54
- try {
55
- if ('$' + getter(value) === typedArray) {
56
- found = $slice(typedArray, 1);
57
- }
58
- } catch (e) { /**/ }
64
+ /** @type {ReturnType<typeof tryAllTypedArrays>} */ var found = false;
65
+ forEach(
66
+ /** @type {Record<`\$${import('.').TypedArrayName}`, Getter>} */ (cache),
67
+ /** @type {(getter: Getter, name: `\$${import('.').TypedArrayName}`) => void} */
68
+ function (getter, typedArray) {
69
+ if (!found) {
70
+ try {
71
+ // @ts-expect-error a throw is fine here
72
+ if ('$' + getter(value) === typedArray) {
73
+ found = /** @type {import('.').TypedArrayName} */ ($slice(typedArray, 1));
74
+ }
75
+ } catch (e) { /**/ }
76
+ }
59
77
  }
60
- });
78
+ );
61
79
  return found;
62
80
  };
63
81
 
82
+ /** @type {(value: object) => false | import('.').TypedArrayName} */
64
83
  var trySlices = function tryAllSlices(value) {
65
- var found = false;
66
- forEach(cache, function (getter, name) {
67
- if (!found) {
68
- try {
69
- getter(value);
70
- found = $slice(name, 1);
71
- } catch (e) { /**/ }
84
+ /** @type {ReturnType<typeof tryAllSlices>} */ var found = false;
85
+ forEach(
86
+ /** @type {Record<`\$${import('.').TypedArrayName}`, Getter>} */(cache),
87
+ /** @type {(getter: Getter, name: `\$${import('.').TypedArrayName}`) => void} */ function (getter, name) {
88
+ if (!found) {
89
+ try {
90
+ // @ts-expect-error a throw is fine here
91
+ getter(value);
92
+ found = /** @type {import('.').TypedArrayName} */ ($slice(name, 1));
93
+ } catch (e) { /**/ }
94
+ }
72
95
  }
73
- });
96
+ );
74
97
  return found;
75
98
  };
76
99
 
100
+ /** @type {import('.')} */
77
101
  module.exports = function whichTypedArray(value) {
78
102
  if (!value || typeof value !== 'object') { return false; }
79
103
  if (!hasToStringTag) {
104
+ /** @type {string} */
80
105
  var tag = $slice($toString(value), 8, -1);
81
106
  if ($indexOf(typedArrays, tag) > -1) {
82
107
  return tag;