@sparted/shared-library 1.2.0 → 1.2.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 (374) hide show
  1. package/business/picture-spot/index.d.ts +37 -0
  2. package/business/types/campaign.d.ts +12 -0
  3. package/{dist/business → business}/types/content.d.ts +7 -8
  4. package/business/types/content.js.map +1 -0
  5. package/{src/business/types/index.ts → business/types/index.d.ts} +5 -5
  6. package/package.json +1 -1
  7. package/.circleci/config.yml +0 -40
  8. package/.eslintignore +0 -1
  9. package/.eslintrc.json +0 -25
  10. package/.gitignore +0 -37
  11. package/.idea/.gitignore +0 -8
  12. package/.idea/codeStyles/Project.xml +0 -35
  13. package/.idea/codeStyles/codeStyleConfig.xml +0 -5
  14. package/.idea/inspectionProfiles/Project_Default.xml +0 -6
  15. package/.idea/jsLinters/eslint.xml +0 -6
  16. package/.idea/misc.xml +0 -6
  17. package/.idea/modules.xml +0 -8
  18. package/.idea/shared-library.iml +0 -11
  19. package/.idea/vcs.xml +0 -6
  20. package/.idea/workspace.xml +0 -108
  21. package/.prettierrc.json +0 -6
  22. package/CHANGELOG.md +0 -130
  23. package/README.md +0 -26
  24. package/dist/business/picture-spot/index.d.ts +0 -2
  25. package/dist/business/types/content.js.map +0 -1
  26. package/dist/business/types/index.d.ts +0 -4
  27. package/dist/package.json +0 -66
  28. package/global.d.ts +0 -2
  29. package/rollup.config.ts +0 -19
  30. package/src/array/__tests__/array-to-map.test.ts +0 -50
  31. package/src/array/__tests__/get-values-from-keys.test.ts +0 -14
  32. package/src/array/__tests__/inner-join.test.ts +0 -55
  33. package/src/array/__tests__/left-outter-join.test.ts +0 -55
  34. package/src/array/array-to-map.ts +0 -32
  35. package/src/array/get-values-from-keys.ts +0 -3
  36. package/src/array/index.ts +0 -4
  37. package/src/array/inner-join.ts +0 -10
  38. package/src/array/left-outter-join.ts +0 -10
  39. package/src/business/picture-spot/index.ts +0 -3
  40. package/src/business/types/campaign.ts +0 -14
  41. package/src/business/types/content.ts +0 -155
  42. package/src/business/types/media.ts +0 -18
  43. package/src/business/types/multilingual.ts +0 -46
  44. package/src/business/types/thematic.ts +0 -10
  45. package/src/cdn/__tests__/cdn.factory.test.ts +0 -150
  46. package/src/cdn/__tests__/utils.test.ts +0 -528
  47. package/src/cdn/cdn.factory.ts +0 -70
  48. package/src/cdn/index.ts +0 -2
  49. package/src/cdn/types/cdn-factory.type.ts +0 -49
  50. package/src/cdn/types/index.ts +0 -1
  51. package/src/cdn/utils/extract-info-from-url.util.ts +0 -25
  52. package/src/cdn/utils/get-cdn-from-s3-url.util.ts +0 -20
  53. package/src/cdn/utils/get-cdn-url.util.ts +0 -31
  54. package/src/cdn/utils/twicpics-transformations.util.ts +0 -9
  55. package/src/color/__tests__/get-contrast-color.test.ts +0 -22
  56. package/src/color/get-contrast-color.ts +0 -18
  57. package/src/color/index.ts +0 -1
  58. package/src/formatting/__tests__/format-number.test.ts +0 -11
  59. package/src/formatting/format-number.ts +0 -14
  60. package/src/formatting/index.ts +0 -1
  61. package/src/fp/__tests__/run-while.test.ts +0 -29
  62. package/src/fp/index.ts +0 -1
  63. package/src/fp/run-while.ts +0 -54
  64. package/src/http/__tests__/build-search-params.test.ts +0 -17
  65. package/src/http/__tests__/encode-search-object.test.ts +0 -34
  66. package/src/http/__tests__/fetch-with-timeout.test.ts +0 -50
  67. package/src/http/build-search-params.ts +0 -18
  68. package/src/http/encode-search-object.ts +0 -39
  69. package/src/http/fetch-with-timeout.ts +0 -24
  70. package/src/http/index.ts +0 -3
  71. package/src/index.ts +0 -15
  72. package/src/linked-list/__tests__/apply-diff-linked-list.test.ts +0 -103
  73. package/src/linked-list/__tests__/create-linked-list.test.ts +0 -204
  74. package/src/linked-list/__tests__/find-linked-list.test.ts +0 -40
  75. package/src/linked-list/__tests__/get-linked-list.test.ts +0 -28
  76. package/src/linked-list/__tests__/insert-linked-list.test.ts +0 -186
  77. package/src/linked-list/__tests__/linked-list-utils.test.ts +0 -252
  78. package/src/linked-list/__tests__/reduce-linked-list.test.ts +0 -31
  79. package/src/linked-list/__tests__/remove-linked-list.test.ts +0 -129
  80. package/src/linked-list/__tests__/update-linked-list.test.ts +0 -53
  81. package/src/linked-list/__tests__/while-linked-list.test.ts +0 -58
  82. package/src/linked-list/apply-diff-linked-list.ts +0 -35
  83. package/src/linked-list/create-linked-list.ts +0 -79
  84. package/src/linked-list/find-linked-list.ts +0 -26
  85. package/src/linked-list/get-linked-list.ts +0 -9
  86. package/src/linked-list/index.ts +0 -2
  87. package/src/linked-list/insert-linked-list.ts +0 -50
  88. package/src/linked-list/linked-list-utils.ts +0 -143
  89. package/src/linked-list/reduce-linked-list.ts +0 -18
  90. package/src/linked-list/remove-linked-list.ts +0 -36
  91. package/src/linked-list/type.ts +0 -38
  92. package/src/linked-list/update-linked-list.ts +0 -30
  93. package/src/linked-list/while-linked-list.ts +0 -33
  94. package/src/math/__tests__/clamp-number.test.ts +0 -30
  95. package/src/math/__tests__/interpolate.test.ts +0 -28
  96. package/src/math/__tests__/median.test.ts +0 -27
  97. package/src/math/__tests__/number-range.test.ts +0 -59
  98. package/src/math/__tests__/random-number.test.ts +0 -11
  99. package/src/math/clamp-number.ts +0 -8
  100. package/src/math/index.ts +0 -5
  101. package/src/math/interpolate.ts +0 -18
  102. package/src/math/median.ts +0 -21
  103. package/src/math/number-range.ts +0 -16
  104. package/src/math/random-number.ts +0 -10
  105. package/src/object/__tests__/merge-deep.test.ts +0 -56
  106. package/src/object/__tests__/strip-properties-from-object.test.ts +0 -65
  107. package/src/object/index.ts +0 -2
  108. package/src/object/merge-deep.ts +0 -26
  109. package/src/object/strip-properties-from-object.ts +0 -26
  110. package/src/parsing/__tests__/parse-boolean.test.ts +0 -15
  111. package/src/parsing/__tests__/parse-enum.test.ts +0 -19
  112. package/src/parsing/__tests__/parse-number.test.ts +0 -20
  113. package/src/parsing/index.ts +0 -3
  114. package/src/parsing/parse-boolean.ts +0 -10
  115. package/src/parsing/parse-enum.ts +0 -16
  116. package/src/parsing/parse-number.ts +0 -12
  117. package/src/predicates/__tests__/is-function.test.ts +0 -11
  118. package/src/predicates/__tests__/is-null.test.ts +0 -11
  119. package/src/predicates/__tests__/is-object.test.ts +0 -11
  120. package/src/predicates/__tests__/is-primitive.test.ts +0 -42
  121. package/src/predicates/__tests__/is-undefined.test.ts +0 -11
  122. package/src/predicates/__tests__/is-uuid.test.ts +0 -13
  123. package/src/predicates/index.ts +0 -5
  124. package/src/predicates/is-function.ts +0 -3
  125. package/src/predicates/is-null.ts +0 -1
  126. package/src/predicates/is-object.ts +0 -3
  127. package/src/predicates/is-primitive.ts +0 -19
  128. package/src/predicates/is-undefined.ts +0 -3
  129. package/src/predicates/is-uuid.ts +0 -3
  130. package/src/promise/__tests__/delay.test.ts +0 -13
  131. package/src/promise/__tests__/execute-or-resolve-default.test.ts +0 -25
  132. package/src/promise/__tests__/execute-with-delay.test.ts +0 -24
  133. package/src/promise/delay.ts +0 -3
  134. package/src/promise/execute-or-resolve-default.ts +0 -14
  135. package/src/promise/execute-with-delay.ts +0 -6
  136. package/src/promise/index.ts +0 -3
  137. package/src/string/__tests__/is-string-length-within-range.test.ts +0 -23
  138. package/src/string/__tests__/replace-in-template.test.ts +0 -52
  139. package/src/string/index.ts +0 -2
  140. package/src/string/is-string-length-within-range.ts +0 -10
  141. package/src/string/replace-in-template.ts +0 -45
  142. package/src/time/__tests__/convert.test.ts +0 -14
  143. package/src/time/__tests__/format-minutes.test.ts +0 -10
  144. package/src/time/__tests__/get-time-diff-as-string.test.ts +0 -128
  145. package/src/time/constants.ts +0 -4
  146. package/src/time/convert.ts +0 -5
  147. package/src/time/format-minutes.ts +0 -9
  148. package/src/time/get-time-diff-as-string.ts +0 -196
  149. package/src/time/index.ts +0 -4
  150. package/src/types/function.ts +0 -1
  151. package/src/types/general.ts +0 -15
  152. package/src/types/index.ts +0 -4
  153. package/src/types/object.ts +0 -33
  154. package/src/types/search.ts +0 -29
  155. package/tsconfig.json +0 -25
  156. package/yarn-error.log +0 -4133
  157. package/yarn.lock +0 -4045
  158. /package/{dist/_virtual → _virtual}/_tslib.js +0 -0
  159. /package/{dist/_virtual → _virtual}/_tslib.js.map +0 -0
  160. /package/{dist/array → array}/array-to-map.d.ts +0 -0
  161. /package/{dist/array → array}/array-to-map.js +0 -0
  162. /package/{dist/array → array}/array-to-map.js.map +0 -0
  163. /package/{dist/array → array}/get-values-from-keys.d.ts +0 -0
  164. /package/{dist/array → array}/get-values-from-keys.js +0 -0
  165. /package/{dist/array → array}/get-values-from-keys.js.map +0 -0
  166. /package/{dist/array → array}/index.d.ts +0 -0
  167. /package/{dist/array → array}/index.js +0 -0
  168. /package/{dist/array → array}/index.js.map +0 -0
  169. /package/{dist/array → array}/inner-join.d.ts +0 -0
  170. /package/{dist/array → array}/inner-join.js +0 -0
  171. /package/{dist/array → array}/inner-join.js.map +0 -0
  172. /package/{dist/array → array}/left-outter-join.d.ts +0 -0
  173. /package/{dist/array → array}/left-outter-join.js +0 -0
  174. /package/{dist/array → array}/left-outter-join.js.map +0 -0
  175. /package/{dist/business → business}/picture-spot/index.js +0 -0
  176. /package/{dist/business → business}/picture-spot/index.js.map +0 -0
  177. /package/{dist/business → business}/types/content.js +0 -0
  178. /package/{dist/business → business}/types/index.js +0 -0
  179. /package/{dist/business → business}/types/index.js.map +0 -0
  180. /package/{dist/business → business}/types/media.d.ts +0 -0
  181. /package/{dist/business → business}/types/multilingual.d.ts +0 -0
  182. /package/{dist/business → business}/types/multilingual.js +0 -0
  183. /package/{dist/business → business}/types/multilingual.js.map +0 -0
  184. /package/{dist/business → business}/types/thematic.d.ts +0 -0
  185. /package/{dist/cdn → cdn}/cdn.factory.d.ts +0 -0
  186. /package/{dist/cdn → cdn}/cdn.factory.js +0 -0
  187. /package/{dist/cdn → cdn}/cdn.factory.js.map +0 -0
  188. /package/{dist/cdn → cdn}/index.d.ts +0 -0
  189. /package/{dist/cdn → cdn}/index.js +0 -0
  190. /package/{dist/cdn → cdn}/index.js.map +0 -0
  191. /package/{dist/cdn → cdn}/types/cdn-factory.type.d.ts +0 -0
  192. /package/{dist/cdn → cdn}/types/index.d.ts +0 -0
  193. /package/{dist/cdn → cdn}/types/index.js +0 -0
  194. /package/{dist/cdn → cdn}/types/index.js.map +0 -0
  195. /package/{dist/cdn → cdn}/utils/extract-info-from-url.util.d.ts +0 -0
  196. /package/{dist/cdn → cdn}/utils/extract-info-from-url.util.js +0 -0
  197. /package/{dist/cdn → cdn}/utils/extract-info-from-url.util.js.map +0 -0
  198. /package/{dist/cdn → cdn}/utils/get-cdn-from-s3-url.util.d.ts +0 -0
  199. /package/{dist/cdn → cdn}/utils/get-cdn-from-s3-url.util.js +0 -0
  200. /package/{dist/cdn → cdn}/utils/get-cdn-from-s3-url.util.js.map +0 -0
  201. /package/{dist/cdn → cdn}/utils/get-cdn-url.util.d.ts +0 -0
  202. /package/{dist/cdn → cdn}/utils/get-cdn-url.util.js +0 -0
  203. /package/{dist/cdn → cdn}/utils/get-cdn-url.util.js.map +0 -0
  204. /package/{dist/cdn → cdn}/utils/twicpics-transformations.util.d.ts +0 -0
  205. /package/{dist/cdn → cdn}/utils/twicpics-transformations.util.js +0 -0
  206. /package/{dist/cdn → cdn}/utils/twicpics-transformations.util.js.map +0 -0
  207. /package/{dist/color → color}/get-contrast-color.d.ts +0 -0
  208. /package/{dist/color → color}/get-contrast-color.js +0 -0
  209. /package/{dist/color → color}/get-contrast-color.js.map +0 -0
  210. /package/{dist/color → color}/index.d.ts +0 -0
  211. /package/{dist/color → color}/index.js +0 -0
  212. /package/{dist/color → color}/index.js.map +0 -0
  213. /package/{dist/formatting → formatting}/format-number.d.ts +0 -0
  214. /package/{dist/formatting → formatting}/format-number.js +0 -0
  215. /package/{dist/formatting → formatting}/format-number.js.map +0 -0
  216. /package/{dist/formatting → formatting}/index.d.ts +0 -0
  217. /package/{dist/formatting → formatting}/index.js +0 -0
  218. /package/{dist/formatting → formatting}/index.js.map +0 -0
  219. /package/{dist/fp → fp}/index.d.ts +0 -0
  220. /package/{dist/fp → fp}/index.js +0 -0
  221. /package/{dist/fp → fp}/index.js.map +0 -0
  222. /package/{dist/fp → fp}/run-while.d.ts +0 -0
  223. /package/{dist/fp → fp}/run-while.js +0 -0
  224. /package/{dist/fp → fp}/run-while.js.map +0 -0
  225. /package/{dist/http → http}/build-search-params.d.ts +0 -0
  226. /package/{dist/http → http}/build-search-params.js +0 -0
  227. /package/{dist/http → http}/build-search-params.js.map +0 -0
  228. /package/{dist/http → http}/encode-search-object.d.ts +0 -0
  229. /package/{dist/http → http}/encode-search-object.js +0 -0
  230. /package/{dist/http → http}/encode-search-object.js.map +0 -0
  231. /package/{dist/http → http}/fetch-with-timeout.d.ts +0 -0
  232. /package/{dist/http → http}/fetch-with-timeout.js +0 -0
  233. /package/{dist/http → http}/fetch-with-timeout.js.map +0 -0
  234. /package/{dist/http → http}/index.d.ts +0 -0
  235. /package/{dist/http → http}/index.js +0 -0
  236. /package/{dist/http → http}/index.js.map +0 -0
  237. /package/{dist/index.d.ts → index.d.ts} +0 -0
  238. /package/{dist/index.js → index.js} +0 -0
  239. /package/{dist/index.js.map → index.js.map} +0 -0
  240. /package/{dist/linked-list → linked-list}/apply-diff-linked-list.d.ts +0 -0
  241. /package/{dist/linked-list → linked-list}/apply-diff-linked-list.js +0 -0
  242. /package/{dist/linked-list → linked-list}/apply-diff-linked-list.js.map +0 -0
  243. /package/{dist/linked-list → linked-list}/create-linked-list.d.ts +0 -0
  244. /package/{dist/linked-list → linked-list}/create-linked-list.js +0 -0
  245. /package/{dist/linked-list → linked-list}/create-linked-list.js.map +0 -0
  246. /package/{dist/linked-list → linked-list}/find-linked-list.d.ts +0 -0
  247. /package/{dist/linked-list → linked-list}/find-linked-list.js +0 -0
  248. /package/{dist/linked-list → linked-list}/find-linked-list.js.map +0 -0
  249. /package/{dist/linked-list → linked-list}/get-linked-list.d.ts +0 -0
  250. /package/{dist/linked-list → linked-list}/get-linked-list.js +0 -0
  251. /package/{dist/linked-list → linked-list}/get-linked-list.js.map +0 -0
  252. /package/{dist/linked-list → linked-list}/index.d.ts +0 -0
  253. /package/{dist/linked-list → linked-list}/index.js +0 -0
  254. /package/{dist/linked-list → linked-list}/index.js.map +0 -0
  255. /package/{dist/linked-list → linked-list}/insert-linked-list.d.ts +0 -0
  256. /package/{dist/linked-list → linked-list}/insert-linked-list.js +0 -0
  257. /package/{dist/linked-list → linked-list}/insert-linked-list.js.map +0 -0
  258. /package/{dist/linked-list → linked-list}/linked-list-utils.d.ts +0 -0
  259. /package/{dist/linked-list → linked-list}/linked-list-utils.js +0 -0
  260. /package/{dist/linked-list → linked-list}/linked-list-utils.js.map +0 -0
  261. /package/{dist/linked-list → linked-list}/reduce-linked-list.d.ts +0 -0
  262. /package/{dist/linked-list → linked-list}/reduce-linked-list.js +0 -0
  263. /package/{dist/linked-list → linked-list}/reduce-linked-list.js.map +0 -0
  264. /package/{dist/linked-list → linked-list}/remove-linked-list.d.ts +0 -0
  265. /package/{dist/linked-list → linked-list}/remove-linked-list.js +0 -0
  266. /package/{dist/linked-list → linked-list}/remove-linked-list.js.map +0 -0
  267. /package/{dist/linked-list → linked-list}/type.d.ts +0 -0
  268. /package/{dist/linked-list → linked-list}/update-linked-list.d.ts +0 -0
  269. /package/{dist/linked-list → linked-list}/update-linked-list.js +0 -0
  270. /package/{dist/linked-list → linked-list}/update-linked-list.js.map +0 -0
  271. /package/{dist/linked-list → linked-list}/while-linked-list.d.ts +0 -0
  272. /package/{dist/linked-list → linked-list}/while-linked-list.js +0 -0
  273. /package/{dist/linked-list → linked-list}/while-linked-list.js.map +0 -0
  274. /package/{dist/math → math}/clamp-number.d.ts +0 -0
  275. /package/{dist/math → math}/clamp-number.js +0 -0
  276. /package/{dist/math → math}/clamp-number.js.map +0 -0
  277. /package/{dist/math → math}/index.d.ts +0 -0
  278. /package/{dist/math → math}/index.js +0 -0
  279. /package/{dist/math → math}/index.js.map +0 -0
  280. /package/{dist/math → math}/interpolate.d.ts +0 -0
  281. /package/{dist/math → math}/interpolate.js +0 -0
  282. /package/{dist/math → math}/interpolate.js.map +0 -0
  283. /package/{dist/math → math}/median.d.ts +0 -0
  284. /package/{dist/math → math}/median.js +0 -0
  285. /package/{dist/math → math}/median.js.map +0 -0
  286. /package/{dist/math → math}/number-range.d.ts +0 -0
  287. /package/{dist/math → math}/number-range.js +0 -0
  288. /package/{dist/math → math}/number-range.js.map +0 -0
  289. /package/{dist/math → math}/random-number.d.ts +0 -0
  290. /package/{dist/math → math}/random-number.js +0 -0
  291. /package/{dist/math → math}/random-number.js.map +0 -0
  292. /package/{dist/object → object}/index.d.ts +0 -0
  293. /package/{dist/object → object}/index.js +0 -0
  294. /package/{dist/object → object}/index.js.map +0 -0
  295. /package/{dist/object → object}/merge-deep.d.ts +0 -0
  296. /package/{dist/object → object}/merge-deep.js +0 -0
  297. /package/{dist/object → object}/merge-deep.js.map +0 -0
  298. /package/{dist/object → object}/strip-properties-from-object.d.ts +0 -0
  299. /package/{dist/object → object}/strip-properties-from-object.js +0 -0
  300. /package/{dist/object → object}/strip-properties-from-object.js.map +0 -0
  301. /package/{dist/parsing → parsing}/index.d.ts +0 -0
  302. /package/{dist/parsing → parsing}/index.js +0 -0
  303. /package/{dist/parsing → parsing}/index.js.map +0 -0
  304. /package/{dist/parsing → parsing}/parse-boolean.d.ts +0 -0
  305. /package/{dist/parsing → parsing}/parse-boolean.js +0 -0
  306. /package/{dist/parsing → parsing}/parse-boolean.js.map +0 -0
  307. /package/{dist/parsing → parsing}/parse-enum.d.ts +0 -0
  308. /package/{dist/parsing → parsing}/parse-enum.js +0 -0
  309. /package/{dist/parsing → parsing}/parse-enum.js.map +0 -0
  310. /package/{dist/parsing → parsing}/parse-number.d.ts +0 -0
  311. /package/{dist/parsing → parsing}/parse-number.js +0 -0
  312. /package/{dist/parsing → parsing}/parse-number.js.map +0 -0
  313. /package/{dist/predicates → predicates}/index.d.ts +0 -0
  314. /package/{dist/predicates → predicates}/index.js +0 -0
  315. /package/{dist/predicates → predicates}/index.js.map +0 -0
  316. /package/{dist/predicates → predicates}/is-function.d.ts +0 -0
  317. /package/{dist/predicates → predicates}/is-function.js +0 -0
  318. /package/{dist/predicates → predicates}/is-function.js.map +0 -0
  319. /package/{dist/predicates → predicates}/is-null.d.ts +0 -0
  320. /package/{dist/predicates → predicates}/is-null.js +0 -0
  321. /package/{dist/predicates → predicates}/is-null.js.map +0 -0
  322. /package/{dist/predicates → predicates}/is-object.d.ts +0 -0
  323. /package/{dist/predicates → predicates}/is-object.js +0 -0
  324. /package/{dist/predicates → predicates}/is-object.js.map +0 -0
  325. /package/{dist/predicates → predicates}/is-primitive.d.ts +0 -0
  326. /package/{dist/predicates → predicates}/is-primitive.js +0 -0
  327. /package/{dist/predicates → predicates}/is-primitive.js.map +0 -0
  328. /package/{dist/predicates → predicates}/is-undefined.d.ts +0 -0
  329. /package/{dist/predicates → predicates}/is-undefined.js +0 -0
  330. /package/{dist/predicates → predicates}/is-undefined.js.map +0 -0
  331. /package/{dist/predicates → predicates}/is-uuid.d.ts +0 -0
  332. /package/{dist/promise → promise}/delay.d.ts +0 -0
  333. /package/{dist/promise → promise}/delay.js +0 -0
  334. /package/{dist/promise → promise}/delay.js.map +0 -0
  335. /package/{dist/promise → promise}/execute-or-resolve-default.d.ts +0 -0
  336. /package/{dist/promise → promise}/execute-or-resolve-default.js +0 -0
  337. /package/{dist/promise → promise}/execute-or-resolve-default.js.map +0 -0
  338. /package/{dist/promise → promise}/execute-with-delay.d.ts +0 -0
  339. /package/{dist/promise → promise}/execute-with-delay.js +0 -0
  340. /package/{dist/promise → promise}/execute-with-delay.js.map +0 -0
  341. /package/{dist/promise → promise}/index.d.ts +0 -0
  342. /package/{dist/promise → promise}/index.js +0 -0
  343. /package/{dist/promise → promise}/index.js.map +0 -0
  344. /package/{dist/string → string}/index.d.ts +0 -0
  345. /package/{dist/string → string}/index.js +0 -0
  346. /package/{dist/string → string}/index.js.map +0 -0
  347. /package/{dist/string → string}/is-string-length-within-range.d.ts +0 -0
  348. /package/{dist/string → string}/is-string-length-within-range.js +0 -0
  349. /package/{dist/string → string}/is-string-length-within-range.js.map +0 -0
  350. /package/{dist/string → string}/replace-in-template.d.ts +0 -0
  351. /package/{dist/string → string}/replace-in-template.js +0 -0
  352. /package/{dist/string → string}/replace-in-template.js.map +0 -0
  353. /package/{dist/time → time}/constants.d.ts +0 -0
  354. /package/{dist/time → time}/constants.js +0 -0
  355. /package/{dist/time → time}/constants.js.map +0 -0
  356. /package/{dist/time → time}/convert.d.ts +0 -0
  357. /package/{dist/time → time}/convert.js +0 -0
  358. /package/{dist/time → time}/convert.js.map +0 -0
  359. /package/{dist/time → time}/format-minutes.d.ts +0 -0
  360. /package/{dist/time → time}/format-minutes.js +0 -0
  361. /package/{dist/time → time}/format-minutes.js.map +0 -0
  362. /package/{dist/time → time}/get-time-diff-as-string.d.ts +0 -0
  363. /package/{dist/time → time}/get-time-diff-as-string.js +0 -0
  364. /package/{dist/time → time}/get-time-diff-as-string.js.map +0 -0
  365. /package/{dist/time → time}/index.d.ts +0 -0
  366. /package/{dist/time → time}/index.js +0 -0
  367. /package/{dist/time → time}/index.js.map +0 -0
  368. /package/{dist/types → types}/function.d.ts +0 -0
  369. /package/{dist/types → types}/general.d.ts +0 -0
  370. /package/{dist/types → types}/index.d.ts +0 -0
  371. /package/{dist/types → types}/index.js +0 -0
  372. /package/{dist/types → types}/index.js.map +0 -0
  373. /package/{dist/types → types}/object.d.ts +0 -0
  374. /package/{dist/types → types}/search.d.ts +0 -0
@@ -1,252 +0,0 @@
1
- import {
2
- walkListItemRecord,
3
- findPreviousId,
4
- assertItemCompatibility,
5
- assertPresence,
6
- assertNewNodePosition,
7
- } from '../linked-list-utils';
8
-
9
- describe('walkListItemRecord', () => {
10
- it('should throw an error if it detected an infinite loop', () => {
11
- const items = {
12
- 1: { id: '1', nextId: '2', previousId: null },
13
- 2: { id: '2', nextId: '3', previousId: '1' },
14
- 3: { id: '3', nextId: '1', previousId: '2' },
15
- 4: { id: '4', nextId: null, previousId: '3' },
16
- };
17
-
18
- expect(
19
- () => {
20
- walkListItemRecord(
21
- () => ({
22
- result: null,
23
- }),
24
- {
25
- initValue: null,
26
- startId: '1',
27
- items,
28
- },
29
- );
30
- },
31
- ).toThrowError('Infinite loop found');
32
- });
33
-
34
- it('should throw an error if a node points to another node that does not exist', () => {
35
- const items = {
36
- 1: { id: '1', nextId: '2', previousId: null },
37
- 2: { id: '2', nextId: '3', previousId: '1' },
38
- 3: { id: '3', nextId: '4', previousId: '2' },
39
- 5: { id: '5', nextId: null, previousId: '3' },
40
- };
41
-
42
- expect(
43
- () => {
44
- walkListItemRecord(
45
- () => ({
46
- result: null,
47
- }),
48
- {
49
- initValue: null,
50
- startId: '1',
51
- items,
52
- },
53
- );
54
- },
55
- ).toThrowError('Cul de sac detected');
56
- });
57
-
58
- it('should not throw an error if it did not walk through every nodes and it was force stopped', () => {
59
- const items = {
60
- 1: { id: '1', nextId: '2', previousId: null },
61
- 2: { id: '2', nextId: '3', previousId: '1' },
62
- 3: { id: '3', nextId: null, previousId: '2' },
63
- 4: { id: '4', nextId: null, previousId: '3' },
64
- };
65
-
66
- expect(
67
- () => {
68
- walkListItemRecord(
69
- (_, current) => {
70
- if (current.id === '2') {
71
- return {
72
- result: null,
73
- control: {
74
- stop: true,
75
- },
76
- };
77
- }
78
-
79
- return {
80
- result: null,
81
- };
82
- },
83
- {
84
- initValue: null,
85
- startId: '1',
86
- items,
87
- },
88
- );
89
- },
90
- ).not.toThrowError();
91
- });
92
-
93
- it('should accumulate the result and return it', () => {
94
- const items = {
95
- 1: { id: '1', nextId: '2', previousId: null },
96
- 2: { id: '2', nextId: '3', previousId: '1' },
97
- 3: { id: '3', nextId: '4', previousId: '2' },
98
- 4: { id: '4', nextId: null, previousId: '3' },
99
- };
100
-
101
- const result = walkListItemRecord(
102
- (acc, current) => ({
103
- result: acc + current.id.toString(),
104
- }),
105
- {
106
- initValue: '',
107
- startId: '1',
108
- items,
109
- },
110
- );
111
-
112
- expect(result).toStrictEqual('1234');
113
- });
114
- });
115
-
116
- describe('findPreviousId', () => {
117
- const list = {
118
- headId: '1',
119
- items: {
120
- 1: { id: '1', nextId: '2', previousId: null },
121
- 2: { id: '2', nextId: '3', previousId: '1' },
122
- 3: { id: '3', nextId: '4', previousId: '2' },
123
- 4: { id: '4', nextId: null, previousId: '3' },
124
- },
125
- };
126
-
127
- it('should return the headId if the id is the head', () => {
128
- expect(findPreviousId('1', list)).toStrictEqual(null);
129
- });
130
-
131
- it('should correctly return the previous id', () => {
132
- expect(findPreviousId('4', list)).toStrictEqual('3');
133
- });
134
-
135
- it('should correctly find the previous id if it is the tail', () => {
136
- expect(findPreviousId(null, list)).toStrictEqual('4');
137
- });
138
-
139
- it('should return null if the list is empty', () => {
140
- expect(findPreviousId('4', { headId: null, items: {} })).toStrictEqual(null);
141
- });
142
-
143
- it('should return null if it can\'t find the previous', () => {
144
- expect(findPreviousId('6', list)).toStrictEqual(null);
145
- });
146
- });
147
-
148
- describe('assertItemCompatibility', () => {
149
- const itemWithPrevious = { id: '2', nextId: '3', previousId: '1' };
150
- const itemWithoutPrevious = { id: '2', nextId: '3' };
151
-
152
- it('should throw an error if the node has previous and the linked list is not double linked', () => {
153
- expect(() => assertItemCompatibility(itemWithPrevious, 'single')).toThrowError(
154
- 'Node is incompatible with the list (id: 2)',
155
- );
156
- });
157
-
158
- it('should throw an error if the node does not have previous and the linked list is double linked', () => {
159
- expect(() => assertItemCompatibility(itemWithoutPrevious, 'double')).toThrowError(
160
- 'Node is incompatible with the list (id: 2)',
161
- );
162
- });
163
-
164
- it('should not throw error if the node is correct', () => {
165
- expect(() => assertItemCompatibility(itemWithoutPrevious, 'single')).not.toThrowError();
166
- expect(() => assertItemCompatibility(itemWithPrevious, 'double')).not.toThrowError();
167
- });
168
-
169
- it('should not throw error if format is null', () => {
170
- expect(() => assertItemCompatibility(itemWithoutPrevious, null)).not.toThrowError();
171
- expect(() => assertItemCompatibility(itemWithPrevious, null)).not.toThrowError();
172
- });
173
- });
174
-
175
- describe('assertPresence', () => {
176
- const items = {
177
- 1: { id: '1', nextId: '2', previousId: null },
178
- 2: { id: '2', nextId: null, previousId: '1' },
179
- };
180
-
181
- it('should throw an error if the item is not in the list', () => {
182
- expect(() => assertPresence('3', items)).toThrowError(
183
- 'Node not found in the list (id: 3)',
184
- );
185
- });
186
-
187
- it('should not throw an error if the item is in the list', () => {
188
- expect(() => assertPresence('2', items)).not.toThrowError();
189
- });
190
- });
191
-
192
- describe('assertNewNodePosition', () => {
193
- const list = {
194
- headId: '1',
195
- items: {
196
- 1: { id: '1', nextId: '2', previousId: null },
197
- 2: { id: '2', nextId: '3', previousId: '1' },
198
- 3: { id: '3', nextId: null, previousId: '2' },
199
- },
200
- };
201
-
202
- it('should throw an error if the head position is incorrect', () => {
203
- const item = { id: '4', nextId: '2' };
204
-
205
- expect(
206
- () => {
207
- assertNewNodePosition(item, {
208
- previousId: null,
209
- list,
210
- });
211
- },
212
- ).toThrowError('Invalid position for given node (id: 4)');
213
- });
214
-
215
- it('should throw an error if the tail position is incorrect', () => {
216
- const item = { id: '4', nextId: null };
217
-
218
- expect(
219
- () => {
220
- assertNewNodePosition(item, {
221
- previousId: '2',
222
- list,
223
- });
224
- },
225
- ).toThrowError('Invalid position for given node (id: 4)');
226
- });
227
- it('should throw an error if the middle position is incorrect', () => {
228
- const item = { id: '4', nextId: '3' };
229
-
230
- expect(
231
- () => {
232
- assertNewNodePosition(item, {
233
- previousId: '1',
234
- list,
235
- });
236
- },
237
- ).toThrowError('Invalid position for given node (id: 4)');
238
- });
239
-
240
- it('should not throw an error if the position is correct', () => {
241
- const item = { id: '4', nextId: '3' };
242
-
243
- expect(
244
- () => {
245
- assertNewNodePosition(item, {
246
- previousId: '2',
247
- list,
248
- });
249
- },
250
- ).not.toThrowError();
251
- });
252
- });
@@ -1,31 +0,0 @@
1
- import { reduceLinkedList } from '../reduce-linked-list';
2
-
3
- describe('reduceLinkedList', () => {
4
- it('should execute the reduce function on every node', () => {
5
- const nodes = {
6
- 3: {
7
- id: '3',
8
- nextId: '2',
9
- },
10
- 1: {
11
- id: '1',
12
- nextId: null,
13
- },
14
- 2: {
15
- id: '2',
16
- nextId: '1',
17
- },
18
- };
19
-
20
- const reduceResult = reduceLinkedList(
21
- (acc: string, current) => acc.concat(current.id),
22
- '',
23
- {
24
- headId: '3',
25
- items: nodes,
26
- },
27
- );
28
-
29
- expect(reduceResult).toStrictEqual('321');
30
- });
31
- });
@@ -1,129 +0,0 @@
1
- import { removeLinkedList } from '../remove-linked-list';
2
- import { assertPresence, findPreviousId } from '../linked-list-utils';
3
-
4
- jest.mock('../linked-list-utils');
5
-
6
- describe('removeLinkedList', () => {
7
- const assertPresenceMocked = jest.mocked(assertPresence);
8
- const findPreviousIdMocked = jest.mocked(findPreviousId);
9
-
10
- const list = {
11
- headId: '1',
12
- items: {
13
- 1: { id: '1', nextId: '2', previousId: null },
14
- 2: { id: '2', nextId: '3', previousId: '1' },
15
- 3: { id: '3', nextId: null, previousId: '2' },
16
- },
17
- };
18
-
19
- beforeEach(() => {
20
- jest.clearAllMocks();
21
- });
22
-
23
- it('should make the right assertions', () => {
24
- removeLinkedList('1', {
25
- list,
26
- factory: jest.fn(),
27
- format: 'double',
28
- });
29
-
30
- expect(assertPresenceMocked).toHaveBeenCalledTimes(1);
31
- expect(assertPresenceMocked).toHaveBeenCalledWith('1', list.items);
32
- });
33
-
34
- it('should find the previous id if the list is not double linked', () => {
35
- removeLinkedList('1', {
36
- list,
37
- factory: jest.fn(),
38
- format: 'single',
39
- });
40
-
41
- expect(findPreviousIdMocked).toHaveBeenCalledTimes(1);
42
- expect(findPreviousIdMocked).toHaveBeenCalledWith('1', list);
43
- });
44
-
45
- it('should directly take the previous id from the deleted item if the list is double linked', () => {
46
- removeLinkedList('1', {
47
- list,
48
- factory: jest.fn(),
49
- format: 'double',
50
- });
51
-
52
- expect(findPreviousIdMocked).not.toHaveBeenCalled();
53
- });
54
-
55
- it('should handle a head deletion', () => {
56
- const newList = removeLinkedList('1', {
57
- list,
58
- factory: jest.fn().mockImplementation((theList) => theList),
59
- format: 'double',
60
- });
61
-
62
- expect(newList).toStrictEqual({
63
- headId: '2',
64
- items: {
65
- 2: { id: '2', nextId: '3', previousId: null },
66
- 3: { id: '3', nextId: null, previousId: '2' },
67
- },
68
- });
69
- });
70
-
71
- it('should handle a tail deletion', () => {
72
- const newList = removeLinkedList('3', {
73
- list,
74
- factory: jest.fn().mockImplementation((theList) => theList),
75
- format: 'double',
76
- });
77
-
78
- expect(newList).toStrictEqual({
79
- headId: '1',
80
- items: {
81
- 1: { id: '1', nextId: '2', previousId: null },
82
- 2: { id: '2', nextId: null, previousId: '1' },
83
- },
84
- });
85
- });
86
-
87
- it('should handle a middle deletion', () => {
88
- const newList = removeLinkedList('2', {
89
- list,
90
- factory: jest.fn().mockImplementation((theList) => theList),
91
- format: 'double',
92
- });
93
-
94
- expect(newList).toStrictEqual({
95
- headId: '1',
96
- items: {
97
- 1: { id: '1', nextId: '3', previousId: null },
98
- 3: { id: '3', nextId: null, previousId: '1' },
99
- },
100
- });
101
- });
102
-
103
- it('should a deletion in a single linked list', () => {
104
- findPreviousIdMocked.mockReturnValue('1');
105
-
106
- const singleList = {
107
- headId: '1',
108
- items: {
109
- 1: { id: '1', nextId: '2' },
110
- 2: { id: '2', nextId: '3' },
111
- 3: { id: '3', nextId: null },
112
- },
113
- };
114
-
115
- const newList = removeLinkedList('2', {
116
- list: singleList,
117
- factory: jest.fn().mockImplementation((theList) => theList),
118
- format: 'single',
119
- });
120
-
121
- expect(newList).toStrictEqual({
122
- headId: '1',
123
- items: {
124
- 1: { id: '1', nextId: '3' },
125
- 3: { id: '3', nextId: null },
126
- },
127
- });
128
- });
129
- });
@@ -1,53 +0,0 @@
1
- import { updateLinkedList } from '../update-linked-list';
2
- import { assertPresence } from '../linked-list-utils';
3
-
4
- jest.mock('../linked-list-utils');
5
-
6
- describe('updateLinkedList', () => {
7
- const assertPresenceMocked = jest.mocked(assertPresence);
8
-
9
- const list = {
10
- headId: '1',
11
- items: {
12
- 1: { id: '1', nextId: '2', previousId: null, name: 'Barack Afritt' },
13
- 2: { id: '2', nextId: '3', previousId: '1', name: 'Djamal Dormi' },
14
- 3: { id: '3', nextId: null, previousId: '2', name: 'Harry Cover' },
15
- },
16
- };
17
-
18
- beforeEach(() => {
19
- jest.clearAllMocks();
20
- });
21
-
22
- it('should make the right assertions', () => {
23
- const itemToUpdate = { id: '1', nextId: '2', previousId: null };
24
-
25
- updateLinkedList(itemToUpdate, {
26
- list: list as any,
27
- format: 'double',
28
- factory: jest.fn(),
29
- });
30
-
31
- expect(assertPresenceMocked).toHaveBeenCalledTimes(1);
32
- expect(assertPresenceMocked).toHaveBeenCalledWith('1', list.items);
33
- });
34
-
35
- it('should update the item without reordering it', () => {
36
- const itemToUpdate = { id: '1', nextId: '3', previousId: '2', surname: 'Ototo' };
37
-
38
- const newList = updateLinkedList(itemToUpdate, {
39
- list: list as any,
40
- format: 'double',
41
- factory: jest.fn().mockImplementation((theList) => theList),
42
- });
43
-
44
- expect(newList).toStrictEqual({
45
- headId: '1',
46
- items: {
47
- 1: { id: '1', nextId: '2', previousId: null, surname: 'Ototo' },
48
- 2: { id: '2', nextId: '3', previousId: '1', name: 'Djamal Dormi' },
49
- 3: { id: '3', nextId: null, previousId: '2', name: 'Harry Cover' },
50
- },
51
- });
52
- });
53
- });
@@ -1,58 +0,0 @@
1
- import { whileLinkedList } from '../while-linked-list';
2
-
3
- describe('whileLinkedList', () => {
4
- it('should return every ids while the predicate is true', () => {
5
- const list = {
6
- headId: '3',
7
- items: {
8
- 3: {
9
- id: '3',
10
- nextId: '2',
11
- },
12
- 1: {
13
- id: '1',
14
- nextId: null,
15
- },
16
- 2: {
17
- id: '2',
18
- nextId: '1',
19
- },
20
- },
21
- };
22
-
23
- const ids = whileLinkedList(
24
- (item) => item.id !== '1',
25
- list,
26
- );
27
-
28
- expect(ids).toStrictEqual(['3', '2']);
29
- });
30
-
31
- it('should return every ids while the predicate is true with a start id', () => {
32
- const list = {
33
- headId: '3',
34
- items: {
35
- 3: {
36
- id: '3',
37
- nextId: '2',
38
- },
39
- 1: {
40
- id: '1',
41
- nextId: null,
42
- },
43
- 2: {
44
- id: '2',
45
- nextId: '1',
46
- },
47
- },
48
- };
49
-
50
- const ids = whileLinkedList(
51
- (item) => item.id !== '1',
52
- list,
53
- '2',
54
- );
55
-
56
- expect(ids).toStrictEqual(['2']);
57
- });
58
- });
@@ -1,35 +0,0 @@
1
- import { LinkedList, LinkedListItem } from './type';
2
-
3
- export const applyDiffLinkedList = <T extends LinkedListItem>(
4
- before: T | null,
5
- after: T | null,
6
- list: LinkedList<T>,
7
- ) => {
8
- // Delete
9
- if (!after && before) {
10
- return list.remove(before.id);
11
- }
12
-
13
- // Insert
14
- if (!before && after) {
15
- return list.insert(after);
16
- }
17
-
18
- // For the following commands, none of the 2 items can be null
19
- // We dont use && because checks are already done above, but ts cannot infer that they cannot be null afterwards
20
- if (!before || !after) {
21
- throw new Error('Cannot have both before & after as null');
22
- }
23
-
24
- if (before.id !== after.id) {
25
- throw new Error('Cannot change id of a ListNode');
26
- }
27
-
28
- const listWithPotentialReorder = before.nextId === after.nextId
29
- ? list
30
- : list
31
- .remove(before.id)
32
- .insert(after);
33
-
34
- return listWithPotentialReorder.update(after);
35
- };
@@ -1,79 +0,0 @@
1
- import { LinkedListItem, LinkedList, ManipulationConfig, LinkedListFormat } from './type';
2
-
3
- import { reduceLinkedList } from './reduce-linked-list';
4
- import { findLinkedList } from './find-linked-list';
5
- import { whileLinkedList } from './while-linked-list';
6
- import { walkListItemRecord } from './linked-list-utils';
7
- import { removeLinkedList } from './remove-linked-list';
8
- import { insertLinkedList } from './insert-linked-list';
9
- import { getLinkedList } from './get-linked-list';
10
- import { updateLinkedList } from './update-linked-list';
11
- import { applyDiffLinkedList } from './apply-diff-linked-list';
12
-
13
- type LinkedListValidation = {
14
- format: LinkedListFormat | null,
15
- previousId: null | string,
16
- count: number,
17
- };
18
-
19
- export const createLinkedList = <T extends LinkedListItem>(headId: string | null, items: Record<string, T>): LinkedList<T> => {
20
- const head = headId ? items[headId] : null;
21
-
22
- if (head === undefined) {
23
- throw new Error('Cannot find the head.');
24
- }
25
-
26
- const list = { headId, items };
27
-
28
- const { format, count } = walkListItemRecord((acc, current) => {
29
- const newCount = acc.count + 1;
30
- const currentNodeFormat: LinkedListFormat = current.previousId !== undefined ? 'double' : 'single';
31
- const incompatibleFormats = acc.format !== null && acc.format !== currentNodeFormat;
32
-
33
- if (incompatibleFormats || (currentNodeFormat === 'double' && current.previousId !== acc.previousId)) {
34
- throw new Error('Invalid previous node in the linked list');
35
- }
36
-
37
- return {
38
- result: {
39
- previousId: current.id,
40
- format: currentNodeFormat,
41
- count: newCount,
42
- },
43
- };
44
- }, {
45
- initValue: {
46
- format: null,
47
- count: 0,
48
- previousId: null,
49
- } as LinkedListValidation,
50
- startId: headId,
51
- items,
52
- });
53
-
54
- const manipulationConfig: ManipulationConfig<T> = {
55
- factory: (newList) => createLinkedList(newList.headId, newList.items),
56
- /**
57
- * At this point isDoubleLinked cannot be undefined
58
- */
59
- format,
60
- list,
61
- };
62
-
63
- const linkedList: LinkedList<T> = {
64
- head,
65
- items,
66
- format,
67
- size: count,
68
- reduce: (cb, initValue) => reduceLinkedList(cb, initValue, list),
69
- find: (predicate) => findLinkedList(predicate, list),
70
- while: (predicate, startId) => whileLinkedList(predicate, list, startId),
71
- remove: (id) => removeLinkedList(id, manipulationConfig),
72
- insert: (item) => insertLinkedList(item, manipulationConfig),
73
- get: (id) => getLinkedList(id, list),
74
- update: (item) => updateLinkedList(item, manipulationConfig),
75
- applyDiff: (before, after) => applyDiffLinkedList(before, after, linkedList),
76
- };
77
-
78
- return linkedList;
79
- };
@@ -1,26 +0,0 @@
1
- import { LinkedListItem, ItemPredicate, SimpleLinkedList } from './type';
2
- import { walkListItemRecord } from './linked-list-utils';
3
-
4
- export const findLinkedList = <Item extends LinkedListItem>(
5
- predicate: ItemPredicate<Item>,
6
- list: SimpleLinkedList<Item>,
7
- ): Item | null => (
8
- walkListItemRecord((acc, item) => {
9
- if (predicate(item)) {
10
- return {
11
- result: item,
12
- control: {
13
- stop: true,
14
- },
15
- };
16
- }
17
-
18
- return {
19
- result: acc,
20
- };
21
- }, {
22
- initValue: null as Item | null,
23
- items: list.items,
24
- startId: list.headId,
25
- })
26
- );
@@ -1,9 +0,0 @@
1
- import { SimpleLinkedList, LinkedListItem } from './type';
2
-
3
- export const getLinkedList = <T extends LinkedListItem>(id: string, list: SimpleLinkedList<T>) => {
4
- if (list.items[id]) {
5
- return list.items[id];
6
- }
7
-
8
- return null;
9
- };
@@ -1,2 +0,0 @@
1
- export * from './create-linked-list';
2
- export * from './type';