@powfix/core-js 0.14.5 → 0.15.0-beta-2

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 (323) hide show
  1. package/dist/client/constants/COORDINATE.js +6 -0
  2. package/dist/client/constants/CRUD.js +19 -0
  3. package/dist/client/constants/DATE.js +22 -0
  4. package/dist/client/constants/DISTANCE.js +14 -0
  5. package/dist/client/constants/DURATION.js +17 -0
  6. package/dist/client/constants/NOT_NULL.js +1 -0
  7. package/dist/client/constants/index.browser.d.ts +6 -0
  8. package/dist/client/constants/index.browser.js +6 -0
  9. package/dist/client/index.browser.d.ts +7 -0
  10. package/dist/client/index.browser.js +7 -0
  11. package/dist/client/interfaces/Coordinate.js +1 -0
  12. package/dist/client/interfaces/Point2.js +1 -0
  13. package/dist/{src → client}/interfaces/Point3.d.ts +1 -1
  14. package/dist/client/interfaces/Point3.js +1 -0
  15. package/dist/client/interfaces/StorageProvider.js +1 -0
  16. package/dist/client/interfaces/index.browser.d.ts +4 -0
  17. package/dist/client/interfaces/index.browser.js +4 -0
  18. package/dist/{src → client}/managers/SessionManager.d.ts +2 -2
  19. package/dist/client/managers/SessionManager.js +127 -0
  20. package/dist/{src → client}/managers/SessionManager.type.d.ts +1 -1
  21. package/dist/client/managers/SessionManager.type.js +1 -0
  22. package/dist/client/managers/index.browser.d.ts +2 -0
  23. package/dist/client/managers/index.browser.js +2 -0
  24. package/dist/client/scripts/base64Polyfill.js +10 -0
  25. package/dist/client/scripts/index.browser.d.ts +1 -0
  26. package/dist/client/scripts/index.browser.js +1 -0
  27. package/dist/client/services/index.browser.d.ts +1 -0
  28. package/dist/client/services/index.browser.js +1 -0
  29. package/dist/{src → client}/services/time/TimeService.d.ts +1 -1
  30. package/dist/client/services/time/TimeService.js +173 -0
  31. package/dist/client/services/time/TimeService.type.js +1 -0
  32. package/dist/client/services/time/index.d.ts +2 -0
  33. package/dist/client/services/time/index.js +2 -0
  34. package/dist/client/types/IntRage.js +1 -0
  35. package/dist/client/types/PartialExcept.js +1 -0
  36. package/dist/client/types/index.browser.d.ts +2 -0
  37. package/dist/client/types/index.browser.js +2 -0
  38. package/dist/client/utils/ArrayUtils.js +26 -0
  39. package/dist/client/utils/AxiosUtils.js +49 -0
  40. package/dist/client/utils/BooleanUtils.js +5 -0
  41. package/dist/client/utils/Calc.js +23 -0
  42. package/dist/{src → client}/utils/CoordinateUtils.d.ts +1 -1
  43. package/dist/client/utils/CoordinateUtils.js +38 -0
  44. package/dist/{src → client}/utils/DateUtils.d.ts +1 -1
  45. package/dist/client/utils/DateUtils.js +303 -0
  46. package/dist/client/utils/JuminNumberUtils.js +46 -0
  47. package/dist/client/utils/NumberUtils.js +21 -0
  48. package/dist/client/utils/ObjectIdUtils.js +20 -0
  49. package/dist/{src → client}/utils/Point3Utils.d.ts +1 -1
  50. package/dist/client/utils/Point3Utils.js +8 -0
  51. package/dist/client/utils/RandomUtils.js +60 -0
  52. package/dist/client/utils/Sequencer.js +141 -0
  53. package/dist/client/utils/StringUtils.js +33 -0
  54. package/dist/{src → client}/utils/UuidUtils.js +2 -6
  55. package/dist/client/utils/Validator.js +114 -0
  56. package/dist/client/utils/global/between.js +3 -0
  57. package/dist/client/utils/global/castArray.js +3 -0
  58. package/dist/client/utils/global/circularDistance.js +11 -0
  59. package/dist/client/utils/global/fallbackIfEqual.js +6 -0
  60. package/dist/client/utils/global/fallbackIfNull.js +4 -0
  61. package/dist/client/utils/global/fallbackIfUndefined.js +4 -0
  62. package/dist/client/utils/global/firstNonNullish.js +10 -0
  63. package/dist/client/utils/global/flat.js +113 -0
  64. package/dist/client/utils/global/index.d.ts +11 -0
  65. package/dist/client/utils/global/index.js +11 -0
  66. package/dist/client/utils/global/processFirstNonNullish.js +8 -0
  67. package/dist/client/utils/global/pureEnum.js +9 -0
  68. package/dist/client/utils/global/sleep.js +1 -0
  69. package/dist/client/utils/index.browser.d.ts +17 -0
  70. package/dist/client/utils/index.browser.js +17 -0
  71. package/dist/client/utils/try-catch/TryCatch.js +74 -0
  72. package/dist/client/utils/try-catch/index.d.ts +1 -0
  73. package/dist/client/utils/try-catch/index.js +1 -0
  74. package/dist/server/constants/COORDINATE.d.ts +7 -0
  75. package/dist/server/constants/CRUD.d.ts +9 -0
  76. package/dist/server/constants/DATE.d.ts +13 -0
  77. package/dist/server/constants/DISTANCE.d.ts +13 -0
  78. package/dist/server/constants/DURATION.d.ts +16 -0
  79. package/dist/server/constants/NOT_NULL.d.ts +1 -0
  80. package/dist/server/constants/index.browser.d.ts +6 -0
  81. package/dist/{src → server}/constants/index.browser.js +6 -6
  82. package/dist/server/constants/index.d.ts +2 -0
  83. package/dist/{src/interfaces → server/constants}/index.js +2 -2
  84. package/dist/server/constants/nodejs/index.d.ts +2 -0
  85. package/dist/{src → server}/constants/nodejs/index.js +2 -2
  86. package/dist/server/index.browser.d.ts +7 -0
  87. package/dist/{src → server}/index.browser.js +7 -7
  88. package/dist/server/index.d.ts +8 -0
  89. package/dist/{src → server}/index.js +8 -8
  90. package/dist/server/interfaces/Coordinate.d.ts +8 -0
  91. package/dist/server/interfaces/Point2.d.ts +4 -0
  92. package/dist/server/interfaces/Point3.d.ts +4 -0
  93. package/dist/server/interfaces/StorageProvider.d.ts +7 -0
  94. package/dist/server/interfaces/index.browser.d.ts +4 -0
  95. package/dist/{src → server}/interfaces/index.browser.js +4 -4
  96. package/dist/server/interfaces/index.d.ts +2 -0
  97. package/dist/{index.js → server/interfaces/index.js} +2 -1
  98. package/dist/server/interfaces/nodejs/db/index.d.ts +1 -0
  99. package/dist/{src/interfaces/nodejs → server/interfaces/nodejs/db}/index.js +1 -1
  100. package/dist/{src → server}/interfaces/nodejs/db/sequelize/Hook.d.ts +2 -2
  101. package/dist/{src → server}/interfaces/nodejs/db/sequelize/HookFn.d.ts +1 -1
  102. package/dist/server/interfaces/nodejs/db/sequelize/UpsertOptions.d.ts +4 -0
  103. package/dist/server/interfaces/nodejs/db/sequelize/index.d.ts +6 -0
  104. package/dist/server/interfaces/nodejs/db/sequelize/index.js +22 -0
  105. package/dist/server/interfaces/nodejs/index.d.ts +1 -0
  106. package/dist/{src/interfaces/nodejs/db → server/interfaces/nodejs}/index.js +1 -1
  107. package/dist/server/managers/SessionManager.d.ts +15 -0
  108. package/dist/server/managers/SessionManager.type.d.ts +9 -0
  109. package/dist/{src → server}/managers/TransactionManager.d.ts +2 -2
  110. package/dist/{src → server}/managers/TransactionManager.js +13 -13
  111. package/dist/{src → server}/managers/TransactionManager.types.d.ts +1 -1
  112. package/dist/server/managers/index.browser.d.ts +2 -0
  113. package/dist/{src → server}/managers/index.browser.js +2 -2
  114. package/dist/server/managers/index.d.ts +2 -0
  115. package/dist/server/managers/index.js +18 -0
  116. package/dist/server/scripts/base64Polyfill.d.ts +1 -0
  117. package/dist/server/scripts/index.browser.d.ts +1 -0
  118. package/dist/{src → server}/scripts/index.browser.js +1 -1
  119. package/dist/server/scripts/index.d.ts +1 -0
  120. package/dist/{src → server}/scripts/index.js +1 -1
  121. package/dist/server/services/index.browser.d.ts +1 -0
  122. package/dist/{src → server}/services/index.browser.js +1 -1
  123. package/dist/server/services/index.d.ts +2 -0
  124. package/dist/{src/constants → server/services}/index.js +2 -2
  125. package/dist/{src → server}/services/redis/RedisPublisher.d.ts +1 -1
  126. package/dist/{src → server}/services/redis/RedisPublisher.js +2 -2
  127. package/dist/{src → server}/services/redis/RedisSubscriber.d.ts +2 -2
  128. package/dist/{src → server}/services/redis/RedisSubscriber.js +5 -5
  129. package/dist/server/services/redis/index.d.ts +3 -0
  130. package/dist/{src → server}/services/redis/index.js +3 -3
  131. package/dist/server/services/time/TimeService.d.ts +31 -0
  132. package/dist/server/services/time/TimeService.type.d.ts +21 -0
  133. package/dist/server/services/time/index.d.ts +2 -0
  134. package/dist/server/services/time/index.js +18 -0
  135. package/dist/server/types/IntRage.d.ts +3 -0
  136. package/dist/server/types/PartialExcept.d.ts +1 -0
  137. package/dist/server/types/index.browser.d.ts +2 -0
  138. package/dist/{index.browser.js → server/types/index.browser.js} +2 -1
  139. package/dist/server/types/index.d.ts +2 -0
  140. package/dist/server/types/index.js +18 -0
  141. package/dist/server/utils/ArrayUtils.d.ts +12 -0
  142. package/dist/{src → server}/utils/ArrayUtils.js +2 -2
  143. package/dist/server/utils/AxiosUtils.d.ts +5 -0
  144. package/dist/server/utils/BooleanUtils.d.ts +1 -0
  145. package/dist/server/utils/Calc.d.ts +4 -0
  146. package/dist/server/utils/CoordinateUtils.d.ts +8 -0
  147. package/dist/server/utils/DateUtils.d.ts +24 -0
  148. package/dist/{src → server}/utils/DateUtils.js +17 -17
  149. package/dist/server/utils/JuminNumberUtils.d.ts +4 -0
  150. package/dist/{src → server}/utils/JuminNumberUtils.js +2 -2
  151. package/dist/server/utils/NumberUtils.d.ts +4 -0
  152. package/dist/server/utils/ObjectIdUtils.d.ts +4 -0
  153. package/dist/{src → server}/utils/ObjectIdUtils.js +3 -3
  154. package/dist/server/utils/Point3Utils.d.ts +4 -0
  155. package/dist/server/utils/RandomUtils.d.ts +8 -0
  156. package/dist/server/utils/Sequencer.d.ts +38 -0
  157. package/dist/{src → server}/utils/Sequencer.js +2 -2
  158. package/dist/server/utils/StringUtils.d.ts +5 -0
  159. package/dist/server/utils/UuidUtils.d.ts +14 -0
  160. package/dist/server/utils/UuidUtils.js +79 -0
  161. package/dist/server/utils/Validator.d.ts +48 -0
  162. package/dist/server/utils/global/between.d.ts +1 -0
  163. package/dist/server/utils/global/castArray.d.ts +1 -0
  164. package/dist/server/utils/global/circularDistance.d.ts +1 -0
  165. package/dist/server/utils/global/fallbackIfEqual.d.ts +1 -0
  166. package/dist/server/utils/global/fallbackIfNull.d.ts +1 -0
  167. package/dist/{src → server}/utils/global/fallbackIfNull.js +2 -2
  168. package/dist/server/utils/global/fallbackIfUndefined.d.ts +1 -0
  169. package/dist/{src → server}/utils/global/fallbackIfUndefined.js +2 -2
  170. package/dist/server/utils/global/firstNonNullish.d.ts +1 -0
  171. package/dist/server/utils/global/flat.d.ts +14 -0
  172. package/dist/server/utils/global/index.d.ts +11 -0
  173. package/dist/server/utils/global/index.js +27 -0
  174. package/dist/server/utils/global/processFirstNonNullish.d.ts +1 -0
  175. package/dist/{src → server}/utils/global/processFirstNonNullish.js +2 -2
  176. package/dist/server/utils/global/pureEnum.d.ts +8 -0
  177. package/dist/server/utils/global/sleep.d.ts +1 -0
  178. package/dist/server/utils/index.browser.d.ts +17 -0
  179. package/dist/server/utils/index.browser.js +33 -0
  180. package/dist/server/utils/index.d.ts +2 -0
  181. package/dist/server/utils/index.js +18 -0
  182. package/dist/{src → server}/utils/nodejs/HookUtils.d.ts +1 -1
  183. package/dist/server/utils/nodejs/index.d.ts +2 -0
  184. package/dist/{src → server}/utils/nodejs/index.js +3 -3
  185. package/dist/{src → server}/utils/nodejs/sequelize-utils/SequelizeUtils.d.ts +1 -1
  186. package/dist/{src → server}/utils/nodejs/sequelize-utils/SequelizeUtils.js +8 -8
  187. package/dist/server/utils/nodejs/sequelize-utils/index.d.ts +1 -0
  188. package/dist/{src → server}/utils/nodejs/sequelize-utils/index.js +2 -2
  189. package/dist/server/utils/try-catch/TryCatch.d.ts +24 -0
  190. package/dist/server/utils/try-catch/index.d.ts +1 -0
  191. package/dist/{src → server}/utils/try-catch/index.js +1 -1
  192. package/package.json +56 -52
  193. package/dist/index.browser.d.ts +0 -1
  194. package/dist/index.d.ts +0 -1
  195. package/dist/src/constants/index.browser.d.ts +0 -6
  196. package/dist/src/constants/index.d.ts +0 -2
  197. package/dist/src/constants/nodejs/index.d.ts +0 -2
  198. package/dist/src/index.browser.d.ts +0 -7
  199. package/dist/src/index.d.ts +0 -8
  200. package/dist/src/interfaces/index.browser.d.ts +0 -4
  201. package/dist/src/interfaces/index.d.ts +0 -2
  202. package/dist/src/interfaces/nodejs/db/index.d.ts +0 -1
  203. package/dist/src/interfaces/nodejs/db/sequelize/UpsertOptions.d.ts +0 -4
  204. package/dist/src/interfaces/nodejs/db/sequelize/index.d.ts +0 -6
  205. package/dist/src/interfaces/nodejs/db/sequelize/index.js +0 -22
  206. package/dist/src/interfaces/nodejs/index.d.ts +0 -1
  207. package/dist/src/managers/index.browser.d.ts +0 -2
  208. package/dist/src/managers/index.d.ts +0 -2
  209. package/dist/src/managers/index.js +0 -18
  210. package/dist/src/scripts/index.browser.d.ts +0 -1
  211. package/dist/src/scripts/index.d.ts +0 -1
  212. package/dist/src/services/index.browser.d.ts +0 -1
  213. package/dist/src/services/index.d.ts +0 -2
  214. package/dist/src/services/index.js +0 -18
  215. package/dist/src/services/redis/index.d.ts +0 -3
  216. package/dist/src/services/time/index.d.ts +0 -2
  217. package/dist/src/services/time/index.js +0 -18
  218. package/dist/src/types/index.browser.d.ts +0 -2
  219. package/dist/src/types/index.browser.js +0 -18
  220. package/dist/src/types/index.d.ts +0 -2
  221. package/dist/src/types/index.js +0 -18
  222. package/dist/src/utils/global/index.d.ts +0 -11
  223. package/dist/src/utils/global/index.js +0 -27
  224. package/dist/src/utils/index.browser.d.ts +0 -17
  225. package/dist/src/utils/index.browser.js +0 -33
  226. package/dist/src/utils/index.d.ts +0 -2
  227. package/dist/src/utils/index.js +0 -18
  228. package/dist/src/utils/nodejs/index.d.ts +0 -2
  229. package/dist/src/utils/nodejs/sequelize-utils/index.d.ts +0 -1
  230. package/dist/src/utils/try-catch/index.d.ts +0 -1
  231. /package/dist/{src → client}/constants/COORDINATE.d.ts +0 -0
  232. /package/dist/{src → client}/constants/CRUD.d.ts +0 -0
  233. /package/dist/{src → client}/constants/DATE.d.ts +0 -0
  234. /package/dist/{src → client}/constants/DISTANCE.d.ts +0 -0
  235. /package/dist/{src → client}/constants/DURATION.d.ts +0 -0
  236. /package/dist/{src → client}/constants/NOT_NULL.d.ts +0 -0
  237. /package/dist/{src → client}/interfaces/Coordinate.d.ts +0 -0
  238. /package/dist/{src → client}/interfaces/Point2.d.ts +0 -0
  239. /package/dist/{src → client}/interfaces/StorageProvider.d.ts +0 -0
  240. /package/dist/{src → client}/scripts/base64Polyfill.d.ts +0 -0
  241. /package/dist/{src → client}/services/time/TimeService.type.d.ts +0 -0
  242. /package/dist/{src → client}/types/IntRage.d.ts +0 -0
  243. /package/dist/{src → client}/types/PartialExcept.d.ts +0 -0
  244. /package/dist/{src → client}/utils/ArrayUtils.d.ts +0 -0
  245. /package/dist/{src → client}/utils/AxiosUtils.d.ts +0 -0
  246. /package/dist/{src → client}/utils/BooleanUtils.d.ts +0 -0
  247. /package/dist/{src → client}/utils/Calc.d.ts +0 -0
  248. /package/dist/{src → client}/utils/JuminNumberUtils.d.ts +0 -0
  249. /package/dist/{src → client}/utils/NumberUtils.d.ts +0 -0
  250. /package/dist/{src → client}/utils/ObjectIdUtils.d.ts +0 -0
  251. /package/dist/{src → client}/utils/RandomUtils.d.ts +0 -0
  252. /package/dist/{src → client}/utils/Sequencer.d.ts +0 -0
  253. /package/dist/{src → client}/utils/StringUtils.d.ts +0 -0
  254. /package/dist/{src → client}/utils/UuidUtils.d.ts +0 -0
  255. /package/dist/{src → client}/utils/Validator.d.ts +0 -0
  256. /package/dist/{src → client}/utils/global/between.d.ts +0 -0
  257. /package/dist/{src → client}/utils/global/castArray.d.ts +0 -0
  258. /package/dist/{src → client}/utils/global/circularDistance.d.ts +0 -0
  259. /package/dist/{src → client}/utils/global/fallbackIfEqual.d.ts +0 -0
  260. /package/dist/{src → client}/utils/global/fallbackIfNull.d.ts +0 -0
  261. /package/dist/{src → client}/utils/global/fallbackIfUndefined.d.ts +0 -0
  262. /package/dist/{src → client}/utils/global/firstNonNullish.d.ts +0 -0
  263. /package/dist/{src → client}/utils/global/flat.d.ts +0 -0
  264. /package/dist/{src → client}/utils/global/processFirstNonNullish.d.ts +0 -0
  265. /package/dist/{src → client}/utils/global/pureEnum.d.ts +0 -0
  266. /package/dist/{src → client}/utils/global/sleep.d.ts +0 -0
  267. /package/dist/{src → client}/utils/try-catch/TryCatch.d.ts +0 -0
  268. /package/dist/{src → server}/constants/COORDINATE.js +0 -0
  269. /package/dist/{src → server}/constants/CRUD.js +0 -0
  270. /package/dist/{src → server}/constants/DATE.js +0 -0
  271. /package/dist/{src → server}/constants/DISTANCE.js +0 -0
  272. /package/dist/{src → server}/constants/DURATION.js +0 -0
  273. /package/dist/{src → server}/constants/NOT_NULL.js +0 -0
  274. /package/dist/{src → server}/constants/nodejs/TransactionManagerLogLevel.d.ts +0 -0
  275. /package/dist/{src → server}/constants/nodejs/TransactionManagerLogLevel.js +0 -0
  276. /package/dist/{src → server}/constants/nodejs/TransactionManagerTimeoutAction.d.ts +0 -0
  277. /package/dist/{src → server}/constants/nodejs/TransactionManagerTimeoutAction.js +0 -0
  278. /package/dist/{src → server}/interfaces/Coordinate.js +0 -0
  279. /package/dist/{src → server}/interfaces/Point2.js +0 -0
  280. /package/dist/{src → server}/interfaces/Point3.js +0 -0
  281. /package/dist/{src → server}/interfaces/StorageProvider.js +0 -0
  282. /package/dist/{src → server}/interfaces/nodejs/db/sequelize/Hook.js +0 -0
  283. /package/dist/{src → server}/interfaces/nodejs/db/sequelize/HookFn.js +0 -0
  284. /package/dist/{src → server}/interfaces/nodejs/db/sequelize/HookType.d.ts +0 -0
  285. /package/dist/{src → server}/interfaces/nodejs/db/sequelize/HookType.js +0 -0
  286. /package/dist/{src → server}/interfaces/nodejs/db/sequelize/ReloadOption.d.ts +0 -0
  287. /package/dist/{src → server}/interfaces/nodejs/db/sequelize/ReloadOption.js +0 -0
  288. /package/dist/{src → server}/interfaces/nodejs/db/sequelize/TransactionOption.d.ts +0 -0
  289. /package/dist/{src → server}/interfaces/nodejs/db/sequelize/TransactionOption.js +0 -0
  290. /package/dist/{src → server}/interfaces/nodejs/db/sequelize/UpsertOptions.js +0 -0
  291. /package/dist/{src → server}/managers/SessionManager.js +0 -0
  292. /package/dist/{src → server}/managers/SessionManager.type.js +0 -0
  293. /package/dist/{src → server}/managers/TransactionManager.types.js +0 -0
  294. /package/dist/{src → server}/scripts/base64Polyfill.js +0 -0
  295. /package/dist/{src → server}/services/redis/RedisClient.d.ts +0 -0
  296. /package/dist/{src → server}/services/redis/RedisClient.js +0 -0
  297. /package/dist/{src → server}/services/time/TimeService.js +0 -0
  298. /package/dist/{src → server}/services/time/TimeService.type.js +0 -0
  299. /package/dist/{src → server}/types/IntRage.js +0 -0
  300. /package/dist/{src → server}/types/PartialExcept.js +0 -0
  301. /package/dist/{src → server}/types/UpsertResult.d.ts +0 -0
  302. /package/dist/{src → server}/types/UpsertResult.js +0 -0
  303. /package/dist/{src → server}/utils/AxiosUtils.js +0 -0
  304. /package/dist/{src → server}/utils/BooleanUtils.js +0 -0
  305. /package/dist/{src → server}/utils/Calc.js +0 -0
  306. /package/dist/{src → server}/utils/CoordinateUtils.js +0 -0
  307. /package/dist/{src → server}/utils/NumberUtils.js +0 -0
  308. /package/dist/{src → server}/utils/Point3Utils.js +0 -0
  309. /package/dist/{src → server}/utils/RandomUtils.js +0 -0
  310. /package/dist/{src → server}/utils/StringUtils.js +0 -0
  311. /package/dist/{src → server}/utils/Validator.js +0 -0
  312. /package/dist/{src → server}/utils/global/between.js +0 -0
  313. /package/dist/{src → server}/utils/global/castArray.js +0 -0
  314. /package/dist/{src → server}/utils/global/circularDistance.js +0 -0
  315. /package/dist/{src → server}/utils/global/fallbackIfEqual.js +0 -0
  316. /package/dist/{src → server}/utils/global/firstNonNullish.js +0 -0
  317. /package/dist/{src → server}/utils/global/flat.js +0 -0
  318. /package/dist/{src → server}/utils/global/pureEnum.js +0 -0
  319. /package/dist/{src → server}/utils/global/sleep.js +0 -0
  320. /package/dist/{src → server}/utils/nodejs/HookUtils.js +0 -0
  321. /package/dist/{src → server}/utils/nodejs/sequelize-utils/types.d.ts +0 -0
  322. /package/dist/{src → server}/utils/nodejs/sequelize-utils/types.js +0 -0
  323. /package/dist/{src → server}/utils/try-catch/TryCatch.js +0 -0
@@ -0,0 +1,6 @@
1
+ export class COORDINATE {
2
+ }
3
+ COORDINATE.LATITUDE_MIN_LENGTH = 1;
4
+ COORDINATE.LATITUDE_MAX_LENGTH = 10;
5
+ COORDINATE.LONGITUDE_MIN_LENGTH = 1;
6
+ COORDINATE.LONGITUDE_MAX_LENGTH = 11;
@@ -0,0 +1,19 @@
1
+ export var CRUD;
2
+ (function (CRUD) {
3
+ CRUD[CRUD["CREATE"] = 1] = "CREATE";
4
+ CRUD[CRUD["READ"] = 2] = "READ";
5
+ CRUD[CRUD["UPDATE"] = 3] = "UPDATE";
6
+ CRUD[CRUD["DELETE"] = 4] = "DELETE";
7
+ })(CRUD || (CRUD = {}));
8
+ (function (CRUD) {
9
+ function toString(crud) {
10
+ switch (crud) {
11
+ case CRUD.CREATE: return 'Create';
12
+ case CRUD.READ: return 'Read';
13
+ case CRUD.UPDATE: return 'Update';
14
+ case CRUD.DELETE: return 'Delete';
15
+ default: throw new Error('Unknown crud: ' + crud);
16
+ }
17
+ }
18
+ CRUD.toString = toString;
19
+ })(CRUD || (CRUD = {}));
@@ -0,0 +1,22 @@
1
+ export class DATE {
2
+ }
3
+ (function (DATE) {
4
+ let FORMAT;
5
+ (function (FORMAT) {
6
+ FORMAT[FORMAT["UNIX"] = 1] = "UNIX";
7
+ FORMAT[FORMAT["SECONDS"] = 2] = "SECONDS";
8
+ FORMAT[FORMAT["MILLISECONDS"] = 3] = "MILLISECONDS";
9
+ FORMAT[FORMAT["ISO_8601"] = 4] = "ISO_8601";
10
+ })(FORMAT = DATE.FORMAT || (DATE.FORMAT = {}));
11
+ (function (FORMAT) {
12
+ function toString(format) {
13
+ switch (format) {
14
+ case FORMAT.UNIX: return 'UNIX';
15
+ case FORMAT.SECONDS: return 'SECONDS';
16
+ case FORMAT.MILLISECONDS: return 'MILLISECONDS';
17
+ case FORMAT.ISO_8601: return 'ISO_8601';
18
+ }
19
+ }
20
+ FORMAT.toString = toString;
21
+ })(FORMAT = DATE.FORMAT || (DATE.FORMAT = {}));
22
+ })(DATE || (DATE = {}));
@@ -0,0 +1,14 @@
1
+ export class DISTANCE {
2
+ }
3
+ (function (DISTANCE) {
4
+ let UNIT;
5
+ (function (UNIT) {
6
+ UNIT["FEET"] = "FEET";
7
+ UNIT["KILOMETERS"] = "KILOMETERS";
8
+ UNIT["MILLIMETERS"] = "MILLIMETERS";
9
+ UNIT["CENTIMETERS"] = "CENTIMETERS";
10
+ UNIT["METERS"] = "METERS";
11
+ UNIT["MILES"] = "MILES";
12
+ UNIT["YARDS"] = "YARDS";
13
+ })(UNIT = DISTANCE.UNIT || (DISTANCE.UNIT = {}));
14
+ })(DISTANCE || (DISTANCE = {}));
@@ -0,0 +1,17 @@
1
+ export class DURATION {
2
+ }
3
+ (function (DURATION) {
4
+ let UNIT;
5
+ (function (UNIT) {
6
+ UNIT["NANOSECONDS"] = "NANOSECONDS";
7
+ UNIT["MICROSECONDS"] = "MICROSECONDS";
8
+ UNIT["MILLISECONDS"] = "MILLISECONDS";
9
+ UNIT["SECONDS"] = "SECONDS";
10
+ UNIT["MINUTES"] = "MINUTES";
11
+ UNIT["HOURS"] = "HOURS";
12
+ UNIT["DAYS"] = "DAYS";
13
+ UNIT["YEARS"] = "YEARS";
14
+ UNIT["DECADES"] = "DECADES";
15
+ UNIT["CENTURIES"] = "CENTURIES";
16
+ })(UNIT = DURATION.UNIT || (DURATION.UNIT = {}));
17
+ })(DURATION || (DURATION = {}));
@@ -0,0 +1 @@
1
+ export const NOT_NULL = Symbol('!null');
@@ -0,0 +1,6 @@
1
+ export * from './COORDINATE.js';
2
+ export * from './CRUD.js';
3
+ export * from './DATE.js';
4
+ export * from './DISTANCE.js';
5
+ export * from './DURATION.js';
6
+ export * from './NOT_NULL.js';
@@ -0,0 +1,6 @@
1
+ export * from './COORDINATE.js';
2
+ export * from './CRUD.js';
3
+ export * from './DATE.js';
4
+ export * from './DISTANCE.js';
5
+ export * from './DURATION.js';
6
+ export * from './NOT_NULL.js';
@@ -0,0 +1,7 @@
1
+ export * from './constants/index.browser.js';
2
+ export * from './interfaces/index.browser.js';
3
+ export * from './managers/index.browser.js';
4
+ export * from './scripts/index.browser.js';
5
+ export * from './services/index.browser.js';
6
+ export * from './types/index.browser.js';
7
+ export * from './utils/index.browser.js';
@@ -0,0 +1,7 @@
1
+ export * from './constants/index.browser.js';
2
+ export * from './interfaces/index.browser.js';
3
+ export * from './managers/index.browser.js';
4
+ export * from './scripts/index.browser.js';
5
+ export * from './services/index.browser.js';
6
+ export * from './types/index.browser.js';
7
+ export * from './utils/index.browser.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,4 @@
1
- import { Point2 } from "./Point2";
1
+ import { Point2 } from "./Point2.js";
2
2
  export interface Point3 extends Point2 {
3
3
  z: number;
4
4
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export * from './Coordinate.js';
2
+ export * from './Point2.js';
3
+ export * from './Point3.js';
4
+ export * from './StorageProvider.js';
@@ -0,0 +1,4 @@
1
+ export * from './Coordinate.js';
2
+ export * from './Point2.js';
3
+ export * from './Point3.js';
4
+ export * from './StorageProvider.js';
@@ -1,7 +1,7 @@
1
1
  import { AxiosInstance } from "axios";
2
- import { StorageProvider } from "../interfaces";
2
+ import { StorageProvider } from "../interfaces/StorageProvider.js";
3
3
  import EventEmitter from 'eventemitter3';
4
- import { SessionManagerEvent, SessionManagerOptions } from "./SessionManager.type";
4
+ import { SessionManagerEvent, SessionManagerOptions } from "./SessionManager.type.js";
5
5
  export declare class SessionManager extends EventEmitter<SessionManagerEvent> {
6
6
  private static readonly DEFAULT_AUTHORIZATION_STORAGE_KEY;
7
7
  protected api: AxiosInstance;
@@ -0,0 +1,127 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { jwtDecode } from "jwt-decode";
11
+ import moment from "moment";
12
+ import EventEmitter from 'eventemitter3';
13
+ export class SessionManager extends EventEmitter {
14
+ constructor(options) {
15
+ super();
16
+ // Init service parameters
17
+ this.api = options.api;
18
+ this.storageProvider = options.storageProvider;
19
+ // Logging
20
+ console.log('SessionManager initialized', Date.now(), options.api);
21
+ }
22
+ get key() {
23
+ try {
24
+ if (this.storageProvider.key) {
25
+ return this.storageProvider.key();
26
+ }
27
+ }
28
+ catch (e) {
29
+ console.error(e);
30
+ }
31
+ return SessionManager.DEFAULT_AUTHORIZATION_STORAGE_KEY;
32
+ }
33
+ hasAuthorization() {
34
+ return __awaiter(this, void 0, void 0, function* () {
35
+ return !!(yield this.getAuthorization());
36
+ });
37
+ }
38
+ getAuthorization() {
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ return this.storageProvider.get(this.key);
41
+ });
42
+ }
43
+ setAuthorization(authorization) {
44
+ return __awaiter(this, void 0, void 0, function* () {
45
+ if (authorization === null) {
46
+ yield this.removeAuthorization();
47
+ return null;
48
+ }
49
+ let nextAuthorization = yield (() => __awaiter(this, void 0, void 0, function* () {
50
+ if (authorization === undefined) {
51
+ return yield this.getAuthorization();
52
+ }
53
+ return authorization;
54
+ }))();
55
+ if (!nextAuthorization) {
56
+ console.log('nextAuthorization is null or undefined');
57
+ return null;
58
+ }
59
+ try {
60
+ // Replace Bearer prefix
61
+ nextAuthorization = nextAuthorization.replace(/^Bearer\s+/, '');
62
+ const decoded = jwtDecode(nextAuthorization);
63
+ if (!decoded) {
64
+ console.warn('JWT decode failed');
65
+ return null;
66
+ }
67
+ console.log('Session:JWT decoded');
68
+ (() => {
69
+ console.log(' - User', decoded.uuid);
70
+ console.log(' - IAT', ...(() => {
71
+ if (!decoded.iat) {
72
+ return [decoded.iat];
73
+ }
74
+ const iat = moment.unix(decoded.iat);
75
+ if (!iat.isValid()) {
76
+ return [decoded.iat];
77
+ }
78
+ return [decoded.iat, iat.format(), iat.diff(Date.now(), 'days'), 'days left'];
79
+ })());
80
+ console.log(' - NBF', ...(() => {
81
+ if (!decoded.nbf) {
82
+ return [decoded.nbf];
83
+ }
84
+ const nbf = moment.unix(decoded.nbf);
85
+ if (!nbf.isValid()) {
86
+ return [decoded.nbf];
87
+ }
88
+ return [decoded.nbf, nbf.format(), nbf.diff(Date.now(), 'days'), 'days left'];
89
+ })());
90
+ console.log(' - EXP', ...(() => {
91
+ if (!decoded.exp) {
92
+ return [decoded.exp];
93
+ }
94
+ const exp = moment.unix(decoded.exp);
95
+ if (!exp.isValid()) {
96
+ return [decoded.exp];
97
+ }
98
+ return [decoded.exp, exp.format(), exp.diff(Date.now(), 'days'), 'days left'];
99
+ })());
100
+ })();
101
+ // AsyncStorage 에 토큰 저장
102
+ yield this.storageProvider.set(this.key, nextAuthorization);
103
+ // API Instance header 설정
104
+ this.api.defaults.headers.common.Authorization = `Bearer ${nextAuthorization}`;
105
+ // Emit
106
+ this.emit('AUTHORIZATION_CHANGED', nextAuthorization);
107
+ // Return
108
+ return nextAuthorization;
109
+ }
110
+ catch (e) {
111
+ console.error(e);
112
+ }
113
+ return null;
114
+ });
115
+ }
116
+ removeAuthorization() {
117
+ return __awaiter(this, void 0, void 0, function* () {
118
+ // API Instance header 에서 토큰 제거
119
+ delete this.api.defaults.headers.common.Authorization;
120
+ // 스토리지에서 authorization 제거
121
+ yield this.storageProvider.remove(this.key);
122
+ // Emit
123
+ this.emit('AUTHORIZATION_CHANGED', null);
124
+ });
125
+ }
126
+ }
127
+ SessionManager.DEFAULT_AUTHORIZATION_STORAGE_KEY = 'AUTHORIZATION';
@@ -1,5 +1,5 @@
1
1
  import { AxiosInstance } from "axios";
2
- import { StorageProvider } from "../interfaces";
2
+ import { StorageProvider } from "../interfaces/StorageProvider.js";
3
3
  export interface SessionManagerOptions {
4
4
  api: AxiosInstance;
5
5
  storageProvider: StorageProvider;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './SessionManager.js';
2
+ export * from './SessionManager.type.js';
@@ -0,0 +1,2 @@
1
+ export * from './SessionManager.js';
2
+ export * from './SessionManager.type.js';
@@ -0,0 +1,10 @@
1
+ import { decode, encode } from 'base-64';
2
+ export const base64Polyfill = () => {
3
+ if (!global.btoa) {
4
+ global.btoa = encode;
5
+ }
6
+ if (!global.atob) {
7
+ global.atob = decode;
8
+ }
9
+ console.log('base64-polyfill initialized', Date.now());
10
+ };
@@ -0,0 +1 @@
1
+ export * from './base64Polyfill.js';
@@ -0,0 +1 @@
1
+ export * from './base64Polyfill.js';
@@ -0,0 +1 @@
1
+ export * from './time/index.js';
@@ -0,0 +1 @@
1
+ export * from './time/index.js';
@@ -1,5 +1,5 @@
1
1
  import EventEmitter from 'eventemitter3';
2
- import type { TimeServiceClientTimeProvider, TimeServiceEvent, TimeServiceNtpResult, TimeServiceOffset, TimeServiceOptions, TimeServiceServerTimeProvider, TimeServiceTimeStamp } from "./TimeService.type";
2
+ import type { TimeServiceClientTimeProvider, TimeServiceEvent, TimeServiceNtpResult, TimeServiceOffset, TimeServiceOptions, TimeServiceServerTimeProvider, TimeServiceTimeStamp } from "./TimeService.type.js";
3
3
  export declare class TimeService extends EventEmitter<TimeServiceEvent> {
4
4
  private syncHandler?;
5
5
  private offset?;
@@ -0,0 +1,173 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import EventEmitter from 'eventemitter3';
11
+ const LOG_TAG = 'TimeService';
12
+ export class TimeService extends EventEmitter {
13
+ static calculateNTPResultOffset(ntpResult) {
14
+ const { t1, t2, t3, t4 } = ntpResult;
15
+ return ((t2 - t1) + (t3 - t4)) / 2;
16
+ }
17
+ constructor(options) {
18
+ super();
19
+ // Options
20
+ this.syncInterval = options === null || options === void 0 ? void 0 : options.syncInterval;
21
+ this.clientTimeProvider = options === null || options === void 0 ? void 0 : options.clientTimeProvider;
22
+ this.serverTimeProvider = options === null || options === void 0 ? void 0 : options.serverTimeProvider;
23
+ // Bind
24
+ this.sync = this.sync.bind(this);
25
+ this.fetchServerNTPResult = this.fetchServerNTPResult.bind(this);
26
+ }
27
+ getOffset(defaultValue) {
28
+ if (this.offset !== undefined) {
29
+ return this.offset;
30
+ }
31
+ if (defaultValue !== undefined) {
32
+ return defaultValue;
33
+ }
34
+ return undefined;
35
+ }
36
+ setOffset(offset) {
37
+ return this.offset = offset;
38
+ }
39
+ getSyncedAt() {
40
+ return this.syncedAt;
41
+ }
42
+ setSyncedAt(syncedAt) {
43
+ return (this.syncedAt = syncedAt);
44
+ }
45
+ getSyncInterval() {
46
+ return this.syncInterval;
47
+ }
48
+ setSyncInterval(interval) {
49
+ this.syncInterval = interval;
50
+ // Emit
51
+ this.emit('SYNC_INTERVAL_CHANGED', interval);
52
+ if (this.syncHandler !== undefined) {
53
+ this.stopSync();
54
+ this.startSync();
55
+ }
56
+ }
57
+ getClientTimeProvider() {
58
+ return this.clientTimeProvider;
59
+ }
60
+ setClientTimeProvider(provider) {
61
+ this.clientTimeProvider = provider !== null && provider !== void 0 ? provider : undefined;
62
+ }
63
+ getClientTime() {
64
+ var _a;
65
+ return (_a = this.getClientTimeProvider()) === null || _a === void 0 ? void 0 : _a();
66
+ }
67
+ getServerTimeProvider() {
68
+ return this.serverTimeProvider;
69
+ }
70
+ setServerTimeProvider(provider) {
71
+ this.serverTimeProvider = provider !== null && provider !== void 0 ? provider : undefined;
72
+ }
73
+ getServerTime() {
74
+ const offset = this.getOffset();
75
+ if (offset == null) {
76
+ return offset;
77
+ }
78
+ const clientTime = this.getClientTime();
79
+ if (clientTime == null) {
80
+ return clientTime;
81
+ }
82
+ return clientTime + offset;
83
+ }
84
+ getTime() {
85
+ var _a, _b;
86
+ return (_b = (_a = this.getServerTime()) !== null && _a !== void 0 ? _a : this.getClientTime()) !== null && _b !== void 0 ? _b : Date.now();
87
+ }
88
+ fetchServerNTPResult(t1) {
89
+ return __awaiter(this, void 0, void 0, function* () {
90
+ try {
91
+ const provider = this.getServerTimeProvider();
92
+ if (typeof provider === 'function') {
93
+ return yield provider(t1);
94
+ }
95
+ }
96
+ catch (e) {
97
+ console.error(e);
98
+ }
99
+ return null;
100
+ });
101
+ }
102
+ sync() {
103
+ return __awaiter(this, void 0, void 0, function* () {
104
+ try {
105
+ // T1 (Client Request Time)
106
+ const requestedAt = Date.now();
107
+ // Fetch server time from server
108
+ const serverNtpResult = yield this.fetchServerNTPResult(requestedAt);
109
+ // Check is null
110
+ if (serverNtpResult === null) {
111
+ console.warn(LOG_TAG, 'Failed to get server time');
112
+ return null;
113
+ }
114
+ // T2 (Server Receive Time)
115
+ const { t2 } = serverNtpResult;
116
+ // Check is not a number
117
+ if (isNaN(Number(t2))) {
118
+ // Not a Number
119
+ console.error(LOG_TAG, 'invalid server time(t2), not a number', t2);
120
+ return null;
121
+ }
122
+ // T3 (Server Transmit Time)
123
+ const { t3 } = serverNtpResult;
124
+ // Check is not a number
125
+ if (isNaN(Number(t3))) {
126
+ // Not a Number
127
+ console.error(LOG_TAG, 'invalid server time(t2), not a number', t2);
128
+ return null;
129
+ }
130
+ // T4 (Client Receive Time)
131
+ const receivedAt = Date.now();
132
+ const ntpResult = {
133
+ t1: requestedAt,
134
+ t2: t2,
135
+ t3: t3,
136
+ t4: receivedAt,
137
+ };
138
+ // Calculate offset
139
+ const offset = TimeService.calculateNTPResultOffset(ntpResult);
140
+ // Save calculated offset
141
+ this.setOffset(offset);
142
+ // Mark synced timestamp
143
+ const syncedAt = Date.now();
144
+ this.setSyncedAt(syncedAt);
145
+ this.emit('SYNCED', offset, syncedAt);
146
+ }
147
+ catch (e) {
148
+ console.error(e);
149
+ }
150
+ return null;
151
+ });
152
+ }
153
+ startSync() {
154
+ if (this.syncHandler != null) {
155
+ console.warn('sync is already started');
156
+ return;
157
+ }
158
+ const syncInterval = this.getSyncInterval();
159
+ if (syncInterval == null || syncInterval <= 0) {
160
+ console.warn('sync is not started', 'syncInterval', syncInterval);
161
+ return;
162
+ }
163
+ this.syncHandler = setInterval(this.sync.bind(this), syncInterval);
164
+ }
165
+ ;
166
+ stopSync() {
167
+ if (this.syncHandler != null) {
168
+ clearInterval(this.syncHandler);
169
+ this.syncHandler = undefined;
170
+ }
171
+ }
172
+ ;
173
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from "./TimeService.js";
2
+ export * from "./TimeService.type.js";
@@ -0,0 +1,2 @@
1
+ export * from "./TimeService.js";
2
+ export * from "./TimeService.type.js";
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './IntRage.js';
2
+ export * from './PartialExcept.js';
@@ -0,0 +1,2 @@
1
+ export * from './IntRage.js';
2
+ export * from './PartialExcept.js';
@@ -0,0 +1,26 @@
1
+ import { castArray } from "./global/index.js";
2
+ export class ArrayUtils {
3
+ static castArray(value) {
4
+ return castArray(value);
5
+ }
6
+ /**
7
+ * 객체를 요소로 가지는 배열에서 가장 큰 값(Property)를 가지는 객체를 반환한다
8
+ * @param e 객체 배열
9
+ * @param key 값을 비교할 Property 키
10
+ */
11
+ static getGreatestObject(e, key) {
12
+ return e.reduce((prev, current) => ((prev[key] > current[key] ? prev : current)));
13
+ }
14
+ static removeDuplicate(arr) {
15
+ return [...new Set(arr)];
16
+ }
17
+ static removeObjectDuplicate(arr, key) {
18
+ return arr.filter((v, i, self) => (i === self.findIndex(e => (e[key] === v[key]))));
19
+ }
20
+ static allValuesEqual(...values) {
21
+ if (values.length === 0) {
22
+ return true;
23
+ }
24
+ return values.every((value) => value === values[0]);
25
+ }
26
+ }
@@ -0,0 +1,49 @@
1
+ export class AxiosUtils {
2
+ static headerValue2String(value) {
3
+ if (value === undefined) {
4
+ return null;
5
+ }
6
+ if (value === null || typeof value === 'string') {
7
+ return value;
8
+ }
9
+ if (Array.isArray(value)) {
10
+ if (value.length > 0) {
11
+ for (const e of value) {
12
+ if (typeof e === 'string') {
13
+ return e;
14
+ }
15
+ }
16
+ // There is no any values having string type
17
+ return null;
18
+ }
19
+ else {
20
+ return null;
21
+ }
22
+ }
23
+ return String(value);
24
+ }
25
+ static headerValue2Number(value) {
26
+ if (value === undefined) {
27
+ return null;
28
+ }
29
+ if (value === null || typeof value === 'number') {
30
+ return value;
31
+ }
32
+ if (Array.isArray(value)) {
33
+ if (value.length > 0) {
34
+ for (const e of value) {
35
+ if (typeof e === 'number') {
36
+ return e;
37
+ }
38
+ }
39
+ // There is no any values having string type
40
+ return null;
41
+ }
42
+ else {
43
+ return null;
44
+ }
45
+ }
46
+ const result = Number(value);
47
+ return isNaN(result) ? null : result;
48
+ }
49
+ }
@@ -0,0 +1,5 @@
1
+ export function parseBoolean(value, defaultValue) {
2
+ if (value === undefined || value === null)
3
+ return defaultValue;
4
+ return (value === 'true' || value === true) || (value === 1 || value === '1');
5
+ }
@@ -0,0 +1,23 @@
1
+ export class Calc {
2
+ static average(...values) {
3
+ const length = values.length;
4
+ if (length === 0) {
5
+ return NaN;
6
+ }
7
+ let sum = 0;
8
+ for (let i = 0; i < length; ++i) {
9
+ sum += values[i];
10
+ }
11
+ return sum / length;
12
+ }
13
+ static median(...values) {
14
+ const len = values.length;
15
+ if (len === 0)
16
+ return NaN;
17
+ const sorted = values.slice().sort((a, b) => a - b); // O(n log n)
18
+ const mid = len >> 1;
19
+ return len % 2 === 0
20
+ ? (sorted[mid - 1] + sorted[mid]) / 2
21
+ : sorted[mid];
22
+ }
23
+ }