@coro-ai/runner 0.1.33 → 0.1.34

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 (550) hide show
  1. package/dist/src/clients/tracker/jira.js +6 -0
  2. package/dist/src/clients/tracker/jira.js.map +1 -1
  3. package/dist/src/clients/tracker/linear.js +6 -2
  4. package/dist/src/clients/tracker/linear.js.map +1 -1
  5. package/dist/src/clients/tracker/types.d.ts +11 -0
  6. package/dist/src/mcp-handlers.d.ts +1 -0
  7. package/dist/src/mcp-handlers.js +6 -2
  8. package/dist/src/mcp-handlers.js.map +1 -1
  9. package/dist/src/mcp-server.js +6 -1
  10. package/dist/src/mcp-server.js.map +1 -1
  11. package/dist/src/plugins/builtin/github-tracker/intelligence/snippets/github-issues-keys.md +4 -1
  12. package/dist/src/plugins/builtin/jira/index.js +12 -0
  13. package/dist/src/plugins/builtin/jira/index.js.map +1 -1
  14. package/dist/src/plugins/builtin/jira/intelligence/snippets/jira-transitions.md +6 -1
  15. package/dist/src/plugins/builtin/linear/index.js +12 -0
  16. package/dist/src/plugins/builtin/linear/index.js.map +1 -1
  17. package/dist/src/plugins/builtin/linear/intelligence/snippets/linear-keys.md +6 -2
  18. package/dist/src/plugins/types.d.ts +12 -0
  19. package/node_modules/@coro-ai/cloud-protocol/package.json +1 -1
  20. package/node_modules/@coro-ai/intelligence-base/package.json +1 -1
  21. package/node_modules/@coro-ai/llm-anthropic/dist/executor.d.ts.map +1 -1
  22. package/node_modules/@coro-ai/llm-anthropic/dist/executor.js +19 -3
  23. package/node_modules/@coro-ai/llm-anthropic/dist/executor.js.map +1 -1
  24. package/node_modules/@coro-ai/llm-anthropic/package.json +1 -1
  25. package/node_modules/@coro-ai/llm-openai/README.md +3 -3
  26. package/node_modules/@coro-ai/llm-openai/dist/executor.js +4 -4
  27. package/node_modules/@coro-ai/llm-openai/dist/executor.js.map +1 -1
  28. package/node_modules/@coro-ai/llm-openai/dist/models.d.ts.map +1 -1
  29. package/node_modules/@coro-ai/llm-openai/dist/models.js +24 -0
  30. package/node_modules/@coro-ai/llm-openai/dist/models.js.map +1 -1
  31. package/node_modules/@coro-ai/llm-openai/package.json +1 -1
  32. package/node_modules/@coro-ai/plugin-sdk/dist/types.d.ts +14 -0
  33. package/node_modules/@coro-ai/plugin-sdk/dist/types.d.ts.map +1 -1
  34. package/node_modules/@coro-ai/plugin-sdk/package.json +1 -1
  35. package/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/encodings/sbcs-data.js +2 -0
  36. package/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/encodings/utf32.js +10 -3
  37. package/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/package.json +2 -2
  38. package/node_modules/@modelcontextprotocol/sdk/node_modules/iconv-lite/types/encodings.d.ts +2 -0
  39. package/node_modules/body-parser/HISTORY.md +7 -1
  40. package/node_modules/body-parser/lib/types/json.js +7 -3
  41. package/node_modules/body-parser/lib/types/raw.js +7 -3
  42. package/node_modules/body-parser/lib/types/text.js +7 -3
  43. package/node_modules/body-parser/lib/types/urlencoded.js +7 -3
  44. package/node_modules/body-parser/package.json +1 -1
  45. package/node_modules/express-rate-limit/dist/index.cjs +69 -5
  46. package/node_modules/express-rate-limit/dist/index.d.cts +18 -0
  47. package/node_modules/express-rate-limit/dist/index.d.mts +18 -0
  48. package/node_modules/express-rate-limit/dist/index.d.ts +18 -0
  49. package/node_modules/express-rate-limit/dist/index.mjs +55 -5
  50. package/node_modules/express-rate-limit/node_modules/debug/LICENSE +20 -0
  51. package/node_modules/express-rate-limit/node_modules/debug/README.md +481 -0
  52. package/node_modules/express-rate-limit/node_modules/debug/package.json +64 -0
  53. package/node_modules/express-rate-limit/node_modules/debug/src/browser.js +272 -0
  54. package/node_modules/express-rate-limit/node_modules/debug/src/common.js +292 -0
  55. package/node_modules/express-rate-limit/node_modules/debug/src/index.js +10 -0
  56. package/node_modules/express-rate-limit/node_modules/debug/src/node.js +263 -0
  57. package/node_modules/express-rate-limit/node_modules/ms/index.js +162 -0
  58. package/node_modules/express-rate-limit/node_modules/ms/license.md +21 -0
  59. package/node_modules/express-rate-limit/node_modules/ms/package.json +38 -0
  60. package/node_modules/express-rate-limit/node_modules/ms/readme.md +59 -0
  61. package/node_modules/express-rate-limit/package.json +11 -8
  62. package/node_modules/express-rate-limit/readme.md +2 -2
  63. package/node_modules/fast-copy/README.md +46 -46
  64. package/node_modules/fast-copy/dist/cjs/index.cjs +13 -19
  65. package/node_modules/fast-copy/dist/cjs/index.cjs.map +1 -1
  66. package/node_modules/fast-copy/dist/cjs/index.d.cts +40 -6
  67. package/node_modules/fast-copy/dist/es/index.d.mts +40 -6
  68. package/node_modules/fast-copy/dist/es/index.mjs +13 -19
  69. package/node_modules/fast-copy/dist/es/index.mjs.map +1 -1
  70. package/node_modules/fast-copy/dist/umd/index.d.ts +40 -6
  71. package/node_modules/fast-copy/dist/umd/index.js +13 -19
  72. package/node_modules/fast-copy/dist/umd/index.js.map +1 -1
  73. package/node_modules/fast-copy/index.d.ts +22 -22
  74. package/node_modules/fast-copy/package.json +30 -23
  75. package/node_modules/fast-uri/index.js +1 -1
  76. package/node_modules/fast-uri/package.json +1 -1
  77. package/node_modules/fast-uri/test/security.test.js +28 -0
  78. package/node_modules/hono/dist/adapter/aws-lambda/handler.js +2 -5
  79. package/node_modules/hono/dist/adapter/bun/websocket.js +3 -1
  80. package/node_modules/hono/dist/adapter/lambda-edge/handler.js +12 -2
  81. package/node_modules/hono/dist/cjs/adapter/aws-lambda/handler.js +2 -5
  82. package/node_modules/hono/dist/cjs/adapter/bun/websocket.js +3 -1
  83. package/node_modules/hono/dist/cjs/adapter/lambda-edge/handler.js +12 -2
  84. package/node_modules/hono/dist/cjs/client/client.js +10 -1
  85. package/node_modules/hono/dist/cjs/client/utils.js +1 -1
  86. package/node_modules/hono/dist/cjs/middleware/cache/index.js +1 -1
  87. package/node_modules/hono/dist/cjs/middleware/compress/index.js +2 -1
  88. package/node_modules/hono/dist/cjs/middleware/etag/index.js +2 -1
  89. package/node_modules/hono/dist/cjs/middleware/method-override/index.js +5 -3
  90. package/node_modules/hono/dist/cjs/middleware/serve-static/index.js +1 -1
  91. package/node_modules/hono/dist/cjs/router/trie-router/node.js +9 -0
  92. package/node_modules/hono/dist/cjs/utils/body.js +12 -4
  93. package/node_modules/hono/dist/cjs/utils/buffer.js +2 -1
  94. package/node_modules/hono/dist/cjs/validator/validator.js +3 -3
  95. package/node_modules/hono/dist/client/client.js +10 -1
  96. package/node_modules/hono/dist/client/utils.js +1 -1
  97. package/node_modules/hono/dist/middleware/cache/index.js +1 -1
  98. package/node_modules/hono/dist/middleware/compress/index.js +2 -1
  99. package/node_modules/hono/dist/middleware/etag/index.js +2 -1
  100. package/node_modules/hono/dist/middleware/method-override/index.js +5 -3
  101. package/node_modules/hono/dist/middleware/serve-static/index.js +1 -1
  102. package/node_modules/hono/dist/router/trie-router/node.js +9 -0
  103. package/node_modules/hono/dist/types/adapter/lambda-edge/handler.d.ts +1 -1
  104. package/node_modules/hono/dist/types/helper/websocket/index.d.ts +1 -1
  105. package/node_modules/hono/dist/types/middleware/context-storage/index.d.ts +2 -2
  106. package/node_modules/hono/dist/types/middleware/language/language.d.ts +18 -0
  107. package/node_modules/hono/dist/types/utils/body.d.ts +1 -1
  108. package/node_modules/hono/dist/types/utils/types.d.ts +1 -1
  109. package/node_modules/hono/dist/utils/body.js +12 -4
  110. package/node_modules/hono/dist/utils/buffer.js +2 -1
  111. package/node_modules/hono/dist/validator/validator.js +3 -3
  112. package/node_modules/hono/package.json +11 -10
  113. package/node_modules/js-yaml/README.md +5 -3
  114. package/node_modules/js-yaml/dist/js-yaml.js +3009 -2402
  115. package/node_modules/js-yaml/dist/js-yaml.js.map +1 -1
  116. package/node_modules/js-yaml/dist/js-yaml.min.js +2 -33
  117. package/node_modules/js-yaml/dist/js-yaml.min.js.map +1 -1
  118. package/node_modules/js-yaml/dist/js-yaml.mjs +3073 -2381
  119. package/node_modules/js-yaml/dist/js-yaml.mjs.map +1 -1
  120. package/node_modules/js-yaml/lib/loader.js +7 -11
  121. package/node_modules/js-yaml/lib/type/float.js +1 -1
  122. package/node_modules/js-yaml/lib/type/int.js +4 -4
  123. package/node_modules/js-yaml/package.json +10 -4
  124. package/node_modules/node-abi/abi_registry.json +8 -1
  125. package/node_modules/node-abi/package.json +1 -1
  126. package/node_modules/openai/CHANGELOG.md +69 -0
  127. package/node_modules/openai/README.md +9 -2
  128. package/node_modules/openai/client.d.mts +1 -0
  129. package/node_modules/openai/client.d.mts.map +1 -1
  130. package/node_modules/openai/client.d.ts +1 -0
  131. package/node_modules/openai/client.d.ts.map +1 -1
  132. package/node_modules/openai/client.js +11 -5
  133. package/node_modules/openai/client.js.map +1 -1
  134. package/node_modules/openai/client.mjs +11 -5
  135. package/node_modules/openai/client.mjs.map +1 -1
  136. package/node_modules/openai/core/streaming.d.mts.map +1 -1
  137. package/node_modules/openai/core/streaming.d.ts.map +1 -1
  138. package/node_modules/openai/core/streaming.js +38 -6
  139. package/node_modules/openai/core/streaming.js.map +1 -1
  140. package/node_modules/openai/core/streaming.mjs +38 -6
  141. package/node_modules/openai/core/streaming.mjs.map +1 -1
  142. package/node_modules/openai/core/uploads.d.mts +1 -1
  143. package/node_modules/openai/core/uploads.d.mts.map +1 -1
  144. package/node_modules/openai/core/uploads.d.ts +1 -1
  145. package/node_modules/openai/core/uploads.d.ts.map +1 -1
  146. package/node_modules/openai/core/uploads.js +3 -1
  147. package/node_modules/openai/core/uploads.js.map +1 -1
  148. package/node_modules/openai/core/uploads.mjs +1 -0
  149. package/node_modules/openai/core/uploads.mjs.map +1 -1
  150. package/node_modules/openai/helpers/audio.d.mts.map +1 -1
  151. package/node_modules/openai/helpers/audio.d.ts.map +1 -1
  152. package/node_modules/openai/helpers/audio.js +16 -3
  153. package/node_modules/openai/helpers/audio.js.map +1 -1
  154. package/node_modules/openai/helpers/audio.mjs +17 -4
  155. package/node_modules/openai/helpers/audio.mjs.map +1 -1
  156. package/node_modules/openai/helpers/zod.d.mts +20 -7
  157. package/node_modules/openai/helpers/zod.d.mts.map +1 -1
  158. package/node_modules/openai/helpers/zod.d.ts +20 -7
  159. package/node_modules/openai/helpers/zod.d.ts.map +1 -1
  160. package/node_modules/openai/helpers/zod.js +24 -12
  161. package/node_modules/openai/helpers/zod.js.map +1 -1
  162. package/node_modules/openai/helpers/zod.mjs +24 -12
  163. package/node_modules/openai/helpers/zod.mjs.map +1 -1
  164. package/node_modules/openai/index.d.mts +1 -1
  165. package/node_modules/openai/index.d.mts.map +1 -1
  166. package/node_modules/openai/index.d.ts +1 -1
  167. package/node_modules/openai/index.d.ts.map +1 -1
  168. package/node_modules/openai/index.js +2 -1
  169. package/node_modules/openai/index.js.map +1 -1
  170. package/node_modules/openai/index.mjs +1 -1
  171. package/node_modules/openai/index.mjs.map +1 -1
  172. package/node_modules/openai/internal/headers.d.mts.map +1 -1
  173. package/node_modules/openai/internal/headers.d.ts.map +1 -1
  174. package/node_modules/openai/internal/headers.js +7 -3
  175. package/node_modules/openai/internal/headers.js.map +1 -1
  176. package/node_modules/openai/internal/headers.mjs +7 -3
  177. package/node_modules/openai/internal/headers.mjs.map +1 -1
  178. package/node_modules/openai/internal/uploads.d.mts +26 -1
  179. package/node_modules/openai/internal/uploads.d.mts.map +1 -1
  180. package/node_modules/openai/internal/uploads.d.ts +26 -1
  181. package/node_modules/openai/internal/uploads.d.ts.map +1 -1
  182. package/node_modules/openai/internal/uploads.js +169 -1
  183. package/node_modules/openai/internal/uploads.js.map +1 -1
  184. package/node_modules/openai/internal/uploads.mjs +169 -2
  185. package/node_modules/openai/internal/uploads.mjs.map +1 -1
  186. package/node_modules/openai/lib/AbstractChatCompletionRunner.d.mts +3 -3
  187. package/node_modules/openai/lib/AbstractChatCompletionRunner.d.mts.map +1 -1
  188. package/node_modules/openai/lib/AbstractChatCompletionRunner.d.ts +3 -3
  189. package/node_modules/openai/lib/AbstractChatCompletionRunner.d.ts.map +1 -1
  190. package/node_modules/openai/lib/AbstractChatCompletionRunner.js +18 -3
  191. package/node_modules/openai/lib/AbstractChatCompletionRunner.js.map +1 -1
  192. package/node_modules/openai/lib/AbstractChatCompletionRunner.mjs +18 -3
  193. package/node_modules/openai/lib/AbstractChatCompletionRunner.mjs.map +1 -1
  194. package/node_modules/openai/lib/AssistantStream.d.mts.map +1 -1
  195. package/node_modules/openai/lib/AssistantStream.d.ts.map +1 -1
  196. package/node_modules/openai/lib/AssistantStream.js +4 -3
  197. package/node_modules/openai/lib/AssistantStream.js.map +1 -1
  198. package/node_modules/openai/lib/AssistantStream.mjs +4 -3
  199. package/node_modules/openai/lib/AssistantStream.mjs.map +1 -1
  200. package/node_modules/openai/lib/ChatCompletionRunner.d.mts +26 -2
  201. package/node_modules/openai/lib/ChatCompletionRunner.d.mts.map +1 -1
  202. package/node_modules/openai/lib/ChatCompletionRunner.d.ts +26 -2
  203. package/node_modules/openai/lib/ChatCompletionRunner.d.ts.map +1 -1
  204. package/node_modules/openai/lib/ChatCompletionRunner.js.map +1 -1
  205. package/node_modules/openai/lib/ChatCompletionRunner.mjs.map +1 -1
  206. package/node_modules/openai/lib/ChatCompletionStream.d.mts +14 -1
  207. package/node_modules/openai/lib/ChatCompletionStream.d.mts.map +1 -1
  208. package/node_modules/openai/lib/ChatCompletionStream.d.ts +14 -1
  209. package/node_modules/openai/lib/ChatCompletionStream.d.ts.map +1 -1
  210. package/node_modules/openai/lib/ChatCompletionStream.js +75 -16
  211. package/node_modules/openai/lib/ChatCompletionStream.js.map +1 -1
  212. package/node_modules/openai/lib/ChatCompletionStream.mjs +74 -16
  213. package/node_modules/openai/lib/ChatCompletionStream.mjs.map +1 -1
  214. package/node_modules/openai/lib/ChatCompletionStreamingRunner.d.mts +25 -2
  215. package/node_modules/openai/lib/ChatCompletionStreamingRunner.d.mts.map +1 -1
  216. package/node_modules/openai/lib/ChatCompletionStreamingRunner.d.ts +25 -2
  217. package/node_modules/openai/lib/ChatCompletionStreamingRunner.d.ts.map +1 -1
  218. package/node_modules/openai/lib/ChatCompletionStreamingRunner.js +77 -0
  219. package/node_modules/openai/lib/ChatCompletionStreamingRunner.js.map +1 -1
  220. package/node_modules/openai/lib/ChatCompletionStreamingRunner.mjs +78 -1
  221. package/node_modules/openai/lib/ChatCompletionStreamingRunner.mjs.map +1 -1
  222. package/node_modules/openai/lib/EventStream.d.mts +13 -0
  223. package/node_modules/openai/lib/EventStream.d.mts.map +1 -1
  224. package/node_modules/openai/lib/EventStream.d.ts +13 -0
  225. package/node_modules/openai/lib/EventStream.d.ts.map +1 -1
  226. package/node_modules/openai/lib/EventStream.js +107 -2
  227. package/node_modules/openai/lib/EventStream.js.map +1 -1
  228. package/node_modules/openai/lib/EventStream.mjs +107 -2
  229. package/node_modules/openai/lib/EventStream.mjs.map +1 -1
  230. package/node_modules/openai/lib/RunnableFunction.d.mts +38 -21
  231. package/node_modules/openai/lib/RunnableFunction.d.mts.map +1 -1
  232. package/node_modules/openai/lib/RunnableFunction.d.ts +38 -21
  233. package/node_modules/openai/lib/RunnableFunction.d.ts.map +1 -1
  234. package/node_modules/openai/lib/RunnableFunction.js.map +1 -1
  235. package/node_modules/openai/lib/RunnableFunction.mjs.map +1 -1
  236. package/node_modules/openai/lib/parser.d.mts +2 -2
  237. package/node_modules/openai/lib/parser.d.mts.map +1 -1
  238. package/node_modules/openai/lib/parser.d.ts +2 -2
  239. package/node_modules/openai/lib/parser.d.ts.map +1 -1
  240. package/node_modules/openai/lib/parser.js.map +1 -1
  241. package/node_modules/openai/lib/parser.mjs.map +1 -1
  242. package/node_modules/openai/lib/responses/ResponseAccumulator.d.mts +6 -1
  243. package/node_modules/openai/lib/responses/ResponseAccumulator.d.mts.map +1 -1
  244. package/node_modules/openai/lib/responses/ResponseAccumulator.d.ts +6 -1
  245. package/node_modules/openai/lib/responses/ResponseAccumulator.d.ts.map +1 -1
  246. package/node_modules/openai/lib/responses/ResponseAccumulator.js +1 -0
  247. package/node_modules/openai/lib/responses/ResponseAccumulator.js.map +1 -1
  248. package/node_modules/openai/lib/responses/ResponseAccumulator.mjs +1 -0
  249. package/node_modules/openai/lib/responses/ResponseAccumulator.mjs.map +1 -1
  250. package/node_modules/openai/lib/responses/ResponseInputItems.d.mts.map +1 -1
  251. package/node_modules/openai/lib/responses/ResponseInputItems.d.ts.map +1 -1
  252. package/node_modules/openai/lib/responses/ResponseInputItems.js +2 -0
  253. package/node_modules/openai/lib/responses/ResponseInputItems.js.map +1 -1
  254. package/node_modules/openai/lib/responses/ResponseInputItems.mjs +2 -0
  255. package/node_modules/openai/lib/responses/ResponseInputItems.mjs.map +1 -1
  256. package/node_modules/openai/lib/responses/ResponseStream.d.mts +6 -1
  257. package/node_modules/openai/lib/responses/ResponseStream.d.mts.map +1 -1
  258. package/node_modules/openai/lib/responses/ResponseStream.d.ts +6 -1
  259. package/node_modules/openai/lib/responses/ResponseStream.d.ts.map +1 -1
  260. package/node_modules/openai/lib/responses/ResponseStream.js +21 -0
  261. package/node_modules/openai/lib/responses/ResponseStream.js.map +1 -1
  262. package/node_modules/openai/lib/responses/ResponseStream.mjs +21 -0
  263. package/node_modules/openai/lib/responses/ResponseStream.mjs.map +1 -1
  264. package/node_modules/openai/package.json +1 -1
  265. package/node_modules/openai/resources/admin/organization/audit-logs.d.mts +2 -2
  266. package/node_modules/openai/resources/admin/organization/audit-logs.d.mts.map +1 -1
  267. package/node_modules/openai/resources/admin/organization/audit-logs.d.ts +2 -2
  268. package/node_modules/openai/resources/admin/organization/audit-logs.d.ts.map +1 -1
  269. package/node_modules/openai/resources/admin/organization/projects/api-keys.d.mts +12 -0
  270. package/node_modules/openai/resources/admin/organization/projects/api-keys.d.mts.map +1 -1
  271. package/node_modules/openai/resources/admin/organization/projects/api-keys.d.ts +12 -0
  272. package/node_modules/openai/resources/admin/organization/projects/api-keys.d.ts.map +1 -1
  273. package/node_modules/openai/resources/admin/organization/projects/index.d.mts +1 -1
  274. package/node_modules/openai/resources/admin/organization/projects/index.d.mts.map +1 -1
  275. package/node_modules/openai/resources/admin/organization/projects/index.d.ts +1 -1
  276. package/node_modules/openai/resources/admin/organization/projects/index.d.ts.map +1 -1
  277. package/node_modules/openai/resources/admin/organization/projects/index.js +4 -4
  278. package/node_modules/openai/resources/admin/organization/projects/index.js.map +1 -1
  279. package/node_modules/openai/resources/admin/organization/projects/index.mjs +1 -1
  280. package/node_modules/openai/resources/admin/organization/projects/index.mjs.map +1 -1
  281. package/node_modules/openai/resources/admin/organization/projects/projects.d.mts +2 -2
  282. package/node_modules/openai/resources/admin/organization/projects/projects.d.mts.map +1 -1
  283. package/node_modules/openai/resources/admin/organization/projects/projects.d.ts +2 -2
  284. package/node_modules/openai/resources/admin/organization/projects/projects.d.ts.map +1 -1
  285. package/node_modules/openai/resources/admin/organization/projects/projects.js +2 -2
  286. package/node_modules/openai/resources/admin/organization/projects/projects.js.map +1 -1
  287. package/node_modules/openai/resources/admin/organization/projects/projects.mjs +2 -2
  288. package/node_modules/openai/resources/admin/organization/projects/projects.mjs.map +1 -1
  289. package/node_modules/openai/resources/admin/organization/projects/service-accounts/api-keys.d.mts +58 -0
  290. package/node_modules/openai/resources/admin/organization/projects/service-accounts/api-keys.d.mts.map +1 -0
  291. package/node_modules/openai/resources/admin/organization/projects/service-accounts/api-keys.d.ts +58 -0
  292. package/node_modules/openai/resources/admin/organization/projects/service-accounts/api-keys.d.ts.map +1 -0
  293. package/node_modules/openai/resources/admin/organization/projects/service-accounts/api-keys.js +26 -0
  294. package/node_modules/openai/resources/admin/organization/projects/service-accounts/api-keys.js.map +1 -0
  295. package/node_modules/openai/resources/admin/organization/projects/service-accounts/api-keys.mjs +22 -0
  296. package/node_modules/openai/resources/admin/organization/projects/service-accounts/api-keys.mjs.map +1 -0
  297. package/node_modules/openai/resources/admin/organization/projects/service-accounts/index.d.mts +3 -0
  298. package/node_modules/openai/resources/admin/organization/projects/service-accounts/index.d.mts.map +1 -0
  299. package/node_modules/openai/resources/admin/organization/projects/service-accounts/index.d.ts +3 -0
  300. package/node_modules/openai/resources/admin/organization/projects/service-accounts/index.d.ts.map +1 -0
  301. package/node_modules/openai/resources/admin/organization/projects/service-accounts/index.js +9 -0
  302. package/node_modules/openai/resources/admin/organization/projects/service-accounts/index.js.map +1 -0
  303. package/node_modules/openai/resources/admin/organization/projects/service-accounts/index.mjs +4 -0
  304. package/node_modules/openai/resources/admin/organization/projects/service-accounts/index.mjs.map +1 -0
  305. package/node_modules/openai/resources/admin/organization/projects/service-accounts/service-accounts.d.mts +177 -0
  306. package/node_modules/openai/resources/admin/organization/projects/service-accounts/service-accounts.d.mts.map +1 -0
  307. package/node_modules/openai/resources/admin/organization/projects/service-accounts/service-accounts.d.ts +177 -0
  308. package/node_modules/openai/resources/admin/organization/projects/service-accounts/service-accounts.d.ts.map +1 -0
  309. package/node_modules/openai/resources/admin/organization/projects/service-accounts/service-accounts.js +109 -0
  310. package/node_modules/openai/resources/admin/organization/projects/service-accounts/service-accounts.js.map +1 -0
  311. package/node_modules/openai/resources/admin/organization/projects/service-accounts/service-accounts.mjs +104 -0
  312. package/node_modules/openai/resources/admin/organization/projects/service-accounts/service-accounts.mjs.map +1 -0
  313. package/node_modules/openai/resources/admin/organization/projects/service-accounts.d.mts +1 -167
  314. package/node_modules/openai/resources/admin/organization/projects/service-accounts.d.mts.map +1 -1
  315. package/node_modules/openai/resources/admin/organization/projects/service-accounts.d.ts +1 -167
  316. package/node_modules/openai/resources/admin/organization/projects/service-accounts.d.ts.map +1 -1
  317. package/node_modules/openai/resources/admin/organization/projects/service-accounts.js +2 -97
  318. package/node_modules/openai/resources/admin/organization/projects/service-accounts.js.map +1 -1
  319. package/node_modules/openai/resources/admin/organization/projects/service-accounts.mjs +1 -95
  320. package/node_modules/openai/resources/admin/organization/projects/service-accounts.mjs.map +1 -1
  321. package/node_modules/openai/resources/admin/organization/usage.d.mts +517 -88
  322. package/node_modules/openai/resources/admin/organization/usage.d.mts.map +1 -1
  323. package/node_modules/openai/resources/admin/organization/usage.d.ts +517 -88
  324. package/node_modules/openai/resources/admin/organization/usage.d.ts.map +1 -1
  325. package/node_modules/openai/resources/beta/assistants.d.mts +12 -26
  326. package/node_modules/openai/resources/beta/assistants.d.mts.map +1 -1
  327. package/node_modules/openai/resources/beta/assistants.d.ts +12 -26
  328. package/node_modules/openai/resources/beta/assistants.d.ts.map +1 -1
  329. package/node_modules/openai/resources/beta/beta.d.mts +6 -1
  330. package/node_modules/openai/resources/beta/beta.d.mts.map +1 -1
  331. package/node_modules/openai/resources/beta/beta.d.ts +6 -1
  332. package/node_modules/openai/resources/beta/beta.d.ts.map +1 -1
  333. package/node_modules/openai/resources/beta/beta.js +4 -0
  334. package/node_modules/openai/resources/beta/beta.js.map +1 -1
  335. package/node_modules/openai/resources/beta/beta.mjs +4 -0
  336. package/node_modules/openai/resources/beta/beta.mjs.map +1 -1
  337. package/node_modules/openai/resources/beta/index.d.mts +1 -0
  338. package/node_modules/openai/resources/beta/index.d.mts.map +1 -1
  339. package/node_modules/openai/resources/beta/index.d.ts +1 -0
  340. package/node_modules/openai/resources/beta/index.d.ts.map +1 -1
  341. package/node_modules/openai/resources/beta/index.js +5 -3
  342. package/node_modules/openai/resources/beta/index.js.map +1 -1
  343. package/node_modules/openai/resources/beta/index.mjs +1 -0
  344. package/node_modules/openai/resources/beta/index.mjs.map +1 -1
  345. package/node_modules/openai/resources/beta/responses/index.d.mts +6 -0
  346. package/node_modules/openai/resources/beta/responses/index.d.mts.map +1 -0
  347. package/node_modules/openai/resources/beta/responses/index.d.ts +6 -0
  348. package/node_modules/openai/resources/beta/responses/index.d.ts.map +1 -0
  349. package/node_modules/openai/resources/beta/responses/index.js +11 -0
  350. package/node_modules/openai/resources/beta/responses/index.js.map +1 -0
  351. package/node_modules/openai/resources/beta/responses/index.mjs +5 -0
  352. package/node_modules/openai/resources/beta/responses/index.mjs.map +1 -0
  353. package/node_modules/openai/resources/beta/responses/input-items.d.mts +69 -0
  354. package/node_modules/openai/resources/beta/responses/input-items.d.mts.map +1 -0
  355. package/node_modules/openai/resources/beta/responses/input-items.d.ts +69 -0
  356. package/node_modules/openai/resources/beta/responses/input-items.d.ts.map +1 -0
  357. package/node_modules/openai/resources/beta/responses/input-items.js +37 -0
  358. package/node_modules/openai/resources/beta/responses/input-items.js.map +1 -0
  359. package/node_modules/openai/resources/beta/responses/input-items.mjs +33 -0
  360. package/node_modules/openai/resources/beta/responses/input-items.mjs.map +1 -0
  361. package/node_modules/openai/resources/beta/responses/input-tokens.d.mts +191 -0
  362. package/node_modules/openai/resources/beta/responses/input-tokens.d.mts.map +1 -0
  363. package/node_modules/openai/resources/beta/responses/input-tokens.d.ts +191 -0
  364. package/node_modules/openai/resources/beta/responses/input-tokens.d.ts.map +1 -0
  365. package/node_modules/openai/resources/beta/responses/input-tokens.js +34 -0
  366. package/node_modules/openai/resources/beta/responses/input-tokens.js.map +1 -0
  367. package/node_modules/openai/resources/beta/responses/input-tokens.mjs +30 -0
  368. package/node_modules/openai/resources/beta/responses/input-tokens.mjs.map +1 -0
  369. package/node_modules/openai/resources/beta/responses/internal-base.d.mts +71 -0
  370. package/node_modules/openai/resources/beta/responses/internal-base.d.mts.map +1 -0
  371. package/node_modules/openai/resources/beta/responses/internal-base.d.ts +71 -0
  372. package/node_modules/openai/resources/beta/responses/internal-base.d.ts.map +1 -0
  373. package/node_modules/openai/resources/beta/responses/internal-base.js +48 -0
  374. package/node_modules/openai/resources/beta/responses/internal-base.js.map +1 -0
  375. package/node_modules/openai/resources/beta/responses/internal-base.mjs +42 -0
  376. package/node_modules/openai/resources/beta/responses/internal-base.mjs.map +1 -0
  377. package/node_modules/openai/resources/beta/responses/responses.d.mts +9986 -0
  378. package/node_modules/openai/resources/beta/responses/responses.d.mts.map +1 -0
  379. package/node_modules/openai/resources/beta/responses/responses.d.ts +9986 -0
  380. package/node_modules/openai/resources/beta/responses/responses.d.ts.map +1 -0
  381. package/node_modules/openai/resources/beta/responses/responses.js +121 -0
  382. package/node_modules/openai/resources/beta/responses/responses.js.map +1 -0
  383. package/node_modules/openai/resources/beta/responses/responses.mjs +116 -0
  384. package/node_modules/openai/resources/beta/responses/responses.mjs.map +1 -0
  385. package/node_modules/openai/resources/beta/responses/ws-base.d.mts +106 -0
  386. package/node_modules/openai/resources/beta/responses/ws-base.d.mts.map +1 -0
  387. package/node_modules/openai/resources/beta/responses/ws-base.d.ts +106 -0
  388. package/node_modules/openai/resources/beta/responses/ws-base.d.ts.map +1 -0
  389. package/node_modules/openai/resources/beta/responses/ws-base.js +476 -0
  390. package/node_modules/openai/resources/beta/responses/ws-base.js.map +1 -0
  391. package/node_modules/openai/resources/beta/responses/ws-base.mjs +472 -0
  392. package/node_modules/openai/resources/beta/responses/ws-base.mjs.map +1 -0
  393. package/node_modules/openai/resources/beta/responses/ws.d.mts +13 -0
  394. package/node_modules/openai/resources/beta/responses/ws.d.mts.map +1 -0
  395. package/node_modules/openai/resources/beta/responses/ws.d.ts +13 -0
  396. package/node_modules/openai/resources/beta/responses/ws.d.ts.map +1 -0
  397. package/node_modules/openai/resources/beta/responses/ws.js +31 -0
  398. package/node_modules/openai/resources/beta/responses/ws.js.map +1 -0
  399. package/node_modules/openai/resources/beta/responses/ws.mjs +26 -0
  400. package/node_modules/openai/resources/beta/responses/ws.mjs.map +1 -0
  401. package/node_modules/openai/resources/beta/responses.d.mts +2 -0
  402. package/node_modules/openai/resources/beta/responses.d.mts.map +1 -0
  403. package/node_modules/openai/resources/beta/responses.d.ts +2 -0
  404. package/node_modules/openai/resources/beta/responses.d.ts.map +1 -0
  405. package/node_modules/openai/resources/beta/responses.js +6 -0
  406. package/node_modules/openai/resources/beta/responses.js.map +1 -0
  407. package/node_modules/openai/resources/beta/responses.mjs +3 -0
  408. package/node_modules/openai/resources/beta/responses.mjs.map +1 -0
  409. package/node_modules/openai/resources/beta/threads/runs/runs.d.mts +6 -13
  410. package/node_modules/openai/resources/beta/threads/runs/runs.d.mts.map +1 -1
  411. package/node_modules/openai/resources/beta/threads/runs/runs.d.ts +6 -13
  412. package/node_modules/openai/resources/beta/threads/runs/runs.d.ts.map +1 -1
  413. package/node_modules/openai/resources/beta/threads/runs/runs.js.map +1 -1
  414. package/node_modules/openai/resources/beta/threads/runs/runs.mjs.map +1 -1
  415. package/node_modules/openai/resources/chat/completions/completions.d.mts +170 -20
  416. package/node_modules/openai/resources/chat/completions/completions.d.mts.map +1 -1
  417. package/node_modules/openai/resources/chat/completions/completions.d.ts +170 -20
  418. package/node_modules/openai/resources/chat/completions/completions.d.ts.map +1 -1
  419. package/node_modules/openai/resources/chat/completions/completions.js.map +1 -1
  420. package/node_modules/openai/resources/chat/completions/completions.mjs.map +1 -1
  421. package/node_modules/openai/resources/completions.d.mts +4 -0
  422. package/node_modules/openai/resources/completions.d.mts.map +1 -1
  423. package/node_modules/openai/resources/completions.d.ts +4 -0
  424. package/node_modules/openai/resources/completions.d.ts.map +1 -1
  425. package/node_modules/openai/resources/conversations/conversations.d.mts +19 -0
  426. package/node_modules/openai/resources/conversations/conversations.d.mts.map +1 -1
  427. package/node_modules/openai/resources/conversations/conversations.d.ts +19 -0
  428. package/node_modules/openai/resources/conversations/conversations.d.ts.map +1 -1
  429. package/node_modules/openai/resources/conversations/conversations.js.map +1 -1
  430. package/node_modules/openai/resources/conversations/conversations.mjs.map +1 -1
  431. package/node_modules/openai/resources/conversations/items.d.mts +45 -1
  432. package/node_modules/openai/resources/conversations/items.d.mts.map +1 -1
  433. package/node_modules/openai/resources/conversations/items.d.ts +45 -1
  434. package/node_modules/openai/resources/conversations/items.d.ts.map +1 -1
  435. package/node_modules/openai/resources/evals/runs/runs.d.mts +66 -143
  436. package/node_modules/openai/resources/evals/runs/runs.d.mts.map +1 -1
  437. package/node_modules/openai/resources/evals/runs/runs.d.ts +66 -143
  438. package/node_modules/openai/resources/evals/runs/runs.d.ts.map +1 -1
  439. package/node_modules/openai/resources/evals/runs/runs.js.map +1 -1
  440. package/node_modules/openai/resources/evals/runs/runs.mjs.map +1 -1
  441. package/node_modules/openai/resources/graders/grader-models.d.mts +6 -13
  442. package/node_modules/openai/resources/graders/grader-models.d.mts.map +1 -1
  443. package/node_modules/openai/resources/graders/grader-models.d.ts +6 -13
  444. package/node_modules/openai/resources/graders/grader-models.d.ts.map +1 -1
  445. package/node_modules/openai/resources/realtime/calls.d.mts +1 -1
  446. package/node_modules/openai/resources/realtime/calls.d.mts.map +1 -1
  447. package/node_modules/openai/resources/realtime/calls.d.ts +1 -1
  448. package/node_modules/openai/resources/realtime/calls.d.ts.map +1 -1
  449. package/node_modules/openai/resources/realtime/client-secrets.d.mts +5 -1
  450. package/node_modules/openai/resources/realtime/client-secrets.d.mts.map +1 -1
  451. package/node_modules/openai/resources/realtime/client-secrets.d.ts +5 -1
  452. package/node_modules/openai/resources/realtime/client-secrets.d.ts.map +1 -1
  453. package/node_modules/openai/resources/realtime/realtime.d.mts +9 -1
  454. package/node_modules/openai/resources/realtime/realtime.d.mts.map +1 -1
  455. package/node_modules/openai/resources/realtime/realtime.d.ts +9 -1
  456. package/node_modules/openai/resources/realtime/realtime.d.ts.map +1 -1
  457. package/node_modules/openai/resources/realtime/realtime.js.map +1 -1
  458. package/node_modules/openai/resources/realtime/realtime.mjs.map +1 -1
  459. package/node_modules/openai/resources/responses/input-tokens.d.mts +7 -1
  460. package/node_modules/openai/resources/responses/input-tokens.d.mts.map +1 -1
  461. package/node_modules/openai/resources/responses/input-tokens.d.ts +7 -1
  462. package/node_modules/openai/resources/responses/input-tokens.d.ts.map +1 -1
  463. package/node_modules/openai/resources/responses/responses.d.mts +819 -26
  464. package/node_modules/openai/resources/responses/responses.d.mts.map +1 -1
  465. package/node_modules/openai/resources/responses/responses.d.ts +819 -26
  466. package/node_modules/openai/resources/responses/responses.d.ts.map +1 -1
  467. package/node_modules/openai/resources/responses/responses.js +1 -1
  468. package/node_modules/openai/resources/responses/responses.js.map +1 -1
  469. package/node_modules/openai/resources/responses/responses.mjs +1 -1
  470. package/node_modules/openai/resources/responses/responses.mjs.map +1 -1
  471. package/node_modules/openai/resources/shared.d.mts +20 -28
  472. package/node_modules/openai/resources/shared.d.mts.map +1 -1
  473. package/node_modules/openai/resources/shared.d.ts +20 -28
  474. package/node_modules/openai/resources/shared.d.ts.map +1 -1
  475. package/node_modules/openai/src/client.ts +13 -5
  476. package/node_modules/openai/src/core/streaming.ts +36 -8
  477. package/node_modules/openai/src/core/uploads.ts +6 -1
  478. package/node_modules/openai/src/helpers/audio.ts +18 -4
  479. package/node_modules/openai/src/helpers/zod.ts +62 -23
  480. package/node_modules/openai/src/index.ts +1 -1
  481. package/node_modules/openai/src/internal/headers.ts +7 -3
  482. package/node_modules/openai/src/internal/uploads.ts +214 -4
  483. package/node_modules/openai/src/lib/AbstractChatCompletionRunner.ts +32 -9
  484. package/node_modules/openai/src/lib/AssistantStream.ts +4 -3
  485. package/node_modules/openai/src/lib/ChatCompletionRunner.ts +46 -6
  486. package/node_modules/openai/src/lib/ChatCompletionStream.ts +115 -17
  487. package/node_modules/openai/src/lib/ChatCompletionStreamingRunner.ts +144 -7
  488. package/node_modules/openai/src/lib/EventStream.ts +114 -4
  489. package/node_modules/openai/src/lib/RunnableFunction.ts +60 -31
  490. package/node_modules/openai/src/lib/parser.ts +4 -0
  491. package/node_modules/openai/src/lib/responses/ResponseAccumulator.ts +10 -1
  492. package/node_modules/openai/src/lib/responses/ResponseInputItems.ts +2 -0
  493. package/node_modules/openai/src/lib/responses/ResponseStream.ts +29 -1
  494. package/node_modules/openai/src/resources/admin/organization/audit-logs.ts +169 -1
  495. package/node_modules/openai/src/resources/admin/organization/projects/api-keys.ts +15 -1
  496. package/node_modules/openai/src/resources/admin/organization/projects/index.ts +1 -1
  497. package/node_modules/openai/src/resources/admin/organization/projects/projects.ts +13 -13
  498. package/node_modules/openai/src/resources/admin/organization/projects/service-accounts/api-keys.ts +80 -0
  499. package/node_modules/openai/src/resources/admin/organization/projects/service-accounts/index.ts +15 -0
  500. package/node_modules/openai/src/resources/admin/organization/projects/service-accounts/service-accounts.ts +284 -0
  501. package/node_modules/openai/src/resources/admin/organization/projects/service-accounts.ts +1 -264
  502. package/node_modules/openai/src/resources/admin/organization/usage.ts +616 -88
  503. package/node_modules/openai/src/resources/beta/assistants.ts +12 -26
  504. package/node_modules/openai/src/resources/beta/beta.ts +330 -2
  505. package/node_modules/openai/src/resources/beta/index.ts +163 -0
  506. package/node_modules/openai/src/resources/beta/responses/index.ts +169 -0
  507. package/node_modules/openai/src/resources/beta/responses/input-items.ts +105 -0
  508. package/node_modules/openai/src/resources/beta/responses/input-tokens.ts +245 -0
  509. package/node_modules/openai/src/resources/beta/responses/internal-base.ts +117 -0
  510. package/node_modules/openai/src/resources/beta/responses/responses.ts +12633 -0
  511. package/node_modules/openai/src/resources/beta/responses/ws-base.ts +615 -0
  512. package/node_modules/openai/src/resources/beta/responses/ws.ts +38 -0
  513. package/node_modules/openai/src/resources/beta/responses.ts +3 -0
  514. package/node_modules/openai/src/resources/beta/threads/runs/runs.ts +6 -13
  515. package/node_modules/openai/src/resources/chat/completions/completions.ts +237 -23
  516. package/node_modules/openai/src/resources/completions.ts +5 -0
  517. package/node_modules/openai/src/resources/conversations/conversations.ts +21 -0
  518. package/node_modules/openai/src/resources/conversations/items.ts +56 -0
  519. package/node_modules/openai/src/resources/evals/runs/runs.ts +66 -143
  520. package/node_modules/openai/src/resources/graders/grader-models.ts +6 -13
  521. package/node_modules/openai/src/resources/realtime/calls.ts +2 -0
  522. package/node_modules/openai/src/resources/realtime/client-secrets.ts +7 -0
  523. package/node_modules/openai/src/resources/realtime/realtime.ts +12 -0
  524. package/node_modules/openai/src/resources/responses/input-tokens.ts +8 -0
  525. package/node_modules/openai/src/resources/responses/responses.ts +953 -17
  526. package/node_modules/openai/src/resources/shared.ts +23 -27
  527. package/node_modules/openai/src/version.ts +1 -1
  528. package/node_modules/openai/version.d.mts +1 -1
  529. package/node_modules/openai/version.d.ts +1 -1
  530. package/node_modules/openai/version.js +1 -1
  531. package/node_modules/openai/version.mjs +1 -1
  532. package/node_modules/tar-fs/index.js +39 -10
  533. package/node_modules/tar-fs/package.json +6 -1
  534. package/node_modules/tar-fs/test/index.js +111 -0
  535. package/node_modules/ws/lib/receiver.js +15 -32
  536. package/node_modules/ws/lib/websocket-server.js +4 -4
  537. package/node_modules/ws/lib/websocket.js +4 -4
  538. package/node_modules/ws/package.json +5 -1
  539. package/package.json +6 -6
  540. package/node_modules/fast-copy/CHANGELOG.md +0 -176
  541. package/node_modules/fast-copy/dist/cjs/copier.d.cts +0 -75
  542. package/node_modules/fast-copy/dist/cjs/options.d.cts +0 -69
  543. package/node_modules/fast-copy/dist/cjs/utils.d.cts +0 -13
  544. package/node_modules/fast-copy/dist/es/copier.d.mts +0 -75
  545. package/node_modules/fast-copy/dist/es/options.d.mts +0 -69
  546. package/node_modules/fast-copy/dist/es/utils.d.mts +0 -13
  547. package/node_modules/fast-copy/dist/umd/copier.d.ts +0 -72
  548. package/node_modules/fast-copy/dist/umd/options.d.ts +0 -65
  549. package/node_modules/fast-copy/dist/umd/utils.d.ts +0 -13
  550. package/node_modules/hono/dist/tsconfig.build.tsbuildinfo +0 -1
@@ -309,19 +309,19 @@ _Small number of properties, all values are primitives_
309
309
  ┌────────────────────┬────────────────┐
310
310
  │ Name │ Ops / sec │
311
311
  ├────────────────────┼────────────────┤
312
- │ fast-copy │ 4606103.720559 │
312
+ │ fast-copy │ 4516637.948706 │
313
313
  ├────────────────────┼────────────────┤
314
- │ lodash.cloneDeep │ 2575175.39241 │
314
+ │ lodash.cloneDeep │ 2726908.524823 │
315
315
  ├────────────────────┼────────────────┤
316
- │ clone │ 2172921.6353 │
316
+ │ clone │ 2292947.082887 │
317
317
  ├────────────────────┼────────────────┤
318
- │ ramda │ 1919715.448951 │
318
+ │ ramda │ 1919887.358374 │
319
319
  ├────────────────────┼────────────────┤
320
- │ fast-clone │ 1576610.693318 │
320
+ │ fast-clone │ 1445623.172658 │
321
321
  ├────────────────────┼────────────────┤
322
- │ deepclone │ 1173500.05884 │
322
+ │ deepclone │ 1172068.638112 │
323
323
  ├────────────────────┼────────────────┤
324
- │ fast-copy (strict) │ 1049310.47701 │
324
+ │ fast-copy (strict) │ 1029920.368064 │
325
325
  └────────────────────┴────────────────┘
326
326
  Fastest was "fast-copy".
327
327
  ```
@@ -334,19 +334,19 @@ _Large number of properties, values are a combination of primitives and complex
334
334
  ┌────────────────────┬───────────────┐
335
335
  │ Name │ Ops / sec │
336
336
  ├────────────────────┼───────────────┤
337
- │ fast-copy │ 235511.4532 │
337
+ │ fast-copy │ 202418.444691 │
338
338
  ├────────────────────┼───────────────┤
339
- │ deepclone │ 142976.849406 │
339
+ │ deepclone │ 139120.811183 │
340
340
  ├────────────────────┼───────────────┤
341
- │ clone │ 125026.837887 │
341
+ │ clone │ 122191.364796 │
342
342
  ├────────────────────┼───────────────┤
343
- │ ramda │ 114216.98158 │
343
+ │ ramda │ 106986.690081 │
344
344
  ├────────────────────┼───────────────┤
345
- │ fast-clone │ 111388.215547 │
345
+ │ fast-clone │ 102390.033243 │
346
346
  ├────────────────────┼───────────────┤
347
- │ fast-copy (strict) │ 77683.900047 │
347
+ │ fast-copy (strict) │ 72306.017635 │
348
348
  ├────────────────────┼───────────────┤
349
- │ lodash.cloneDeep │ 71343.431983 │
349
+ │ lodash.cloneDeep │ 68706.681189 │
350
350
  └────────────────────┴───────────────┘
351
351
  Fastest was "fast-copy".
352
352
  ```
@@ -356,45 +356,45 @@ Fastest was "fast-copy".
356
356
  _Very large number of properties with high amount of nesting, mainly objects and arrays_
357
357
 
358
358
  ```bash
359
- Testing big data object...
360
359
  ┌────────────────────┬────────────┐
361
360
  │ Name │ Ops / sec │
362
361
  ├────────────────────┼────────────┤
363
- │ fast-copy │ 325.548627 │
362
+ │ fast-copy │ 564.726583 │
364
363
  ├────────────────────┼────────────┤
365
- │ fast-clone │ 257.913886 │
364
+ │ fast-clone │ 265.243854 │
366
365
  ├────────────────────┼────────────┤
367
- │ deepclone │ 158.228042 │
366
+ │ lodash.cloneDeep │ 160.972258 │
368
367
  ├────────────────────┼────────────┤
369
- │ lodash.cloneDeep │ 153.520966 │
368
+ │ deepclone │ 158.201556 │
370
369
  ├────────────────────┼────────────┤
371
- │ fast-copy (strict) │ 126.027381 │
370
+ │ fast-copy (strict) │ 135.031983 │
372
371
  ├────────────────────┼────────────┤
373
- │ clone │ 123.383641 │
372
+ │ clone │ 122.876256 │
374
373
  ├────────────────────┼────────────┤
375
- │ ramda │ 35.507959 │
374
+ │ ramda │ 35.226104 │
376
375
  └────────────────────┴────────────┘
377
376
  Fastest was "fast-copy".
378
377
  ```
379
378
 
380
379
  #### Circular objects
381
380
 
381
+ _Simple object with a deeply nested reference to itself_
382
+
382
383
  ```bash
383
- Testing circular object...
384
384
  ┌────────────────────┬────────────────┐
385
385
  │ Name │ Ops / sec │
386
386
  ├────────────────────┼────────────────┤
387
- │ fast-copy │ 1344790.296938 │
387
+ │ fast-copy │ 2265437.452915 │
388
388
  ├────────────────────┼────────────────┤
389
- │ deepclone │ 1127781.641192 │
389
+ │ deepclone │ 1078459.808203 │
390
390
  ├────────────────────┼────────────────┤
391
- │ lodash.cloneDeep │ 894679.711048 │
391
+ │ lodash.cloneDeep │ 989211.772997 │
392
392
  ├────────────────────┼────────────────┤
393
- │ clone │ 892911.50594 │
393
+ │ fast-copy (strict) │ 865453.141899 │
394
394
  ├────────────────────┼────────────────┤
395
- │ fast-copy (strict) │ 821339.44828 │
395
+ │ clone │ 748230.731936 │
396
396
  ├────────────────────┼────────────────┤
397
- │ ramda │ 615222.946985 │
397
+ │ ramda │ 564490.882674 │
398
398
  ├────────────────────┼────────────────┤
399
399
  │ fast-clone │ 0 │
400
400
  └────────────────────┴────────────────┘
@@ -406,22 +406,22 @@ Fastest was "fast-copy".
406
406
  _Custom constructors, React components, etc_
407
407
 
408
408
  ```bash
409
- ┌────────────────────┬──────────────┐
410
- │ Name │ Ops / sec │
411
- ├────────────────────┼──────────────┤
412
- │ fast-copy │ 86875.694416 │
413
- ├────────────────────┼──────────────┤
414
- │ clone │ 73525.671381 │
415
- ├────────────────────┼──────────────┤
416
- │ lodash.cloneDeep │ 63280.563976 │
417
- ├────────────────────┼──────────────┤
418
- │ fast-clone │ 52991.064016 │
419
- ├────────────────────┼──────────────┤
420
- │ ramda │ 31770.652317 │
421
- ├────────────────────┼──────────────┤
422
- │ deepclone │ 24253.795114 │
423
- ├────────────────────┼──────────────┤
424
- │ fast-copy (strict) │ 19112.538416 │
425
- └────────────────────┴──────────────┘
409
+ ┌────────────────────┬───────────────┐
410
+ │ Name │ Ops / sec │
411
+ ├────────────────────┼───────────────┤
412
+ │ fast-copy │ 134318.379975 │
413
+ ├────────────────────┼───────────────┤
414
+ │ lodash.cloneDeep │ 62990.463065 │
415
+ ├────────────────────┼───────────────┤
416
+ │ clone │ 59386.329843 │
417
+ ├────────────────────┼───────────────┤
418
+ │ fast-clone │ 53886.995853 │
419
+ ├────────────────────┼───────────────┤
420
+ │ ramda │ 27974.450157 │
421
+ ├────────────────────┼───────────────┤
422
+ │ deepclone │ 23498.796755 │
423
+ ├────────────────────┼───────────────┤
424
+ │ fast-copy (strict) │ 18955.802659 │
425
+ └────────────────────┴───────────────┘
426
426
  Fastest was "fast-copy".
427
427
  ```
@@ -38,7 +38,7 @@ function getTag(value) {
38
38
  }
39
39
 
40
40
  // eslint-disable-next-line @typescript-eslint/unbound-method
41
- const { hasOwnProperty, propertyIsEnumerable } = Object.prototype;
41
+ const { propertyIsEnumerable } = Object.prototype;
42
42
  function copyOwnDescriptor(original, clone, property, state) {
43
43
  const ownDescriptor = Object.getOwnPropertyDescriptor(original, property) || {
44
44
  configurable: true,
@@ -63,16 +63,14 @@ function copyOwnDescriptor(original, clone, property, state) {
63
63
  }
64
64
  }
65
65
  /**
66
- * Striclty copy all properties contained on the object.
66
+ * Strictly copy all properties contained on the object.
67
67
  */
68
68
  function copyOwnPropertiesStrict(value, clone, state) {
69
- const names = Object.getOwnPropertyNames(value);
70
- for (let index = 0; index < names.length; ++index) {
71
- copyOwnDescriptor(value, clone, names[index], state);
69
+ for (const name of Object.getOwnPropertyNames(value)) {
70
+ copyOwnDescriptor(value, clone, name, state);
72
71
  }
73
- const symbols = Object.getOwnPropertySymbols(value);
74
- for (let index = 0; index < symbols.length; ++index) {
75
- copyOwnDescriptor(value, clone, symbols[index], state);
72
+ for (const symbol of Object.getOwnPropertySymbols(value)) {
73
+ copyOwnDescriptor(value, clone, symbol, state);
76
74
  }
77
75
  return clone;
78
76
  }
@@ -128,9 +126,9 @@ function copyMapLoose(map, state) {
128
126
  const clone = new state.Constructor();
129
127
  // set in the cache immediately to be able to reuse the object recursively
130
128
  state.cache.set(map, clone);
131
- map.forEach((value, key) => {
129
+ for (const [key, value] of map) {
132
130
  clone.set(key, state.copier(value, state));
133
- });
131
+ }
134
132
  return clone;
135
133
  }
136
134
  /**
@@ -146,14 +144,10 @@ function copyObjectLoose(object, state) {
146
144
  const clone = getCleanClone(state.prototype);
147
145
  // set in the cache immediately to be able to reuse the object recursively
148
146
  state.cache.set(object, clone);
149
- for (const key in object) {
150
- if (hasOwnProperty.call(object, key)) {
151
- clone[key] = state.copier(object[key], state);
152
- }
147
+ for (const key of Object.keys(object)) {
148
+ clone[key] = state.copier(object[key], state);
153
149
  }
154
- const symbols = Object.getOwnPropertySymbols(object);
155
- for (let index = 0; index < symbols.length; ++index) {
156
- const symbol = symbols[index];
150
+ for (const symbol of Object.getOwnPropertySymbols(object)) {
157
151
  if (propertyIsEnumerable.call(object, symbol)) {
158
152
  clone[symbol] = state.copier(object[symbol], state);
159
153
  }
@@ -200,9 +194,9 @@ function copySetLoose(set, state) {
200
194
  const clone = new state.Constructor();
201
195
  // set in the cache immediately to be able to reuse the object recursively
202
196
  state.cache.set(set, clone);
203
- set.forEach((value) => {
197
+ for (const value of set) {
204
198
  clone.add(state.copier(value, state));
205
- });
199
+ }
206
200
  return clone;
207
201
  }
208
202
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../src/utils.ts","../../../src/copier.ts","../../../src/options.ts","../../../src/index.ts"],"sourcesContent":["export interface Cache {\n has: (value: any) => boolean;\n set: (key: any, value: any) => void;\n get: (key: any) => any;\n}\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst toStringFunction = Function.prototype.toString;\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst toStringObject = Object.prototype.toString;\n\n/**\n * Get an empty version of the object with the same prototype it has.\n */\nexport function getCleanClone(prototype: any): any {\n if (!prototype) {\n return Object.create(null);\n }\n\n const Constructor = prototype.constructor;\n\n if (Constructor === Object) {\n return prototype === Object.prototype ? {} : Object.create(prototype as object | null);\n }\n\n if (Constructor && ~toStringFunction.call(Constructor).indexOf('[native code]')) {\n try {\n return new Constructor();\n } catch {\n // Ignore\n }\n }\n\n return Object.create(prototype as object | null);\n}\n\n/**\n * Get the tag of the value passed, so that the correct copier can be used.\n */\nexport function getTag(value: any): string {\n const stringTag = value[Symbol.toStringTag];\n\n if (stringTag) {\n return stringTag;\n }\n\n const type = toStringObject.call(value);\n\n return type.substring(8, type.length - 1);\n}\n","import { getCleanClone } from './utils.js';\nimport type { Cache } from './utils.ts';\n\nexport type InternalCopier<Value> = (value: Value, state: State) => Value;\n\nexport interface State {\n Constructor: any;\n cache: Cache;\n copier: InternalCopier<any>;\n prototype: any;\n}\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst { hasOwnProperty, propertyIsEnumerable } = Object.prototype;\n\nfunction copyOwnDescriptor<Value extends object>(\n original: Value,\n clone: Value,\n property: string | symbol,\n state: State,\n): void {\n const ownDescriptor = Object.getOwnPropertyDescriptor(original, property) || {\n configurable: true,\n enumerable: true,\n value: original[property as keyof Value],\n writable: true,\n };\n const descriptor =\n ownDescriptor.get || ownDescriptor.set\n ? ownDescriptor\n : {\n configurable: ownDescriptor.configurable,\n enumerable: ownDescriptor.enumerable,\n value: state.copier(ownDescriptor.value, state),\n writable: ownDescriptor.writable,\n };\n\n try {\n Object.defineProperty(clone, property, descriptor);\n } catch {\n // The above can fail on node in extreme edge cases, so fall back to the loose assignment.\n clone[property as keyof Value] = descriptor.get ? descriptor.get() : descriptor.value;\n }\n}\n\n/**\n * Striclty copy all properties contained on the object.\n */\nfunction copyOwnPropertiesStrict<Value extends object>(value: Value, clone: Value, state: State): Value {\n const names = Object.getOwnPropertyNames(value);\n\n for (let index = 0; index < names.length; ++index) {\n copyOwnDescriptor(value, clone, names[index]!, state);\n }\n\n const symbols = Object.getOwnPropertySymbols(value);\n\n for (let index = 0; index < symbols.length; ++index) {\n copyOwnDescriptor(value, clone, symbols[index]!, state);\n }\n\n return clone;\n}\n\n/**\n * Deeply copy the indexed values in the array.\n */\nexport function copyArrayLoose(array: any[], state: State) {\n const clone = new state.Constructor();\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(array, clone);\n\n for (let index = 0; index < array.length; ++index) {\n clone[index] = state.copier(array[index], state);\n }\n\n return clone;\n}\n\n/**\n * Deeply copy the indexed values in the array, as well as any custom properties.\n */\nexport function copyArrayStrict<Value extends any[]>(array: Value, state: State) {\n const clone = new state.Constructor() as Value;\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(array, clone);\n\n return copyOwnPropertiesStrict(array, clone, state);\n}\n\n/**\n * Copy the contents of the ArrayBuffer.\n */\nexport function copyArrayBuffer<Value extends ArrayBufferLike>(arrayBuffer: Value, _state: State): Value {\n return arrayBuffer.slice(0) as Value;\n}\n\n/**\n * Create a new Blob with the contents of the original.\n */\nexport function copyBlob<Value extends Blob>(blob: Value, _state: State): Value {\n return blob.slice(0, blob.size, blob.type) as Value;\n}\n\n/**\n * Create a new DataView with the contents of the original.\n */\nexport function copyDataView<Value extends DataView>(dataView: Value, state: State): Value {\n return new state.Constructor(copyArrayBuffer(dataView.buffer, state));\n}\n\n/**\n * Create a new Date based on the time of the original.\n */\nexport function copyDate<Value extends Date>(date: Value, state: State): Value {\n return new state.Constructor(date.getTime());\n}\n\n/**\n * Deeply copy the keys and values of the original.\n */\nexport function copyMapLoose<Value extends Map<any, any>>(map: Value, state: State): Value {\n const clone = new state.Constructor() as Value;\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(map, clone);\n\n map.forEach((value, key) => {\n clone.set(key, state.copier(value, state));\n });\n\n return clone;\n}\n\n/**\n * Deeply copy the keys and values of the original, as well as any custom properties.\n */\nexport function copyMapStrict<Value extends Map<any, any>>(map: Value, state: State) {\n return copyOwnPropertiesStrict(map, copyMapLoose(map, state), state);\n}\n\n/**\n * Deeply copy the properties (keys and symbols) and values of the original.\n */\nexport function copyObjectLoose<Value extends Record<string, any>>(object: Value, state: State): Value {\n const clone = getCleanClone(state.prototype);\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(object, clone);\n\n for (const key in object) {\n if (hasOwnProperty.call(object, key)) {\n clone[key] = state.copier(object[key], state);\n }\n }\n\n const symbols = Object.getOwnPropertySymbols(object);\n\n for (let index = 0; index < symbols.length; ++index) {\n const symbol = symbols[index]!;\n\n if (propertyIsEnumerable.call(object, symbol)) {\n clone[symbol] = state.copier((object as any)[symbol], state);\n }\n }\n\n return clone;\n}\n\n/**\n * Deeply copy the properties (keys and symbols) and values of the original, as well\n * as any hidden or non-enumerable properties.\n */\nexport function copyObjectStrict<Value extends Record<string, any>>(object: Value, state: State): Value {\n const clone = getCleanClone(state.prototype);\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(object, clone);\n\n return copyOwnPropertiesStrict(object, clone, state);\n}\n\n/**\n * Create a new primitive wrapper from the value of the original.\n */\nexport function copyPrimitiveWrapper<\n // Specifically use the object constructor types\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n Value extends Boolean | Number | String,\n>(primitiveObject: Value, state: State): Value {\n return new state.Constructor(primitiveObject.valueOf());\n}\n\n/**\n * Create a new RegExp based on the value and flags of the original.\n */\nexport function copyRegExp<Value extends RegExp>(regExp: Value, state: State): Value {\n const clone = new state.Constructor(regExp.source, regExp.flags) as Value;\n\n clone.lastIndex = regExp.lastIndex;\n\n return clone;\n}\n\n/**\n * Return the original value (an identity function).\n *\n * @note\n * THis is used for objects that cannot be copied, such as WeakMap.\n */\nexport function copySelf<Value>(value: Value, _state: State): Value {\n return value;\n}\n\n/**\n * Deeply copy the values of the original.\n */\nexport function copySetLoose<Value extends Set<any>>(set: Value, state: State): Value {\n const clone = new state.Constructor() as Value;\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(set, clone);\n\n set.forEach((value) => {\n clone.add(state.copier(value, state));\n });\n\n return clone;\n}\n\n/**\n * Deeply copy the values of the original, as well as any custom properties.\n */\nexport function copySetStrict<Value extends Set<any>>(set: Value, state: State): Value {\n return copyOwnPropertiesStrict(set, copySetLoose(set, state), state);\n}\n","import {\n copyArrayBuffer,\n copyArrayLoose,\n copyArrayStrict,\n copyBlob,\n copyDataView,\n copyDate,\n copyMapLoose,\n copyMapStrict,\n copyObjectLoose,\n copyObjectStrict,\n copyPrimitiveWrapper,\n copyRegExp,\n copySelf,\n copySetLoose,\n copySetStrict,\n} from './copier.js';\nimport type { InternalCopier } from './copier.ts';\nimport type { Cache } from './utils.ts';\n\nexport interface CopierMethods {\n array?: InternalCopier<any[]>;\n arrayBuffer?: InternalCopier<ArrayBuffer>;\n asyncGenerator?: InternalCopier<AsyncGenerator>;\n blob?: InternalCopier<Blob>;\n dataView?: InternalCopier<DataView>;\n date?: InternalCopier<Date>;\n error?: InternalCopier<Error>;\n generator?: InternalCopier<Generator>;\n map?: InternalCopier<Map<any, any>>;\n object?: InternalCopier<Record<string, any>>;\n regExp?: InternalCopier<RegExp>;\n set?: InternalCopier<Set<any>>;\n}\n\ninterface Copiers {\n [key: string]: InternalCopier<any> | undefined;\n\n Arguments: InternalCopier<Record<string, any>>;\n Array: InternalCopier<any[]>;\n ArrayBuffer: InternalCopier<ArrayBuffer>;\n AsyncGenerator: InternalCopier<AsyncGenerator>;\n BigInt64Array: InternalCopier<ArrayBuffer>;\n BigUint64Array: InternalCopier<ArrayBuffer>;\n Blob: InternalCopier<Blob>;\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n Boolean: InternalCopier<Boolean>;\n DataView: InternalCopier<DataView>;\n Date: InternalCopier<Date>;\n Error: InternalCopier<Error>;\n Float32Array: InternalCopier<ArrayBuffer>;\n Float64Array: InternalCopier<ArrayBuffer>;\n Generator: InternalCopier<Generator>;\n Int8Array: InternalCopier<ArrayBuffer>;\n Int16Array: InternalCopier<ArrayBuffer>;\n Int32Array: InternalCopier<ArrayBuffer>;\n Map: InternalCopier<Map<any, any>>;\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n Number: InternalCopier<Number>;\n Object: InternalCopier<Record<string, any>>;\n Promise: InternalCopier<Promise<any>>;\n RegExp: InternalCopier<RegExp>;\n Set: InternalCopier<Set<any>>;\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n String: InternalCopier<String>;\n WeakMap: InternalCopier<WeakMap<any, any>>;\n WeakSet: InternalCopier<WeakSet<any>>;\n Uint8Array: InternalCopier<ArrayBuffer>;\n Uint8ClampedArray: InternalCopier<ArrayBuffer>;\n Uint16Array: InternalCopier<ArrayBuffer>;\n Uint32Array: InternalCopier<ArrayBuffer>;\n}\n\nexport interface CreateCopierOptions {\n createCache?: () => Cache;\n methods?: CopierMethods;\n strict?: boolean;\n}\n\nexport interface RequiredCreateCopierOptions extends Omit<Required<CreateCopierOptions>, 'methods'> {\n copiers: Copiers;\n methods: Required<CopierMethods>;\n}\n\nexport function createDefaultCache(): Cache {\n return new WeakMap();\n}\n\nexport function getOptions({\n createCache: createCacheOverride,\n methods: methodsOverride,\n strict,\n}: CreateCopierOptions): RequiredCreateCopierOptions {\n const defaultMethods = {\n array: strict ? copyArrayStrict : copyArrayLoose,\n arrayBuffer: copyArrayBuffer,\n asyncGenerator: copySelf,\n blob: copyBlob,\n dataView: copyDataView,\n date: copyDate,\n error: copySelf,\n generator: copySelf,\n map: strict ? copyMapStrict : copyMapLoose,\n object: strict ? copyObjectStrict : copyObjectLoose,\n regExp: copyRegExp,\n set: strict ? copySetStrict : copySetLoose,\n };\n\n const methods = methodsOverride ? Object.assign(defaultMethods, methodsOverride) : defaultMethods;\n const copiers = getTagSpecificCopiers(methods);\n const createCache = createCacheOverride || createDefaultCache;\n\n // Extra safety check to ensure that object and array copiers are always provided,\n // avoiding runtime errors.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!copiers.Object || !copiers.Array) {\n throw new Error('An object and array copier must be provided.');\n }\n\n return { createCache, copiers, methods, strict: Boolean(strict) };\n}\n\n/**\n * Get the copiers used for each specific object tag.\n */\nexport function getTagSpecificCopiers(methods: Required<CopierMethods>): Copiers {\n return {\n Arguments: methods.object,\n Array: methods.array,\n ArrayBuffer: methods.arrayBuffer,\n AsyncGenerator: methods.asyncGenerator,\n BigInt64Array: methods.arrayBuffer,\n BigUint64Array: methods.arrayBuffer,\n Blob: methods.blob,\n Boolean: copyPrimitiveWrapper,\n DataView: methods.dataView,\n Date: methods.date,\n Error: methods.error,\n Float32Array: methods.arrayBuffer,\n Float64Array: methods.arrayBuffer,\n Generator: methods.generator,\n Int8Array: methods.arrayBuffer,\n Int16Array: methods.arrayBuffer,\n Int32Array: methods.arrayBuffer,\n Map: methods.map,\n Number: copyPrimitiveWrapper,\n Object: methods.object,\n Promise: copySelf,\n RegExp: methods.regExp,\n Set: methods.set,\n String: copyPrimitiveWrapper,\n WeakMap: copySelf,\n WeakSet: copySelf,\n Uint8Array: methods.arrayBuffer,\n Uint8ClampedArray: methods.arrayBuffer,\n Uint16Array: methods.arrayBuffer,\n Uint32Array: methods.arrayBuffer,\n };\n}\n","import type { State } from './copier.ts';\nimport { getOptions } from './options.js';\nimport type { CreateCopierOptions } from './options.ts';\nimport { getTag } from './utils.js';\n\nexport type { State } from './copier.ts';\nexport type { CreateCopierOptions } from './options.ts';\n\n/**\n * Create a custom copier based on custom options for any of the following:\n * - `createCache` method to create a cache for copied objects\n * - custom copier `methods` for specific object types\n * - `strict` mode to copy all properties with their descriptors\n */\nexport function createCopier(options: CreateCopierOptions = {}) {\n const { createCache, copiers } = getOptions(options);\n const { Array: copyArray, Object: copyObject } = copiers;\n\n function copier(value: any, state: State): any {\n state.prototype = state.Constructor = undefined;\n\n if (!value || typeof value !== 'object') {\n return value;\n }\n\n if (state.cache.has(value)) {\n return state.cache.get(value);\n }\n\n state.prototype = Object.getPrototypeOf(value);\n // Using logical AND for speed, since optional chaining transforms to\n // a local variable usage.\n // eslint-disable-next-line @typescript-eslint/prefer-optional-chain\n state.Constructor = state.prototype && state.prototype.constructor;\n\n // plain objects\n if (!state.Constructor || state.Constructor === Object) {\n return copyObject(value as Record<string, any>, state);\n }\n\n // arrays\n if (Array.isArray(value)) {\n return copyArray(value, state);\n }\n\n const tagSpecificCopier = copiers[getTag(value)];\n\n if (tagSpecificCopier) {\n return tagSpecificCopier(value, state);\n }\n\n return typeof value.then === 'function' ? value : copyObject(value as Record<string, any>, state);\n }\n\n return function copy<Value>(value: Value): Value {\n return copier(value, {\n Constructor: undefined,\n cache: createCache(),\n copier,\n prototype: undefined,\n });\n };\n}\n\n/**\n * Copy an value deeply as much as possible, where strict recreation of object properties\n * are maintained. All properties (including non-enumerable ones) are copied with their\n * original property descriptors on both objects and arrays.\n */\nexport const copyStrict = createCopier({ strict: true });\n\n/**\n * Copy an value deeply as much as possible.\n */\nexport const copy = createCopier();\n"],"names":[],"mappings":";;AAMA;AACA,MAAM,gBAAgB,GAAG,QAAQ,CAAC,SAAS,CAAC,QAAQ;AACpD;AACA,MAAM,cAAc,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ;AAEhD;;AAEG;AACG,SAAU,aAAa,CAAC,SAAc,EAAA;IAC1C,IAAI,CAAC,SAAS,EAAE;AACd,QAAA,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;IAC5B;AAEA,IAAA,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW;AAEzC,IAAA,IAAI,WAAW,KAAK,MAAM,EAAE;AAC1B,QAAA,OAAO,SAAS,KAAK,MAAM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ACtB,KAAK,EAAE,WAAW,EAAE;YACpB,MAAM;AACN,YAAA,SAAS,EAAE,SAAS;AACrB,SAAA,CAAC;AACJ,IAAA,CAAC;AACH;AAEA;;;;AAIG;AACI,MAAM,UAAU,GAAG,YAAY,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE;AAEvD;;AAEG;AACI,MAAM,IAAI,GAAG,YAAY;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/utils.ts","../../../src/copier.ts","../../../src/options.ts","../../../src/index.ts"],"sourcesContent":["export interface Cache {\n has: (value: any) => boolean;\n set: (key: any, value: any) => void;\n get: (key: any) => any;\n}\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst toStringFunction = Function.prototype.toString;\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst toStringObject = Object.prototype.toString;\n\n/**\n * Get an empty version of the object with the same prototype it has.\n */\nexport function getCleanClone(prototype: any): any {\n if (!prototype) {\n return Object.create(null);\n }\n\n const Constructor = prototype.constructor;\n\n if (Constructor === Object) {\n return prototype === Object.prototype ? {} : Object.create(prototype as object | null);\n }\n\n if (Constructor && ~toStringFunction.call(Constructor).indexOf('[native code]')) {\n try {\n return new Constructor();\n } catch {\n // Ignore\n }\n }\n\n return Object.create(prototype as object | null);\n}\n\n/**\n * Get the tag of the value passed, so that the correct copier can be used.\n */\nexport function getTag(value: any): string {\n const stringTag = value[Symbol.toStringTag];\n\n if (stringTag) {\n return stringTag;\n }\n\n const type = toStringObject.call(value);\n\n return type.substring(8, type.length - 1);\n}\n","import { getCleanClone } from './utils.js';\nimport type { Cache } from './utils.ts';\n\nexport type InternalCopier<Value> = (value: Value, state: State) => Value;\n\nexport interface State {\n Constructor: any;\n cache: Cache;\n copier: InternalCopier<any>;\n prototype: any;\n}\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst { propertyIsEnumerable } = Object.prototype;\n\nfunction copyOwnDescriptor<Value extends object>(\n original: Value,\n clone: Value,\n property: string | symbol,\n state: State,\n): void {\n const ownDescriptor = Object.getOwnPropertyDescriptor(original, property) || {\n configurable: true,\n enumerable: true,\n value: original[property as keyof Value],\n writable: true,\n };\n const descriptor =\n ownDescriptor.get || ownDescriptor.set\n ? ownDescriptor\n : {\n configurable: ownDescriptor.configurable,\n enumerable: ownDescriptor.enumerable,\n value: state.copier(ownDescriptor.value, state),\n writable: ownDescriptor.writable,\n };\n\n try {\n Object.defineProperty(clone, property, descriptor);\n } catch {\n // The above can fail on node in extreme edge cases, so fall back to the loose assignment.\n clone[property as keyof Value] = descriptor.get ? descriptor.get() : descriptor.value;\n }\n}\n\n/**\n * Strictly copy all properties contained on the object.\n */\nfunction copyOwnPropertiesStrict<Value extends object>(value: Value, clone: Value, state: State): Value {\n for (const name of Object.getOwnPropertyNames(value)) {\n copyOwnDescriptor(value, clone, name, state);\n }\n\n for (const symbol of Object.getOwnPropertySymbols(value)) {\n copyOwnDescriptor(value, clone, symbol, state);\n }\n\n return clone;\n}\n\n/**\n * Deeply copy the indexed values in the array.\n */\nexport function copyArrayLoose(array: any[], state: State) {\n const clone = new state.Constructor();\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(array, clone);\n\n for (let index = 0; index < array.length; ++index) {\n clone[index] = state.copier(array[index], state);\n }\n\n return clone;\n}\n\n/**\n * Deeply copy the indexed values in the array, as well as any custom properties.\n */\nexport function copyArrayStrict<Value extends any[]>(array: Value, state: State) {\n const clone = new state.Constructor() as Value;\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(array, clone);\n\n return copyOwnPropertiesStrict(array, clone, state);\n}\n\n/**\n * Copy the contents of the ArrayBuffer.\n */\nexport function copyArrayBuffer<Value extends ArrayBufferLike>(arrayBuffer: Value, _state: State): Value {\n return arrayBuffer.slice(0) as Value;\n}\n\n/**\n * Create a new Blob with the contents of the original.\n */\nexport function copyBlob<Value extends Blob>(blob: Value, _state: State): Value {\n return blob.slice(0, blob.size, blob.type) as Value;\n}\n\n/**\n * Create a new DataView with the contents of the original.\n */\nexport function copyDataView<Value extends DataView>(dataView: Value, state: State): Value {\n return new state.Constructor(copyArrayBuffer(dataView.buffer, state));\n}\n\n/**\n * Create a new Date based on the time of the original.\n */\nexport function copyDate<Value extends Date>(date: Value, state: State): Value {\n return new state.Constructor(date.getTime());\n}\n\n/**\n * Deeply copy the keys and values of the original.\n */\nexport function copyMapLoose<Value extends Map<any, any>>(map: Value, state: State): Value {\n const clone = new state.Constructor() as Value;\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(map, clone);\n\n for (const [key, value] of map) {\n clone.set(key, state.copier(value, state));\n }\n\n return clone;\n}\n\n/**\n * Deeply copy the keys and values of the original, as well as any custom properties.\n */\nexport function copyMapStrict<Value extends Map<any, any>>(map: Value, state: State) {\n return copyOwnPropertiesStrict(map, copyMapLoose(map, state), state);\n}\n\n/**\n * Deeply copy the properties (keys and symbols) and values of the original.\n */\nexport function copyObjectLoose<Value extends Record<string, any>>(object: Value, state: State): Value {\n const clone = getCleanClone(state.prototype);\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(object, clone);\n\n for (const key of Object.keys(object)) {\n clone[key] = state.copier(object[key], state);\n }\n\n for (const symbol of Object.getOwnPropertySymbols(object)) {\n if (propertyIsEnumerable.call(object, symbol)) {\n clone[symbol] = state.copier((object as any)[symbol], state);\n }\n }\n\n return clone;\n}\n\n/**\n * Deeply copy the properties (keys and symbols) and values of the original, as well\n * as any hidden or non-enumerable properties.\n */\nexport function copyObjectStrict<Value extends Record<string, any>>(object: Value, state: State): Value {\n const clone = getCleanClone(state.prototype);\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(object, clone);\n\n return copyOwnPropertiesStrict(object, clone, state);\n}\n\n/**\n * Create a new primitive wrapper from the value of the original.\n */\nexport function copyPrimitiveWrapper<\n // Specifically use the object constructor types\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n Value extends Boolean | Number | String,\n>(primitiveObject: Value, state: State): Value {\n return new state.Constructor(primitiveObject.valueOf());\n}\n\n/**\n * Create a new RegExp based on the value and flags of the original.\n */\nexport function copyRegExp<Value extends RegExp>(regExp: Value, state: State): Value {\n const clone = new state.Constructor(regExp.source, regExp.flags) as Value;\n\n clone.lastIndex = regExp.lastIndex;\n\n return clone;\n}\n\n/**\n * Return the original value (an identity function).\n *\n * @note\n * THis is used for objects that cannot be copied, such as WeakMap.\n */\nexport function copySelf<Value>(value: Value, _state: State): Value {\n return value;\n}\n\n/**\n * Deeply copy the values of the original.\n */\nexport function copySetLoose<Value extends Set<any>>(set: Value, state: State): Value {\n const clone = new state.Constructor() as Value;\n\n // set in the cache immediately to be able to reuse the object recursively\n state.cache.set(set, clone);\n\n for (const value of set) {\n clone.add(state.copier(value, state));\n }\n\n return clone;\n}\n\n/**\n * Deeply copy the values of the original, as well as any custom properties.\n */\nexport function copySetStrict<Value extends Set<any>>(set: Value, state: State): Value {\n return copyOwnPropertiesStrict(set, copySetLoose(set, state), state);\n}\n","import {\n copyArrayBuffer,\n copyArrayLoose,\n copyArrayStrict,\n copyBlob,\n copyDataView,\n copyDate,\n copyMapLoose,\n copyMapStrict,\n copyObjectLoose,\n copyObjectStrict,\n copyPrimitiveWrapper,\n copyRegExp,\n copySelf,\n copySetLoose,\n copySetStrict,\n} from './copier.js';\nimport type { InternalCopier } from './copier.ts';\nimport type { Cache } from './utils.ts';\n\nexport interface CopierMethods {\n array?: InternalCopier<any[]>;\n arrayBuffer?: InternalCopier<ArrayBuffer>;\n asyncGenerator?: InternalCopier<AsyncGenerator>;\n blob?: InternalCopier<Blob>;\n dataView?: InternalCopier<DataView>;\n date?: InternalCopier<Date>;\n error?: InternalCopier<Error>;\n generator?: InternalCopier<Generator>;\n map?: InternalCopier<Map<any, any>>;\n object?: InternalCopier<Record<string, any>>;\n regExp?: InternalCopier<RegExp>;\n set?: InternalCopier<Set<any>>;\n}\n\ninterface Copiers {\n [key: string]: InternalCopier<any> | undefined;\n\n Arguments: InternalCopier<Record<string, any>>;\n Array: InternalCopier<any[]>;\n ArrayBuffer: InternalCopier<ArrayBuffer>;\n AsyncGenerator: InternalCopier<AsyncGenerator>;\n BigInt64Array: InternalCopier<ArrayBuffer>;\n BigUint64Array: InternalCopier<ArrayBuffer>;\n Blob: InternalCopier<Blob>;\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n Boolean: InternalCopier<Boolean>;\n DataView: InternalCopier<DataView>;\n Date: InternalCopier<Date>;\n Error: InternalCopier<Error>;\n Float32Array: InternalCopier<ArrayBuffer>;\n Float64Array: InternalCopier<ArrayBuffer>;\n Generator: InternalCopier<Generator>;\n Int8Array: InternalCopier<ArrayBuffer>;\n Int16Array: InternalCopier<ArrayBuffer>;\n Int32Array: InternalCopier<ArrayBuffer>;\n Map: InternalCopier<Map<any, any>>;\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n Number: InternalCopier<Number>;\n Object: InternalCopier<Record<string, any>>;\n Promise: InternalCopier<Promise<any>>;\n RegExp: InternalCopier<RegExp>;\n Set: InternalCopier<Set<any>>;\n // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types\n String: InternalCopier<String>;\n WeakMap: InternalCopier<WeakMap<any, any>>;\n WeakSet: InternalCopier<WeakSet<any>>;\n Uint8Array: InternalCopier<ArrayBuffer>;\n Uint8ClampedArray: InternalCopier<ArrayBuffer>;\n Uint16Array: InternalCopier<ArrayBuffer>;\n Uint32Array: InternalCopier<ArrayBuffer>;\n}\n\nexport interface CreateCopierOptions {\n createCache?: () => Cache;\n methods?: CopierMethods;\n strict?: boolean;\n}\n\nexport interface RequiredCreateCopierOptions extends Omit<Required<CreateCopierOptions>, 'methods'> {\n copiers: Copiers;\n methods: Required<CopierMethods>;\n}\n\nexport function createDefaultCache(): Cache {\n return new WeakMap();\n}\n\nexport function getOptions({\n createCache: createCacheOverride,\n methods: methodsOverride,\n strict,\n}: CreateCopierOptions): RequiredCreateCopierOptions {\n const defaultMethods = {\n array: strict ? copyArrayStrict : copyArrayLoose,\n arrayBuffer: copyArrayBuffer,\n asyncGenerator: copySelf,\n blob: copyBlob,\n dataView: copyDataView,\n date: copyDate,\n error: copySelf,\n generator: copySelf,\n map: strict ? copyMapStrict : copyMapLoose,\n object: strict ? copyObjectStrict : copyObjectLoose,\n regExp: copyRegExp,\n set: strict ? copySetStrict : copySetLoose,\n };\n\n const methods = methodsOverride ? Object.assign(defaultMethods, methodsOverride) : defaultMethods;\n const copiers = getTagSpecificCopiers(methods);\n const createCache = createCacheOverride || createDefaultCache;\n\n // Extra safety check to ensure that object and array copiers are always provided,\n // avoiding runtime errors.\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (!copiers.Object || !copiers.Array) {\n throw new Error('An object and array copier must be provided.');\n }\n\n return { createCache, copiers, methods, strict: Boolean(strict) };\n}\n\n/**\n * Get the copiers used for each specific object tag.\n */\nexport function getTagSpecificCopiers(methods: Required<CopierMethods>): Copiers {\n return {\n Arguments: methods.object,\n Array: methods.array,\n ArrayBuffer: methods.arrayBuffer,\n AsyncGenerator: methods.asyncGenerator,\n BigInt64Array: methods.arrayBuffer,\n BigUint64Array: methods.arrayBuffer,\n Blob: methods.blob,\n Boolean: copyPrimitiveWrapper,\n DataView: methods.dataView,\n Date: methods.date,\n Error: methods.error,\n Float32Array: methods.arrayBuffer,\n Float64Array: methods.arrayBuffer,\n Generator: methods.generator,\n Int8Array: methods.arrayBuffer,\n Int16Array: methods.arrayBuffer,\n Int32Array: methods.arrayBuffer,\n Map: methods.map,\n Number: copyPrimitiveWrapper,\n Object: methods.object,\n Promise: copySelf,\n RegExp: methods.regExp,\n Set: methods.set,\n String: copyPrimitiveWrapper,\n WeakMap: copySelf,\n WeakSet: copySelf,\n Uint8Array: methods.arrayBuffer,\n Uint8ClampedArray: methods.arrayBuffer,\n Uint16Array: methods.arrayBuffer,\n Uint32Array: methods.arrayBuffer,\n };\n}\n","import type { State } from './copier.ts';\nimport { getOptions } from './options.js';\nimport type { CreateCopierOptions } from './options.ts';\nimport { getTag } from './utils.js';\n\nexport type { State } from './copier.ts';\nexport type { CreateCopierOptions } from './options.ts';\n\n/**\n * Create a custom copier based on custom options for any of the following:\n * - `createCache` method to create a cache for copied objects\n * - custom copier `methods` for specific object types\n * - `strict` mode to copy all properties with their descriptors\n */\nexport function createCopier(options: CreateCopierOptions = {}) {\n const { createCache, copiers } = getOptions(options);\n const { Array: copyArray, Object: copyObject } = copiers;\n\n function copier(value: any, state: State): any {\n state.prototype = state.Constructor = undefined;\n\n if (!value || typeof value !== 'object') {\n return value;\n }\n\n if (state.cache.has(value)) {\n return state.cache.get(value);\n }\n\n state.prototype = Object.getPrototypeOf(value);\n // Using logical AND for speed, since optional chaining transforms to\n // a local variable usage.\n // eslint-disable-next-line @typescript-eslint/prefer-optional-chain\n state.Constructor = state.prototype && state.prototype.constructor;\n\n // plain objects\n if (!state.Constructor || state.Constructor === Object) {\n return copyObject(value as Record<string, any>, state);\n }\n\n // arrays\n if (Array.isArray(value)) {\n return copyArray(value, state);\n }\n\n const tagSpecificCopier = copiers[getTag(value)];\n\n if (tagSpecificCopier) {\n return tagSpecificCopier(value, state);\n }\n\n return typeof value.then === 'function' ? value : copyObject(value as Record<string, any>, state);\n }\n\n return function copy<Value>(value: Value): Value {\n return copier(value, {\n Constructor: undefined,\n cache: createCache(),\n copier,\n prototype: undefined,\n });\n };\n}\n\n/**\n * Copy an value deeply as much as possible, where strict recreation of object properties\n * are maintained. All properties (including non-enumerable ones) are copied with their\n * original property descriptors on both objects and arrays.\n */\nexport const copyStrict = createCopier({ strict: true });\n\n/**\n * Copy an value deeply as much as possible.\n */\nexport const copy = createCopier();\n"],"names":[],"mappings":";;AAMA;AACA,MAAM,gBAAgB,GAAG,QAAQ,CAAC,SAAS,CAAC,QAAQ;AACpD;AACA,MAAM,cAAc,GAAG,MAAM,CAAC,SAAS,CAAC,QAAQ;AAEhD;;AAEG;AACG,SAAU,aAAa,CAAC,SAAc,EAAA;IAC1C,IAAI,CAAC,SAAS,EAAE;AACd,QAAA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';
2
- export type { State } from './copier.d.cts';
3
- export type { CreateCopierOptions } from './options.d.cts';
1
+ interface Cache {
2
+ has: (value: any) => boolean;
3
+ set: (key: any, value: any) => void;
4
+ get: (key: any) => any;
5
+ }
6
+
7
+ type InternalCopier<Value> = (value: Value, state: State) => Value;
8
+ interface State {
9
+ Constructor: any;
10
+ cache: Cache;
11
+ copier: InternalCopier<any>;
12
+ prototype: any;
13
+ }
14
+
15
+ interface CopierMethods {
16
+ array?: InternalCopier<any[]>;
17
+ arrayBuffer?: InternalCopier<ArrayBuffer>;
18
+ asyncGenerator?: InternalCopier<AsyncGenerator>;
19
+ blob?: InternalCopier<Blob>;
20
+ dataView?: InternalCopier<DataView>;
21
+ date?: InternalCopier<Date>;
22
+ error?: InternalCopier<Error>;
23
+ generator?: InternalCopier<Generator>;
24
+ map?: InternalCopier<Map<any, any>>;
25
+ object?: InternalCopier<Record<string, any>>;
26
+ regExp?: InternalCopier<RegExp>;
27
+ set?: InternalCopier<Set<any>>;
28
+ }
29
+ interface CreateCopierOptions {
30
+ createCache?: () => Cache;
31
+ methods?: CopierMethods;
32
+ strict?: boolean;
33
+ }
34
+
4
35
  /**
5
36
  * Create a custom copier based on custom options for any of the following:
6
37
  * - `createCache` method to create a cache for copied objects
7
38
  * - custom copier `methods` for specific object types
8
39
  * - `strict` mode to copy all properties with their descriptors
9
40
  */
10
- export declare function createCopier(options?: CreateCopierOptions): <Value>(value: Value) => Value;
41
+ declare function createCopier(options?: CreateCopierOptions): <Value>(value: Value) => Value;
11
42
  /**
12
43
  * Copy an value deeply as much as possible, where strict recreation of object properties
13
44
  * are maintained. All properties (including non-enumerable ones) are copied with their
14
45
  * original property descriptors on both objects and arrays.
15
46
  */
16
- export declare const copyStrict: <Value>(value: Value) => Value;
47
+ declare const copyStrict: <Value>(value: Value) => Value;
17
48
  /**
18
49
  * Copy an value deeply as much as possible.
19
50
  */
20
- export declare const copy: <Value>(value: Value) => Value;
51
+ declare const copy: <Value>(value: Value) => Value;
52
+
53
+ export { copy, copyStrict, createCopier };
54
+ export type { CreateCopierOptions, State };
@@ -1,20 +1,54 @@
1
- import type { CreateCopierOptions } from './options.d.mts';
2
- export type { State } from './copier.d.mts';
3
- export type { CreateCopierOptions } from './options.d.mts';
1
+ interface Cache {
2
+ has: (value: any) => boolean;
3
+ set: (key: any, value: any) => void;
4
+ get: (key: any) => any;
5
+ }
6
+
7
+ type InternalCopier<Value> = (value: Value, state: State) => Value;
8
+ interface State {
9
+ Constructor: any;
10
+ cache: Cache;
11
+ copier: InternalCopier<any>;
12
+ prototype: any;
13
+ }
14
+
15
+ interface CopierMethods {
16
+ array?: InternalCopier<any[]>;
17
+ arrayBuffer?: InternalCopier<ArrayBuffer>;
18
+ asyncGenerator?: InternalCopier<AsyncGenerator>;
19
+ blob?: InternalCopier<Blob>;
20
+ dataView?: InternalCopier<DataView>;
21
+ date?: InternalCopier<Date>;
22
+ error?: InternalCopier<Error>;
23
+ generator?: InternalCopier<Generator>;
24
+ map?: InternalCopier<Map<any, any>>;
25
+ object?: InternalCopier<Record<string, any>>;
26
+ regExp?: InternalCopier<RegExp>;
27
+ set?: InternalCopier<Set<any>>;
28
+ }
29
+ interface CreateCopierOptions {
30
+ createCache?: () => Cache;
31
+ methods?: CopierMethods;
32
+ strict?: boolean;
33
+ }
34
+
4
35
  /**
5
36
  * Create a custom copier based on custom options for any of the following:
6
37
  * - `createCache` method to create a cache for copied objects
7
38
  * - custom copier `methods` for specific object types
8
39
  * - `strict` mode to copy all properties with their descriptors
9
40
  */
10
- export declare function createCopier(options?: CreateCopierOptions): <Value>(value: Value) => Value;
41
+ declare function createCopier(options?: CreateCopierOptions): <Value>(value: Value) => Value;
11
42
  /**
12
43
  * Copy an value deeply as much as possible, where strict recreation of object properties
13
44
  * are maintained. All properties (including non-enumerable ones) are copied with their
14
45
  * original property descriptors on both objects and arrays.
15
46
  */
16
- export declare const copyStrict: <Value>(value: Value) => Value;
47
+ declare const copyStrict: <Value>(value: Value) => Value;
17
48
  /**
18
49
  * Copy an value deeply as much as possible.
19
50
  */
20
- export declare const copy: <Value>(value: Value) => Value;
51
+ declare const copy: <Value>(value: Value) => Value;
52
+
53
+ export { copy, copyStrict, createCopier };
54
+ export type { CreateCopierOptions, State };
@@ -36,7 +36,7 @@ function getTag(value) {
36
36
  }
37
37
 
38
38
  // eslint-disable-next-line @typescript-eslint/unbound-method
39
- const { hasOwnProperty, propertyIsEnumerable } = Object.prototype;
39
+ const { propertyIsEnumerable } = Object.prototype;
40
40
  function copyOwnDescriptor(original, clone, property, state) {
41
41
  const ownDescriptor = Object.getOwnPropertyDescriptor(original, property) || {
42
42
  configurable: true,
@@ -61,16 +61,14 @@ function copyOwnDescriptor(original, clone, property, state) {
61
61
  }
62
62
  }
63
63
  /**
64
- * Striclty copy all properties contained on the object.
64
+ * Strictly copy all properties contained on the object.
65
65
  */
66
66
  function copyOwnPropertiesStrict(value, clone, state) {
67
- const names = Object.getOwnPropertyNames(value);
68
- for (let index = 0; index < names.length; ++index) {
69
- copyOwnDescriptor(value, clone, names[index], state);
67
+ for (const name of Object.getOwnPropertyNames(value)) {
68
+ copyOwnDescriptor(value, clone, name, state);
70
69
  }
71
- const symbols = Object.getOwnPropertySymbols(value);
72
- for (let index = 0; index < symbols.length; ++index) {
73
- copyOwnDescriptor(value, clone, symbols[index], state);
70
+ for (const symbol of Object.getOwnPropertySymbols(value)) {
71
+ copyOwnDescriptor(value, clone, symbol, state);
74
72
  }
75
73
  return clone;
76
74
  }
@@ -126,9 +124,9 @@ function copyMapLoose(map, state) {
126
124
  const clone = new state.Constructor();
127
125
  // set in the cache immediately to be able to reuse the object recursively
128
126
  state.cache.set(map, clone);
129
- map.forEach((value, key) => {
127
+ for (const [key, value] of map) {
130
128
  clone.set(key, state.copier(value, state));
131
- });
129
+ }
132
130
  return clone;
133
131
  }
134
132
  /**
@@ -144,14 +142,10 @@ function copyObjectLoose(object, state) {
144
142
  const clone = getCleanClone(state.prototype);
145
143
  // set in the cache immediately to be able to reuse the object recursively
146
144
  state.cache.set(object, clone);
147
- for (const key in object) {
148
- if (hasOwnProperty.call(object, key)) {
149
- clone[key] = state.copier(object[key], state);
150
- }
145
+ for (const key of Object.keys(object)) {
146
+ clone[key] = state.copier(object[key], state);
151
147
  }
152
- const symbols = Object.getOwnPropertySymbols(object);
153
- for (let index = 0; index < symbols.length; ++index) {
154
- const symbol = symbols[index];
148
+ for (const symbol of Object.getOwnPropertySymbols(object)) {
155
149
  if (propertyIsEnumerable.call(object, symbol)) {
156
150
  clone[symbol] = state.copier(object[symbol], state);
157
151
  }
@@ -198,9 +192,9 @@ function copySetLoose(set, state) {
198
192
  const clone = new state.Constructor();
199
193
  // set in the cache immediately to be able to reuse the object recursively
200
194
  state.cache.set(set, clone);
201
- set.forEach((value) => {
195
+ for (const value of set) {
202
196
  clone.add(state.copier(value, state));
203
- });
197
+ }
204
198
  return clone;
205
199
  }
206
200
  /**