aurix-ai 2.7.2 → 2.7.4

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 (286) hide show
  1. package/dist/agent/AgentLoop.d.ts.map +1 -1
  2. package/dist/agent/AgentLoop.js +1 -52
  3. package/dist/agent/AgentLoop.js.map +1 -1
  4. package/dist/cli/App.d.ts.map +1 -1
  5. package/dist/cli/App.js +6 -0
  6. package/dist/cli/App.js.map +1 -1
  7. package/dist/cli/commands.d.ts.map +1 -1
  8. package/dist/cli/commands.js +7 -0
  9. package/dist/cli/commands.js.map +1 -1
  10. package/dist/tools/Browser.d.ts.map +1 -1
  11. package/dist/tools/Browser.js +46 -625
  12. package/dist/tools/Browser.js.map +1 -1
  13. package/dist/tools/captcha/CaptchaRouter.d.ts +6 -0
  14. package/dist/tools/captcha/CaptchaRouter.d.ts.map +1 -0
  15. package/dist/tools/captcha/CaptchaRouter.js +371 -0
  16. package/dist/tools/captcha/CaptchaRouter.js.map +1 -0
  17. package/dist/tools/captcha/RecaptchaSolver.d.ts +2 -0
  18. package/dist/tools/captcha/RecaptchaSolver.d.ts.map +1 -0
  19. package/dist/tools/captcha/RecaptchaSolver.js +1114 -0
  20. package/dist/tools/captcha/RecaptchaSolver.js.map +1 -0
  21. package/dist/tools/captcha/common.d.ts +35 -0
  22. package/dist/tools/captcha/common.d.ts.map +1 -0
  23. package/dist/tools/captcha/common.js +445 -0
  24. package/dist/tools/captcha/common.js.map +1 -0
  25. package/dist/tools/captcha/index.d.ts +5 -0
  26. package/dist/tools/captcha/index.d.ts.map +1 -0
  27. package/dist/tools/captcha/index.js +4 -0
  28. package/dist/tools/captcha/index.js.map +1 -0
  29. package/package.json +1 -2
  30. package/scripts/build.cjs +0 -15
  31. package/scripts/run-task.mjs +86 -0
  32. package/native/token-counter/index.d.ts +0 -7
  33. package/native/token-counter/index.js +0 -316
  34. package/native/token-counter/node_modules/.package-lock.json +0 -568
  35. package/native/token-counter/node_modules/2/array.js +0 -25
  36. package/native/token-counter/node_modules/2/index.js +0 -12
  37. package/native/token-counter/node_modules/2/iterator.js +0 -13
  38. package/native/token-counter/node_modules/2/license.txt +0 -21
  39. package/native/token-counter/node_modules/2/map.js +0 -27
  40. package/native/token-counter/node_modules/2/number.js +0 -109
  41. package/native/token-counter/node_modules/2/object.js +0 -23
  42. package/native/token-counter/node_modules/2/package.json +0 -60
  43. package/native/token-counter/node_modules/2/readme.md +0 -246
  44. package/native/token-counter/node_modules/2/string.js +0 -11
  45. package/native/token-counter/node_modules/2/test.js +0 -520
  46. package/native/token-counter/node_modules/@lamansky/every/index.js +0 -16
  47. package/native/token-counter/node_modules/@lamansky/every/license.txt +0 -21
  48. package/native/token-counter/node_modules/@lamansky/every/package.json +0 -38
  49. package/native/token-counter/node_modules/@lamansky/every/readme.md +0 -46
  50. package/native/token-counter/node_modules/@lamansky/flatten/index.js +0 -5
  51. package/native/token-counter/node_modules/@lamansky/flatten/license.txt +0 -21
  52. package/native/token-counter/node_modules/@lamansky/flatten/package.json +0 -35
  53. package/native/token-counter/node_modules/@lamansky/flatten/readme.md +0 -41
  54. package/native/token-counter/node_modules/@napi-rs/cli/LICENSE +0 -21
  55. package/native/token-counter/node_modules/@napi-rs/cli/README.md +0 -96
  56. package/native/token-counter/node_modules/@napi-rs/cli/package.json +0 -65
  57. package/native/token-counter/node_modules/@napi-rs/cli/scripts/index.js +0 -51371
  58. package/native/token-counter/node_modules/add-counter/index.js +0 -3
  59. package/native/token-counter/node_modules/add-counter/license.txt +0 -21
  60. package/native/token-counter/node_modules/add-counter/package.json +0 -34
  61. package/native/token-counter/node_modules/add-counter/readme.md +0 -36
  62. package/native/token-counter/node_modules/array-pad/LICENSE +0 -22
  63. package/native/token-counter/node_modules/array-pad/README.md +0 -80
  64. package/native/token-counter/node_modules/array-pad/index.js +0 -30
  65. package/native/token-counter/node_modules/array-pad/package.json +0 -28
  66. package/native/token-counter/node_modules/arrify/index.js +0 -8
  67. package/native/token-counter/node_modules/arrify/license +0 -21
  68. package/native/token-counter/node_modules/arrify/package.json +0 -33
  69. package/native/token-counter/node_modules/arrify/readme.md +0 -36
  70. package/native/token-counter/node_modules/case-insensitive/index.js +0 -72
  71. package/native/token-counter/node_modules/case-insensitive/license.txt +0 -21
  72. package/native/token-counter/node_modules/case-insensitive/package.json +0 -39
  73. package/native/token-counter/node_modules/case-insensitive/readme.md +0 -39
  74. package/native/token-counter/node_modules/case-insensitive/test.js +0 -114
  75. package/native/token-counter/node_modules/class-chain/index.js +0 -32
  76. package/native/token-counter/node_modules/class-chain/license.txt +0 -21
  77. package/native/token-counter/node_modules/class-chain/package.json +0 -39
  78. package/native/token-counter/node_modules/class-chain/readme.md +0 -23
  79. package/native/token-counter/node_modules/class-chain/test.js +0 -77
  80. package/native/token-counter/node_modules/copy-own/index.js +0 -10
  81. package/native/token-counter/node_modules/copy-own/license.txt +0 -21
  82. package/native/token-counter/node_modules/copy-own/package.json +0 -37
  83. package/native/token-counter/node_modules/copy-own/readme.md +0 -67
  84. package/native/token-counter/node_modules/def-props/index.js +0 -43
  85. package/native/token-counter/node_modules/def-props/license.txt +0 -21
  86. package/native/token-counter/node_modules/def-props/node_modules/is-obj/index.d.ts +0 -22
  87. package/native/token-counter/node_modules/def-props/node_modules/is-obj/index.js +0 -6
  88. package/native/token-counter/node_modules/def-props/node_modules/is-obj/license +0 -9
  89. package/native/token-counter/node_modules/def-props/node_modules/is-obj/package.json +0 -34
  90. package/native/token-counter/node_modules/def-props/node_modules/is-obj/readme.md +0 -39
  91. package/native/token-counter/node_modules/def-props/package.json +0 -51
  92. package/native/token-counter/node_modules/def-props/readme.md +0 -117
  93. package/native/token-counter/node_modules/empty-iterator/index.js +0 -3
  94. package/native/token-counter/node_modules/empty-iterator/license.txt +0 -21
  95. package/native/token-counter/node_modules/empty-iterator/package.json +0 -33
  96. package/native/token-counter/node_modules/empty-iterator/readme.md +0 -23
  97. package/native/token-counter/node_modules/enforce-range/index.js +0 -15
  98. package/native/token-counter/node_modules/enforce-range/license.txt +0 -21
  99. package/native/token-counter/node_modules/enforce-range/node_modules/2/array.js +0 -43
  100. package/native/token-counter/node_modules/enforce-range/node_modules/2/index.js +0 -10
  101. package/native/token-counter/node_modules/enforce-range/node_modules/2/iterator.js +0 -26
  102. package/native/token-counter/node_modules/enforce-range/node_modules/2/license.txt +0 -21
  103. package/native/token-counter/node_modules/enforce-range/node_modules/2/map.js +0 -47
  104. package/native/token-counter/node_modules/enforce-range/node_modules/2/number.js +0 -33
  105. package/native/token-counter/node_modules/enforce-range/node_modules/2/object.js +0 -61
  106. package/native/token-counter/node_modules/enforce-range/node_modules/2/package.json +0 -41
  107. package/native/token-counter/node_modules/enforce-range/node_modules/2/readme.md +0 -210
  108. package/native/token-counter/node_modules/enforce-range/node_modules/2/string.js +0 -37
  109. package/native/token-counter/node_modules/enforce-range/node_modules/2/test.js +0 -413
  110. package/native/token-counter/node_modules/enforce-range/package.json +0 -36
  111. package/native/token-counter/node_modules/enforce-range/readme.md +0 -53
  112. package/native/token-counter/node_modules/english-list/.travis.yml +0 -6
  113. package/native/token-counter/node_modules/english-list/LICENSE +0 -22
  114. package/native/token-counter/node_modules/english-list/README.md +0 -44
  115. package/native/token-counter/node_modules/english-list/index.js +0 -34
  116. package/native/token-counter/node_modules/english-list/package.json +0 -31
  117. package/native/token-counter/node_modules/english-list/test.log +0 -6
  118. package/native/token-counter/node_modules/errate/index.js +0 -19
  119. package/native/token-counter/node_modules/errate/license.txt +0 -21
  120. package/native/token-counter/node_modules/errate/package.json +0 -39
  121. package/native/token-counter/node_modules/errate/readme.md +0 -79
  122. package/native/token-counter/node_modules/ffn/index.js +0 -9
  123. package/native/token-counter/node_modules/ffn/license.txt +0 -21
  124. package/native/token-counter/node_modules/ffn/package.json +0 -34
  125. package/native/token-counter/node_modules/ffn/readme.md +0 -51
  126. package/native/token-counter/node_modules/get-own-property/index.js +0 -5
  127. package/native/token-counter/node_modules/get-own-property/license.txt +0 -21
  128. package/native/token-counter/node_modules/get-own-property/package.json +0 -31
  129. package/native/token-counter/node_modules/get-own-property/readme.md +0 -22
  130. package/native/token-counter/node_modules/has-duplicates/index.js +0 -11
  131. package/native/token-counter/node_modules/has-duplicates/license.txt +0 -21
  132. package/native/token-counter/node_modules/has-duplicates/package.json +0 -32
  133. package/native/token-counter/node_modules/has-duplicates/readme.md +0 -23
  134. package/native/token-counter/node_modules/has-duplicates/test.js +0 -30
  135. package/native/token-counter/node_modules/if-else-throw/index.js +0 -8
  136. package/native/token-counter/node_modules/if-else-throw/license.txt +0 -21
  137. package/native/token-counter/node_modules/if-else-throw/package.json +0 -37
  138. package/native/token-counter/node_modules/if-else-throw/readme.md +0 -32
  139. package/native/token-counter/node_modules/is-array-of-length/index.js +0 -7
  140. package/native/token-counter/node_modules/is-array-of-length/license.txt +0 -21
  141. package/native/token-counter/node_modules/is-array-of-length/package.json +0 -42
  142. package/native/token-counter/node_modules/is-array-of-length/readme.md +0 -41
  143. package/native/token-counter/node_modules/is-class-of/index.js +0 -7
  144. package/native/token-counter/node_modules/is-class-of/license.txt +0 -21
  145. package/native/token-counter/node_modules/is-class-of/package.json +0 -35
  146. package/native/token-counter/node_modules/is-class-of/readme.md +0 -57
  147. package/native/token-counter/node_modules/is-global-object/index.js +0 -6
  148. package/native/token-counter/node_modules/is-global-object/license.txt +0 -21
  149. package/native/token-counter/node_modules/is-global-object/package.json +0 -34
  150. package/native/token-counter/node_modules/is-global-object/readme.md +0 -22
  151. package/native/token-counter/node_modules/is-instance-of/index.js +0 -28
  152. package/native/token-counter/node_modules/is-instance-of/license.txt +0 -21
  153. package/native/token-counter/node_modules/is-instance-of/package.json +0 -44
  154. package/native/token-counter/node_modules/is-instance-of/readme.md +0 -55
  155. package/native/token-counter/node_modules/is-iterable/index.js +0 -5
  156. package/native/token-counter/node_modules/is-iterable/license +0 -21
  157. package/native/token-counter/node_modules/is-iterable/package.json +0 -30
  158. package/native/token-counter/node_modules/is-iterable/readme.md +0 -23
  159. package/native/token-counter/node_modules/is-nil/LICENSE +0 -21
  160. package/native/token-counter/node_modules/is-nil/README.md +0 -47
  161. package/native/token-counter/node_modules/is-nil/index.js +0 -6
  162. package/native/token-counter/node_modules/is-nil/package.json +0 -46
  163. package/native/token-counter/node_modules/is-obj/index.js +0 -5
  164. package/native/token-counter/node_modules/is-obj/license +0 -21
  165. package/native/token-counter/node_modules/is-obj/package.json +0 -33
  166. package/native/token-counter/node_modules/is-obj/readme.md +0 -34
  167. package/native/token-counter/node_modules/is-object/.eslintignore +0 -1
  168. package/native/token-counter/node_modules/is-object/.eslintrc +0 -5
  169. package/native/token-counter/node_modules/is-object/.nycrc +0 -13
  170. package/native/token-counter/node_modules/is-object/.testem.json +0 -14
  171. package/native/token-counter/node_modules/is-object/CHANGELOG.md +0 -121
  172. package/native/token-counter/node_modules/is-object/LICENSE +0 -19
  173. package/native/token-counter/node_modules/is-object/README.md +0 -48
  174. package/native/token-counter/node_modules/is-object/index.js +0 -5
  175. package/native/token-counter/node_modules/is-object/package.json +0 -78
  176. package/native/token-counter/node_modules/is-object/test/index.js +0 -44
  177. package/native/token-counter/node_modules/is-plain-object/LICENSE +0 -21
  178. package/native/token-counter/node_modules/is-plain-object/README.md +0 -104
  179. package/native/token-counter/node_modules/is-plain-object/index.d.ts +0 -5
  180. package/native/token-counter/node_modules/is-plain-object/index.js +0 -37
  181. package/native/token-counter/node_modules/is-plain-object/package.json +0 -79
  182. package/native/token-counter/node_modules/isobject/LICENSE +0 -21
  183. package/native/token-counter/node_modules/isobject/README.md +0 -122
  184. package/native/token-counter/node_modules/isobject/index.d.ts +0 -5
  185. package/native/token-counter/node_modules/isobject/index.js +0 -12
  186. package/native/token-counter/node_modules/isobject/package.json +0 -74
  187. package/native/token-counter/node_modules/lodash.set/LICENSE +0 -47
  188. package/native/token-counter/node_modules/lodash.set/README.md +0 -18
  189. package/native/token-counter/node_modules/lodash.set/index.js +0 -990
  190. package/native/token-counter/node_modules/lodash.set/package.json +0 -17
  191. package/native/token-counter/node_modules/longest-first/index.js +0 -3
  192. package/native/token-counter/node_modules/longest-first/license.txt +0 -21
  193. package/native/token-counter/node_modules/longest-first/package.json +0 -36
  194. package/native/token-counter/node_modules/longest-first/readme.md +0 -29
  195. package/native/token-counter/node_modules/m-o/index.js +0 -27
  196. package/native/token-counter/node_modules/m-o/license.txt +0 -21
  197. package/native/token-counter/node_modules/m-o/node_modules/new-object/index.js +0 -23
  198. package/native/token-counter/node_modules/m-o/node_modules/new-object/license.txt +0 -21
  199. package/native/token-counter/node_modules/m-o/node_modules/new-object/package.json +0 -40
  200. package/native/token-counter/node_modules/m-o/node_modules/new-object/readme.md +0 -55
  201. package/native/token-counter/node_modules/m-o/package.json +0 -45
  202. package/native/token-counter/node_modules/m-o/readme.md +0 -87
  203. package/native/token-counter/node_modules/map-iter/index.js +0 -6
  204. package/native/token-counter/node_modules/map-iter/license.txt +0 -21
  205. package/native/token-counter/node_modules/map-iter/package.json +0 -40
  206. package/native/token-counter/node_modules/map-iter/readme.md +0 -46
  207. package/native/token-counter/node_modules/new-object/index.js +0 -5
  208. package/native/token-counter/node_modules/new-object/license.txt +0 -21
  209. package/native/token-counter/node_modules/new-object/package.json +0 -49
  210. package/native/token-counter/node_modules/new-object/readme.md +0 -145
  211. package/native/token-counter/node_modules/ofn/index.js +0 -22
  212. package/native/token-counter/node_modules/ofn/license.txt +0 -21
  213. package/native/token-counter/node_modules/ofn/package.json +0 -40
  214. package/native/token-counter/node_modules/ofn/readme.md +0 -63
  215. package/native/token-counter/node_modules/otherwise/index.js +0 -11
  216. package/native/token-counter/node_modules/otherwise/license.txt +0 -21
  217. package/native/token-counter/node_modules/otherwise/package.json +0 -38
  218. package/native/token-counter/node_modules/otherwise/readme.md +0 -29
  219. package/native/token-counter/node_modules/parser-factory/index.js +0 -138
  220. package/native/token-counter/node_modules/parser-factory/license.txt +0 -21
  221. package/native/token-counter/node_modules/parser-factory/node_modules/arrify/index.d.ts +0 -38
  222. package/native/token-counter/node_modules/parser-factory/node_modules/arrify/index.js +0 -23
  223. package/native/token-counter/node_modules/parser-factory/node_modules/arrify/license +0 -9
  224. package/native/token-counter/node_modules/parser-factory/node_modules/arrify/package.json +0 -35
  225. package/native/token-counter/node_modules/parser-factory/node_modules/arrify/readme.md +0 -39
  226. package/native/token-counter/node_modules/parser-factory/package.json +0 -38
  227. package/native/token-counter/node_modules/parser-factory/readme.md +0 -15
  228. package/native/token-counter/node_modules/pfn/index.js +0 -5
  229. package/native/token-counter/node_modules/pfn/license.txt +0 -21
  230. package/native/token-counter/node_modules/pfn/package.json +0 -41
  231. package/native/token-counter/node_modules/pfn/readme.md +0 -111
  232. package/native/token-counter/node_modules/pfn/strict.js +0 -8
  233. package/native/token-counter/node_modules/plainify/index.js +0 -5
  234. package/native/token-counter/node_modules/plainify/license.txt +0 -21
  235. package/native/token-counter/node_modules/plainify/package.json +0 -36
  236. package/native/token-counter/node_modules/plainify/readme.md +0 -47
  237. package/native/token-counter/node_modules/possible-function/changelog.md +0 -7
  238. package/native/token-counter/node_modules/possible-function/index.js +0 -43
  239. package/native/token-counter/node_modules/possible-function/license.txt +0 -21
  240. package/native/token-counter/node_modules/possible-function/package.json +0 -34
  241. package/native/token-counter/node_modules/possible-function/readme.md +0 -77
  242. package/native/token-counter/node_modules/possible-function/test.js +0 -32
  243. package/native/token-counter/node_modules/qfn/index.js +0 -11
  244. package/native/token-counter/node_modules/qfn/license.txt +0 -21
  245. package/native/token-counter/node_modules/qfn/package.json +0 -40
  246. package/native/token-counter/node_modules/qfn/readme.md +0 -45
  247. package/native/token-counter/node_modules/roadblock/index.js +0 -3
  248. package/native/token-counter/node_modules/roadblock/license.txt +0 -21
  249. package/native/token-counter/node_modules/roadblock/package.json +0 -40
  250. package/native/token-counter/node_modules/roadblock/readme.md +0 -59
  251. package/native/token-counter/node_modules/round-to/index.d.ts +0 -56
  252. package/native/token-counter/node_modules/round-to/index.js +0 -37
  253. package/native/token-counter/node_modules/round-to/license +0 -9
  254. package/native/token-counter/node_modules/round-to/package.json +0 -38
  255. package/native/token-counter/node_modules/round-to/readme.md +0 -71
  256. package/native/token-counter/node_modules/rtrim-array/index.js +0 -10
  257. package/native/token-counter/node_modules/rtrim-array/license.txt +0 -21
  258. package/native/token-counter/node_modules/rtrim-array/package.json +0 -41
  259. package/native/token-counter/node_modules/rtrim-array/readme.md +0 -75
  260. package/native/token-counter/node_modules/sbo/index.js +0 -25
  261. package/native/token-counter/node_modules/sbo/license.txt +0 -21
  262. package/native/token-counter/node_modules/sbo/package.json +0 -50
  263. package/native/token-counter/node_modules/sbo/readme.md +0 -105
  264. package/native/token-counter/node_modules/sorp/index.js +0 -3
  265. package/native/token-counter/node_modules/sorp/license.txt +0 -21
  266. package/native/token-counter/node_modules/sorp/package.json +0 -34
  267. package/native/token-counter/node_modules/sorp/readme.md +0 -25
  268. package/native/token-counter/node_modules/trim-call/index.js +0 -6
  269. package/native/token-counter/node_modules/trim-call/license.txt +0 -21
  270. package/native/token-counter/node_modules/trim-call/package.json +0 -40
  271. package/native/token-counter/node_modules/trim-call/readme.md +0 -80
  272. package/native/token-counter/node_modules/type-error/LICENSE +0 -21
  273. package/native/token-counter/node_modules/type-error/README.md +0 -24
  274. package/native/token-counter/node_modules/type-error/index.js +0 -35
  275. package/native/token-counter/node_modules/type-error/package.json +0 -11
  276. package/native/token-counter/node_modules/vfn/index.js +0 -21
  277. package/native/token-counter/node_modules/vfn/license.txt +0 -21
  278. package/native/token-counter/node_modules/vfn/package.json +0 -40
  279. package/native/token-counter/node_modules/vfn/readme.md +0 -81
  280. package/native/token-counter/node_modules/wfn/index.js +0 -43
  281. package/native/token-counter/node_modules/wfn/license.txt +0 -21
  282. package/native/token-counter/node_modules/wfn/package.json +0 -38
  283. package/native/token-counter/node_modules/wfn/readme.md +0 -81
  284. package/native/token-counter/package-lock.json +0 -578
  285. package/native/token-counter/package.json +0 -21
  286. package/native/token-counter/token-counter.linux-x64-gnu.node +0 -0
@@ -1,520 +0,0 @@
1
- 'use strict'
2
-
3
- const assert = require('assert')
4
- const {toArray, toIterator, toMap, toNumber, toObject, toString: toStr} = require('.')
5
-
6
- describe('2', function () {
7
- describe('#toArray()', function () {
8
- it('should convert array to array', function () {
9
- const array = []
10
- assert.strictEqual(toArray(array), array)
11
- })
12
-
13
- it('should convert arguments object to array', function () {
14
- const array = ['first', 'second']
15
-
16
- function argumentsTest () {
17
- const args = toArray(arguments)
18
- assert(Array.isArray(args))
19
- assert.strictEqual(JSON.stringify(args), JSON.stringify(array))
20
- }
21
-
22
- argumentsTest.apply(null, array)
23
- })
24
-
25
- it('should convert Map to array', function () {
26
- const array = [['a', 'b']]
27
- const map = new Map(array)
28
- assert.strictEqual(JSON.stringify(toArray(map)), JSON.stringify(array))
29
- })
30
-
31
- it('should `detectIndexKeys` of array-like Map', function () {
32
- const map = new Map([[0, 'a'], ['1', 'b']])
33
- assert.strictEqual(JSON.stringify(toArray(map, {detectIndexKeys: true})), JSON.stringify(['a', 'b']))
34
- })
35
-
36
- it('should convert Set to array', function () {
37
- const array = [1, 2, 3]
38
- const set = new Set(array)
39
- assert.strictEqual(JSON.stringify(toArray(set)), JSON.stringify(array))
40
- })
41
-
42
- it('should convert object to array of key/value pairs', function () {
43
- const object = {a: 1, b: 2, c: 3}
44
- const array = [['a', 1], ['b', 2], ['c', 3]]
45
- assert.strictEqual(JSON.stringify(toArray(object)), JSON.stringify(array))
46
- })
47
-
48
- it('should `detectIndexKeys` of array-like object', function () {
49
- const object = {0: 'a', 1: 'b'}
50
- assert.strictEqual(JSON.stringify(toArray(object, {detectIndexKeys: true})), JSON.stringify(['a', 'b']))
51
- })
52
-
53
- it('should `detectIndexKeys` of array-like object with nonsequential keys', function () {
54
- const object = {1: 'b', 0: 'a'}
55
- assert.strictEqual(JSON.stringify(toArray(object, {detectIndexKeys: true})), JSON.stringify(['a', 'b']))
56
- })
57
-
58
- it('should convert primitive value to single-element array', function () {
59
- assert.strictEqual(JSON.stringify(toArray('test')), JSON.stringify(['test']))
60
- })
61
-
62
- for (const value of [undefined, null, NaN]) { // eslint-disable-line no-undefined
63
- it(`should convert ${value} to empty array`, function () {
64
- assert.strictEqual(JSON.stringify(toArray(value)), JSON.stringify([]))
65
- })
66
- }
67
- })
68
-
69
- describe('#toIterator()', function () {
70
- it('should convert primitive value to single-run iterator', function () {
71
- const iterator = toIterator('test')
72
- assert.strictEqual(typeof iterator, 'object')
73
- assert.strictEqual(typeof iterator.next, 'function')
74
- let r = iterator.next()
75
- assert.notStrictEqual(r.done, true)
76
- assert.strictEqual(r.value, 'test')
77
- r = iterator.next()
78
- assert.strictEqual(r.done, true)
79
- })
80
-
81
- const valueTests = [
82
- ['should convert array to iterator', [1, 2]],
83
- ['should convert Set to iterator', new Set([1, 2])],
84
- ]
85
-
86
- for (const [description, object] of valueTests) {
87
- it(description, function () {
88
- const iterator = toIterator(object)
89
- assert.strictEqual(typeof iterator, 'object')
90
- assert.strictEqual(typeof iterator.next, 'function')
91
- let r = iterator.next()
92
- assert.notStrictEqual(r.done, true)
93
- assert.strictEqual(r.value, 1)
94
- r = iterator.next()
95
- assert.notStrictEqual(r.done, true)
96
- assert.strictEqual(r.value, 2)
97
- r = iterator.next()
98
- assert.strictEqual(r.done, true)
99
- })
100
- }
101
-
102
- const keyValueTests = [
103
- ['should convert Map to iterator', new Map([['a', 1], ['b', 2]])],
104
- ['should convert object to iterator', {a: 1, b: 2}],
105
- ]
106
-
107
- for (const [description, object] of keyValueTests) {
108
- it(description, function () {
109
- const iterator = toIterator(object)
110
- assert.strictEqual(typeof iterator, 'object')
111
- assert.strictEqual(typeof iterator.next, 'function')
112
- let r = iterator.next()
113
- assert.notStrictEqual(r.done, true)
114
- assert(Array.isArray(r.value))
115
- assert.strictEqual(r.value.length, 2)
116
- assert.strictEqual(r.value[0], 'a')
117
- assert.strictEqual(r.value[1], 1)
118
- r = iterator.next()
119
- assert.notStrictEqual(r.done, true)
120
- assert(Array.isArray(r.value))
121
- assert.strictEqual(r.value.length, 2)
122
- assert.strictEqual(r.value[0], 'b')
123
- assert.strictEqual(r.value[1], 2)
124
- r = iterator.next()
125
- assert.strictEqual(r.done, true)
126
- })
127
- }
128
-
129
- for (const value of [undefined, null, NaN]) { // eslint-disable-line no-undefined
130
- it(`should convert ${value} to empty iterator`, function () {
131
- const iterator = toIterator(value)
132
- assert.strictEqual(typeof iterator, 'object')
133
- const r = iterator.next()
134
- assert.strictEqual(r.done, true)
135
- })
136
- }
137
- })
138
-
139
- describe('#toMap()', function () {
140
- it('should convert Map to Map', function () {
141
- assert(toMap(new Map()) instanceof Map)
142
- })
143
-
144
- it('should convert array of key/value pairs to Map', function () {
145
- const map = toMap([['a', 1], ['b', 2]])
146
- assert.strictEqual(map.get('a'), 1)
147
- assert.strictEqual(map.get('b'), 2)
148
- })
149
-
150
- it('should convert values-only array to Map', function () {
151
- const a = {}
152
- const b = []
153
- const map = toMap([a, b])
154
- assert.strictEqual(map.get(0), a)
155
- assert.strictEqual(map.get(1), b)
156
- })
157
-
158
- it('should `mirror` array across keys and values', function () {
159
- const map = toMap(['100', 200], {mirror: true})
160
- assert.strictEqual(map.get('100'), '100')
161
- assert.strictEqual(map.get(200), 200)
162
- })
163
-
164
- it('should convert object to Map', function () {
165
- const map = toMap({a: 1, b: 2})
166
- assert.strictEqual(map.get('a'), 1)
167
- assert.strictEqual(map.get('b'), 2)
168
- })
169
-
170
- it('should convert primitive value to empty Map', function () {
171
- const map = toMap('not a map')
172
- assert(map instanceof Map)
173
- assert.strictEqual(map.size, 0)
174
- })
175
-
176
- it('should return the provided fallback if input is unconvertible', function () {
177
- const map = toMap('not a map', {elseReturn: new Map([['a', 1], ['b', 2]])})
178
- assert.strictEqual(map.get('a'), 1)
179
- assert.strictEqual(map.get('b'), 2)
180
- })
181
-
182
- it('should throw `elseThrow` if input is unconvertible', function () {
183
- assert.throws(() => { toMap('not a map', {elseThrow: TypeError}) }, TypeError)
184
- })
185
- })
186
-
187
- describe('#toNumber()', function () {
188
- it('should convert number to number', function () {
189
- assert.strictEqual(toNumber(1), 1)
190
- })
191
-
192
- it('should convert Number object to number', function () {
193
- assert.strictEqual(toNumber(new Number(1)), 1) // eslint-disable-line no-new-wrappers
194
- })
195
-
196
- it('should convert integer string to number', function () {
197
- assert.strictEqual(toNumber('100'), 100)
198
- })
199
-
200
- it('should convert integer String object to number', function () {
201
- assert.strictEqual(toNumber(new String('100')), 100) // eslint-disable-line no-new-wrappers
202
- })
203
-
204
- it('should convert float string to number', function () {
205
- assert.strictEqual(toNumber('1.2'), 1.2)
206
- })
207
-
208
- it('should convert negative number string to number', function () {
209
- assert.strictEqual(toNumber('-1.2'), -1.2)
210
- assert.strictEqual(toNumber('−123'), -123)
211
- assert.strictEqual(toNumber('−123K'), -123000)
212
- assert.strictEqual(toNumber('0−123'), 0) // Invalid
213
- assert.strictEqual(toNumber('(123.45)'), -123.45)
214
- assert.strictEqual(toNumber('(-123.45)'), 0) // Invalid
215
- assert.strictEqual(toNumber('123.45)'), 0) // Invalid
216
- assert.strictEqual(toNumber('(123.45'), 0) // Invalid
217
- })
218
-
219
- it('should support digit grouping', function () {
220
- assert.strictEqual(toNumber('1,000'), 1000)
221
- assert.strictEqual(toNumber('1 000'), 1000)
222
- assert.strictEqual(toNumber('1 000'), 1000)
223
- assert.strictEqual(toNumber('1.000'), 1)
224
- assert.strictEqual(toNumber('1.00'), 1)
225
- assert.strictEqual(toNumber('1,234.56'), 1234.56)
226
- assert.strictEqual(toNumber('12,34,567.89'), 1234567.89)
227
- })
228
-
229
- it('should support decimal comma syntax', function () {
230
- assert.strictEqual(toNumber('1.000', {decimalComma: true}), 1000)
231
- assert.strictEqual(toNumber('1,234'), 1234)
232
- assert.strictEqual(toNumber('1,234', {decimalComma: true}), 1.234)
233
- })
234
-
235
- it('should return fallback (default 0) for invalid digit grouping', function () {
236
- assert.strictEqual(toNumber('1 23'), 0)
237
- assert.strictEqual(toNumber('1,234,56'), 0)
238
- assert.strictEqual(toNumber('1,2,3'), 0)
239
- assert.strictEqual(toNumber('1,234,56', {decimalComma: true}), 0)
240
- assert.strictEqual(toNumber('1,234,56789'), 0)
241
- assert.strictEqual(toNumber('1,234.567,890'), 0)
242
- assert.strictEqual(toNumber('1,234 567 890'), 0)
243
- assert.strictEqual(toNumber('1,2,34,567.89'), 0)
244
- assert.strictEqual(toNumber('1,2,,34,567.89'), 0)
245
- assert.strictEqual(toNumber('12,34,56.7'), 0)
246
- })
247
-
248
- it('should allow contrary punctuation if there’s no ambiguity', function () {
249
- assert.strictEqual(toNumber('1,23'), 1.23)
250
- assert.strictEqual(toNumber('1.234,56', {decimalComma: true}), 1234.56)
251
- assert.strictEqual(toNumber('1.234,56'), 1234.56)
252
- assert.strictEqual(toNumber('1234,56'), 1234.56)
253
- assert.strictEqual(toNumber('1,23456'), 1.23456)
254
- assert.strictEqual(toNumber('1,234.00', {decimalComma: true}), 1234)
255
- assert.strictEqual(toNumber('1 234.00', {decimalComma: true}), 1234)
256
- assert.strictEqual(toNumber('1 234.567,890'), 1234567.89)
257
- })
258
-
259
- it('should support `decimalPlacesInInt`', function () {
260
- assert.strictEqual(toNumber('1,23', {decimalPlacesInInt: 2}), 123)
261
- assert.strictEqual(toNumber('1.23', {decimalPlacesInInt: 2}), 123)
262
- assert.strictEqual(toNumber('1.2345', {decimalPlacesInInt: 2}), 123)
263
- })
264
-
265
- it('should support k/g/m/b suffixes', function () {
266
- assert.strictEqual(toNumber('1k'), 1000)
267
- assert.strictEqual(toNumber('2K'), 2000)
268
- assert.strictEqual(toNumber('3g'), 3000)
269
- assert.strictEqual(toNumber('400G'), 400000)
270
- assert.strictEqual(toNumber('5k0'), 0) // Invalid
271
- assert.strictEqual(toNumber('5bk'), 0) // Invalid
272
- assert.strictEqual(toNumber('6m'), 6000000)
273
- assert.strictEqual(toNumber('7M'), 7000000)
274
- assert.strictEqual(toNumber('8b'), 8000000000)
275
- assert.strictEqual(toNumber('9B'), 9000000000)
276
- })
277
-
278
- it('should guess at bad input if `ignoreBadChars` is `true`', function () {
279
- assert.strictEqual(toNumber('--1', {ignoreBadChars: true}), -1)
280
- assert.strictEqual(toNumber('1,234,56789', {ignoreBadChars: true}), 1234.56789)
281
- assert.strictEqual(toNumber('1,234,56789', {ignoreBadChars: true, decimalPlacesInInt: 2}), 123456)
282
- assert.strictEqual(toNumber('1,2,,34,567.89', {ignoreBadChars: true}), 1234567.89)
283
- assert.strictEqual(toNumber('1,000', {ignoreBadChars: true}), 1000)
284
- assert.strictEqual(toNumber('5k0', {ignoreBadChars: true}), 50)
285
- assert.strictEqual(toNumber('5bk', {ignoreBadChars: true}), 5000)
286
- assert.strictEqual(toNumber('5)', {ignoreBadChars: true}), 5)
287
- assert.strictEqual(toNumber('This is 1 number', {ignoreBadChars: true}), 1)
288
- assert.strictEqual(toNumber('This is Infinity!', {finite: false, ignoreBadChars: true}), Infinity)
289
- assert.strictEqual(toNumber('not a number', {ignoreBadChars: true, elseReturn: 100}), 100)
290
- })
291
-
292
- it('should round float to integer if `round` is true', function () {
293
- assert.strictEqual(toNumber(4.7, {round: true}), 5)
294
- })
295
-
296
- it('should return fallback (default 0) for Infinity', function () {
297
- assert.strictEqual(toNumber(Infinity), 0)
298
- })
299
-
300
- it('should allow +Infinity if `finite` is false', function () {
301
- assert.strictEqual(toNumber(Infinity, {finite: false}), Infinity)
302
- })
303
-
304
- it('should allow -Infinity if `finite` is false', function () {
305
- assert.strictEqual(toNumber(-Infinity, {finite: false}), -Infinity)
306
- })
307
-
308
- it('should convert string representations of Infinity', function () {
309
- assert.strictEqual(toNumber('Infinity', {finite: false}), Infinity)
310
- assert.strictEqual(toNumber('infinity', {finite: false}), Infinity)
311
-
312
- assert.strictEqual(toNumber('-Infinity', {finite: false}), -Infinity)
313
- assert.strictEqual(toNumber('−Infinity', {finite: false}), -Infinity)
314
- assert.strictEqual(toNumber('−infinity', {finite: false}), -Infinity)
315
-
316
- assert.strictEqual(toNumber('Infinity'), 0)
317
- assert.strictEqual(toNumber('--Infinity', {finite: false}), 0) // Invalid
318
- })
319
-
320
- it('should return fallback (default 0) for NaN', function () {
321
- assert.strictEqual(toNumber(NaN), 0)
322
- })
323
-
324
- it('should return fallback (default 0) for null', function () {
325
- assert.strictEqual(toNumber(null), 0)
326
- })
327
-
328
- it('should return fallback (default 0) for undefined', function () {
329
- assert.strictEqual(toNumber(undefined), 0) // eslint-disable-line no-undefined
330
- })
331
-
332
- it('should return 0 if number is invalid and no fallback provided', function () {
333
- assert.strictEqual(toNumber('not a number'), 0)
334
- })
335
-
336
- it('should return `elseReturn` if number is unconvertible', function () {
337
- assert.strictEqual(toNumber('not a number', {elseReturn: 2}), 2)
338
- })
339
-
340
- it('should not round `elseReturn` if `round` is true', function () {
341
- assert.strictEqual(toNumber({}, {elseReturn: 3.3, round: true}), 3.3)
342
- })
343
-
344
- it('should throw `elseThrow` if input is unconvertible', function () {
345
- assert.throws(() => { toNumber('not a number', {elseThrow: new RangeError()}) }, RangeError)
346
- })
347
- })
348
-
349
- describe('#toObject()', function () {
350
- it('should convert object to object', function () {
351
- const object = {a: 1, b: 2}
352
- assert.strictEqual(JSON.stringify(toObject(object)), JSON.stringify(object))
353
- })
354
-
355
- it('should convert array of key/value pairs to object', function () {
356
- const object = toObject([['a', 1], ['b', 2]])
357
- assert.strictEqual(object.a, 1)
358
- assert.strictEqual(object.b, 2)
359
- })
360
-
361
- it('should convert array of strings to object with numerical keys', function () {
362
- const object = toObject(['a', 'b'])
363
- assert.strictEqual(object[0], 'a')
364
- assert.strictEqual(object[1], 'b')
365
- })
366
-
367
- it('should `mirror` string array across keys and values', function () {
368
- const object = toObject(['100', '200'], {mirror: true})
369
- assert.strictEqual(object[100], '100')
370
- assert.strictEqual(object[200], '200')
371
- })
372
-
373
- it('should throw if mirrored values would be string-equivalent keys', function () {
374
- toObject(['100', {}], {mirror: true})
375
- assert.throws(() => { toObject(['100', {}, {}], {mirror: true}) })
376
- })
377
-
378
- it('should convert Map to object', function () {
379
- const object = toObject(new Map([['a', 1], ['b', 2]]))
380
- assert.strictEqual(object.a, 1)
381
- assert.strictEqual(object.b, 2)
382
- })
383
-
384
- it('should convert primitive value to empty object', function () {
385
- assert.strictEqual(JSON.stringify(toObject('not an object')), JSON.stringify({}))
386
- })
387
-
388
- it('should return `elseReturn` if input is unconvertible', function () {
389
- assert.strictEqual(JSON.stringify(toObject('not an object', {elseReturn: {a: 1}})), JSON.stringify({a: 1}))
390
- })
391
-
392
- it('should throw error if Map has keys that are not strings/numbers', function () {
393
- assert.throws(() => { toObject(new Map([{}, 'test'])) }, TypeError)
394
- })
395
-
396
- it('should accept property descriptor settings', function () {
397
- const map = new Map([['a', 1], ['b', 2]])
398
-
399
- {
400
- const object = toObject(map, {descriptors: {}})
401
- assert.strictEqual(Object.entries(object).length, 0)
402
- assert.strictEqual(object.a, 1)
403
- assert.strictEqual(object.b, 2)
404
- }
405
-
406
- {
407
- const object = toObject(map, {descriptors: {enumerable: true}})
408
- assert.strictEqual(Object.entries(object).length, 2)
409
- assert.throws(() => { object.a = 3 })
410
- }
411
- })
412
- })
413
-
414
- describe('#toString()', function () {
415
- it('should convert string to string', function () {
416
- assert.strictEqual(toStr('test'), 'test')
417
- })
418
-
419
- it('should convert String object to string', function () {
420
- assert.strictEqual(typeof toStr(new String('test')), typeof 'test') // eslint-disable-line no-new-wrappers
421
- })
422
-
423
- it('should convert number to string', function () {
424
- assert.strictEqual(toStr(-123), '-123')
425
- })
426
-
427
- it('should convert 0 to "0"', function () {
428
- assert.strictEqual(toStr(0), '0')
429
- })
430
-
431
- it('should convert -0 to "0"', function () {
432
- assert.strictEqual(toStr(-0), '0')
433
- })
434
-
435
- it('should convert NaN to empty string', function () {
436
- assert.strictEqual(toStr(NaN), '')
437
- })
438
-
439
- it('should convert Infinity to empty string', function () {
440
- assert.strictEqual(toStr(Infinity), '')
441
- })
442
-
443
- it('should convert true to empty string', function () {
444
- assert.strictEqual(toStr(true), '')
445
- })
446
-
447
- it('should convert false to empty string', function () {
448
- assert.strictEqual(toStr(true), '')
449
- })
450
-
451
- it('should convert null to empty string', function () {
452
- assert.strictEqual(toStr(null), '')
453
- })
454
-
455
- it('should convert undefined to empty string', function () {
456
- assert.strictEqual(toStr(undefined), '') // eslint-disable-line no-undefined
457
- })
458
-
459
- it('should convert function to empty string', function () {
460
- assert.strictEqual(toStr(function () {}), '')
461
- })
462
-
463
- it('should convert array to empty string', function () {
464
- assert.strictEqual(toStr([]), '')
465
- })
466
-
467
- it('should convert plain object to empty string', function () {
468
- assert.strictEqual(toStr({}), '')
469
- })
470
-
471
- it('should convert symbol to empty string', function () {
472
- assert.strictEqual(toStr(Symbol('test')), '')
473
- })
474
-
475
- it('should convert object to string using object’s custom toString() method', function () {
476
- class TestClass {
477
- toString () {
478
- return 'string value'
479
- }
480
- }
481
- const object = new TestClass()
482
- assert.strictEqual(toStr(object), 'string value')
483
- })
484
-
485
- it('should return `elseReturn` if input is unconvertible', function () {
486
- assert.strictEqual(toStr({}, {elseReturn: 'test'}), 'test')
487
- })
488
-
489
- it('should throw `elseThrow` if input is unconvertible', function () {
490
- assert.throws(() => { toStr({}, {elseThrow: true}) }, TypeError)
491
- })
492
- })
493
-
494
- it('should result in object surviving multiple chained conversions', function () {
495
- let data = {a: 1, b: 2}
496
- data = toMap(data)
497
- data = toArray(data)
498
- data = toObject(data)
499
- data = toIterator(data)
500
- data = toArray(data)
501
- data = toMap(data)
502
- data = toObject(data)
503
- assert.strictEqual(Object.keys(data).length, 2)
504
- assert.strictEqual(data.a, 1)
505
- assert.strictEqual(data.b, 2)
506
- })
507
-
508
- it('should result in array surviving multiple chained conversions', function () {
509
- let data = ['first', 'second']
510
- data = toMap(data)
511
- data = toArray(data, {detectIndexKeys: true})
512
- data = toObject(data)
513
- data = toIterator(data)
514
- data = toArray(data, {detectIndexKeys: true})
515
- data = toMap(data)
516
- data = toObject(data)
517
- data = toArray(data, {detectIndexKeys: true})
518
- assert.strictEqual(JSON.stringify(data), JSON.stringify(['first', 'second']))
519
- })
520
- })
@@ -1,16 +0,0 @@
1
- 'use strict'
2
-
3
- const ffn = require('ffn')
4
- const plainify = require('plainify')
5
- const sbo = require('sbo')
6
-
7
- module.exports = sbo(function every (iter, test, options) {
8
- const {vacuously = true} = plainify('vacuously', options)
9
- test = ffn(test)
10
- let empty = true
11
- for (const val of iter) {
12
- empty = false
13
- if (!test(val)) return false
14
- }
15
- return !empty || !!vacuously
16
- })
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright ©2018 John Lamansky
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,38 +0,0 @@
1
- {
2
- "name": "@lamansky/every",
3
- "version": "1.0.0",
4
- "description": "A better Array.prototype.every(). Supports iterables, whitelist testing, and more.",
5
- "keywords": [
6
- "iterable",
7
- "array",
8
- "every",
9
- "test"
10
- ],
11
- "author": "John Lamansky",
12
- "license": "MIT",
13
- "homepage": "https://github.com/lamansky/every",
14
- "repository": "lamansky/every",
15
- "main": "index.js",
16
- "files": [],
17
- "engines": {
18
- "node": ">=6.0.0"
19
- },
20
- "dependencies": {
21
- "ffn": "^2.1.0",
22
- "plainify": "^1.0.0",
23
- "sbo": "^1.1.0"
24
- },
25
- "devDependencies": {
26
- "eslint-config-lamansky": "^1.0.0",
27
- "mocha": "^5.2.0"
28
- },
29
- "scripts": {
30
- "test": "mocha"
31
- },
32
- "eslintConfig": {
33
- "extends": "lamansky",
34
- "env": {
35
- "mocha": true
36
- }
37
- }
38
- }
@@ -1,46 +0,0 @@
1
- # every
2
-
3
- A better `Array.prototype.every()`. Supports iterables, whitelist testing, and more.
4
-
5
- ## Installation
6
-
7
- Requires [Node.js](https://nodejs.org/) 6.0.0 or above.
8
-
9
- ```bash
10
- npm i @lamansky/every
11
- ```
12
-
13
- ## API
14
-
15
- The module exports a single function.
16
-
17
- ### Parameters
18
-
19
- 1. Bindable: `iter` (iterable)
20
- 2. Optional: `test` (function, array, or any): If a function is provided, iterated values will be evaluated on whether `test` returns `true` when passed the value. If an array is provided, iterated values will be evaluated on whether they are contained in the array. If some other value is provided, iterated values will be evaluated on whether they strictly equal `test`. If `test` is omitted, iterated values will be evaluated on whether they are truthy.
21
- 3. Optional: Object argument (_or_ a value for `vacuously`):
22
- * `vacuously` (boolean): What to return if `iter` doesn’t iterate anything. Defaults to `true`. Thiis is for consistency with [`Array.prototype.every()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/every), which interprets any test on an empty array as being [vacuously true](https://en.wikipedia.org/wiki/Vacuous_truth).
23
-
24
- ### Return Values
25
-
26
- * If `iter` doesn’t iterate anything, returns `vacuously` if set, otherwise `true`.
27
- * Otherwise, returns `true` if every one of the iterated values of `iter` passes `test`; otherwise returns `false`.
28
-
29
- ## Example
30
-
31
- ```javascript
32
- const every = require('@lamansky/every')
33
-
34
- const arr = [1, 2, 3]
35
-
36
- every(arr, n => n >= 1) // true
37
- every(arr, [1, 2, 3, 4]) // true
38
-
39
- every(arr, n => n > 1) // false
40
- every(arr, 1) // false
41
- every(arr, [1, 2]) // false
42
- ```
43
-
44
- ## Related
45
-
46
- * [some](https://github.com/lamansky/some)
@@ -1,5 +0,0 @@
1
- 'use strict'
2
-
3
- const f = (arr, {depth: d = Infinity} = {}) => d > 0 ? arr.reduce((r, x) => r.concat(Array.isArray(x) ? f(x, {depth: d - 1}) : [x]), []) : arr
4
-
5
- module.exports = require('sbo')(f)
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright ©2018 John Lamansky
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.