@bbn/bbn 1.0.59 → 1.0.60

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 (463) hide show
  1. package/dist/_.js +1 -1
  2. package/dist/bundle.d.ts +3804 -242
  3. package/dist/bundle.js +4061 -502
  4. package/dist/db.js +3 -3
  5. package/dist/fn/ajax/_addLoader.d.ts +16 -0
  6. package/dist/fn/ajax/_addLoader.js +51 -0
  7. package/dist/fn/ajax/_deleteLoader.d.ts +16 -0
  8. package/dist/fn/ajax/_deleteLoader.js +39 -0
  9. package/dist/fn/ajax/abort.d.ts +24 -0
  10. package/dist/fn/ajax/abort.js +36 -0
  11. package/dist/fn/ajax/abortURL.d.ts +22 -0
  12. package/dist/fn/ajax/abortURL.js +33 -0
  13. package/dist/fn/ajax/ajax.d.ts +58 -0
  14. package/dist/fn/ajax/ajax.js +170 -0
  15. package/dist/fn/ajax/callback.d.ts +37 -0
  16. package/dist/fn/ajax/callback.js +117 -0
  17. package/dist/fn/ajax/download.d.ts +30 -0
  18. package/dist/fn/ajax/download.js +64 -0
  19. package/dist/fn/ajax/downloadContent.d.ts +28 -0
  20. package/dist/fn/ajax/downloadContent.js +74 -0
  21. package/dist/fn/ajax/getLoader.d.ts +37 -0
  22. package/dist/fn/ajax/getLoader.js +44 -0
  23. package/dist/fn/ajax/getRequestId.d.ts +50 -0
  24. package/dist/fn/ajax/getRequestId.js +62 -0
  25. package/dist/fn/ajax/link.d.ts +26 -0
  26. package/dist/fn/ajax/link.js +129 -0
  27. package/dist/fn/ajax/post.d.ts +35 -0
  28. package/dist/fn/ajax/post.js +45 -0
  29. package/dist/fn/ajax/postOut.d.ts +21 -0
  30. package/dist/fn/ajax/postOut.js +49 -0
  31. package/dist/fn/ajax/setNavigationVars.d.ts +25 -0
  32. package/dist/fn/ajax/setNavigationVars.js +80 -0
  33. package/dist/fn/ajax/treatAjaxArguments.d.ts +53 -0
  34. package/dist/fn/ajax/treatAjaxArguments.js +127 -0
  35. package/dist/fn/ajax/upload.d.ts +18 -0
  36. package/dist/fn/ajax/upload.js +52 -0
  37. package/dist/fn/browser/copy.d.ts +15 -0
  38. package/dist/fn/browser/copy.js +50 -0
  39. package/dist/fn/browser/eraseCookie.d.ts +15 -0
  40. package/dist/fn/browser/eraseCookie.js +17 -0
  41. package/dist/fn/browser/error.d.ts +14 -0
  42. package/dist/fn/browser/error.js +29 -0
  43. package/dist/fn/browser/getBrowserName.d.ts +9 -0
  44. package/dist/fn/browser/getBrowserName.js +28 -0
  45. package/dist/fn/browser/getBrowserVersion.d.ts +9 -0
  46. package/dist/fn/browser/getBrowserVersion.js +29 -0
  47. package/dist/fn/browser/getCookie.d.ts +16 -0
  48. package/dist/fn/browser/getCookie.js +32 -0
  49. package/dist/fn/browser/getDeviceType.d.ts +14 -0
  50. package/dist/fn/browser/getDeviceType.js +23 -0
  51. package/dist/fn/browser/getEventData.d.ts +16 -0
  52. package/dist/fn/browser/getEventData.js +116 -0
  53. package/dist/fn/browser/happy.d.ts +14 -0
  54. package/dist/fn/browser/happy.js +22 -0
  55. package/dist/fn/browser/history.d.ts +2 -0
  56. package/dist/fn/browser/history.js +4 -0
  57. package/dist/fn/browser/info.d.ts +10 -0
  58. package/dist/fn/browser/info.js +19 -0
  59. package/dist/fn/browser/isActiveInterface.d.ts +14 -0
  60. package/dist/fn/browser/isActiveInterface.js +20 -0
  61. package/dist/fn/browser/isDesktopDevice.d.ts +14 -0
  62. package/dist/fn/browser/isDesktopDevice.js +17 -0
  63. package/dist/fn/browser/isFocused.d.ts +21 -0
  64. package/dist/fn/browser/isFocused.js +23 -0
  65. package/dist/fn/browser/isMobile.d.ts +14 -0
  66. package/dist/fn/browser/isMobile.js +18 -0
  67. package/dist/fn/browser/isMobileDevice.d.ts +2 -0
  68. package/dist/fn/browser/isMobileDevice.js +5 -0
  69. package/dist/fn/browser/isTabletDevice.d.ts +14 -0
  70. package/dist/fn/browser/isTabletDevice.js +17 -0
  71. package/dist/fn/browser/log.d.ts +15 -0
  72. package/dist/fn/browser/log.js +46 -0
  73. package/dist/fn/browser/replaceSelection.d.ts +2 -0
  74. package/dist/fn/browser/replaceSelection.js +42 -0
  75. package/dist/fn/browser/selectElementText.d.ts +21 -0
  76. package/dist/fn/browser/selectElementText.js +42 -0
  77. package/dist/fn/browser/setCookie.d.ts +16 -0
  78. package/dist/fn/browser/setCookie.js +25 -0
  79. package/dist/fn/browser/toggleFullScreen.d.ts +2 -0
  80. package/dist/fn/browser/toggleFullScreen.js +39 -0
  81. package/dist/fn/browser/warning.d.ts +14 -0
  82. package/dist/fn/browser/warning.js +24 -0
  83. package/dist/fn/convert/arrayBuffer2String.d.ts +2 -0
  84. package/dist/fn/convert/arrayBuffer2String.js +4 -0
  85. package/dist/fn/convert/canvasToImage.d.ts +16 -0
  86. package/dist/fn/convert/canvasToImage.js +20 -0
  87. package/dist/fn/convert/colorToHex.d.ts +20 -0
  88. package/dist/fn/convert/colorToHex.js +24 -0
  89. package/dist/fn/convert/fromXml.d.ts +12 -0
  90. package/dist/fn/convert/fromXml.js +54 -0
  91. package/dist/fn/convert/hex2rgb.d.ts +24 -0
  92. package/dist/fn/convert/hex2rgb.js +29 -0
  93. package/dist/fn/convert/imageToCanvas.d.ts +15 -0
  94. package/dist/fn/convert/imageToCanvas.js +21 -0
  95. package/dist/fn/convert/imgToBase64.d.ts +2 -0
  96. package/dist/fn/convert/imgToBase64.js +7 -0
  97. package/dist/fn/convert/rgb2hex.d.ts +20 -0
  98. package/dist/fn/convert/rgb2hex.js +28 -0
  99. package/dist/fn/convert/string2ArrayBuffer.d.ts +2 -0
  100. package/dist/fn/convert/string2ArrayBuffer.js +9 -0
  101. package/dist/fn/convert/toCSV.d.ts +26 -0
  102. package/dist/fn/convert/toCSV.js +64 -0
  103. package/dist/fn/datetime/calendar.d.ts +2 -0
  104. package/dist/fn/datetime/calendar.js +23 -0
  105. package/dist/fn/datetime/chrono.d.ts +25 -0
  106. package/dist/fn/datetime/chrono.js +45 -0
  107. package/dist/fn/datetime/date.d.ts +18 -0
  108. package/dist/fn/datetime/date.js +44 -0
  109. package/dist/fn/datetime/dateSQL.d.ts +20 -0
  110. package/dist/fn/datetime/dateSQL.js +26 -0
  111. package/dist/fn/datetime/daysInMonth.d.ts +17 -0
  112. package/dist/fn/datetime/daysInMonth.js +24 -0
  113. package/dist/fn/datetime/fdate.d.ts +11 -0
  114. package/dist/fn/datetime/fdate.js +28 -0
  115. package/dist/fn/datetime/fdatetime.d.ts +9 -0
  116. package/dist/fn/datetime/fdatetime.js +30 -0
  117. package/dist/fn/datetime/formatDate.d.ts +2 -0
  118. package/dist/fn/datetime/formatDate.js +4 -0
  119. package/dist/fn/datetime/ftime.d.ts +9 -0
  120. package/dist/fn/datetime/ftime.js +21 -0
  121. package/dist/fn/datetime/getDay.d.ts +11 -0
  122. package/dist/fn/datetime/getDay.js +26 -0
  123. package/dist/fn/datetime/timestamp.d.ts +15 -0
  124. package/dist/fn/datetime/timestamp.js +18 -0
  125. package/dist/fn/default/defaultAjaxAbortFunction.d.ts +2 -0
  126. package/dist/fn/default/defaultAjaxAbortFunction.js +5 -0
  127. package/dist/fn/default/defaultAjaxErrorFunction.d.ts +2 -0
  128. package/dist/fn/default/defaultAjaxErrorFunction.js +4 -0
  129. package/dist/fn/default/defaultAlertFunction.d.ts +2 -0
  130. package/dist/fn/default/defaultAlertFunction.js +5 -0
  131. package/dist/fn/default/defaultConfirmFunction.d.ts +2 -0
  132. package/dist/fn/default/defaultConfirmFunction.js +14 -0
  133. package/dist/fn/default/defaultEndLoadingFunction.d.ts +2 -0
  134. package/dist/fn/default/defaultEndLoadingFunction.js +4 -0
  135. package/dist/fn/default/defaultErrorFunction.d.ts +2 -0
  136. package/dist/fn/default/defaultErrorFunction.js +5 -0
  137. package/dist/fn/default/defaultHistoryFunction.d.ts +2 -0
  138. package/dist/fn/default/defaultHistoryFunction.js +4 -0
  139. package/dist/fn/default/defaultLinkFunction.d.ts +2 -0
  140. package/dist/fn/default/defaultLinkFunction.js +4 -0
  141. package/dist/fn/default/defaultPostLinkFunction.d.ts +2 -0
  142. package/dist/fn/default/defaultPostLinkFunction.js +4 -0
  143. package/dist/fn/default/defaultPreLinkFunction.d.ts +2 -0
  144. package/dist/fn/default/defaultPreLinkFunction.js +4 -0
  145. package/dist/fn/default/defaultResizeFunction.d.ts +2 -0
  146. package/dist/fn/default/defaultResizeFunction.js +4 -0
  147. package/dist/fn/default/defaultStartLoadingFunction.d.ts +2 -0
  148. package/dist/fn/default/defaultStartLoadingFunction.js +4 -0
  149. package/dist/fn/form/addInputs.d.ts +43 -0
  150. package/dist/fn/form/addInputs.js +81 -0
  151. package/dist/fn/form/fieldValue.d.ts +12 -0
  152. package/dist/fn/form/fieldValue.js +34 -0
  153. package/dist/fn/form/formdata.d.ts +45 -0
  154. package/dist/fn/form/formdata.js +95 -0
  155. package/dist/fn/form/objectToFormData.d.ts +12 -0
  156. package/dist/fn/form/objectToFormData.js +45 -0
  157. package/dist/fn/form/submit.d.ts +20 -0
  158. package/dist/fn/form/submit.js +51 -0
  159. package/dist/fn/html/adjustHeight.d.ts +2 -0
  160. package/dist/fn/html/adjustHeight.js +10 -0
  161. package/dist/fn/html/adjustSize.d.ts +2 -0
  162. package/dist/fn/html/adjustSize.js +21 -0
  163. package/dist/fn/html/adjustWidth.d.ts +2 -0
  164. package/dist/fn/html/adjustWidth.js +10 -0
  165. package/dist/fn/html/getAllTags.d.ts +6 -0
  166. package/dist/fn/html/getAllTags.js +9 -0
  167. package/dist/fn/html/getAncestors.d.ts +2 -0
  168. package/dist/fn/html/getAncestors.js +25 -0
  169. package/dist/fn/html/getAttributes.d.ts +6 -0
  170. package/dist/fn/html/getAttributes.js +16 -0
  171. package/dist/fn/html/getHTMLOfSelection.d.ts +2 -0
  172. package/dist/fn/html/getHTMLOfSelection.js +18 -0
  173. package/dist/fn/html/getHtml.d.ts +2 -0
  174. package/dist/fn/html/getHtml.js +9 -0
  175. package/dist/fn/html/getPath.d.ts +10 -0
  176. package/dist/fn/html/getPath.js +50 -0
  177. package/dist/fn/html/getText.d.ts +2 -0
  178. package/dist/fn/html/getText.js +4 -0
  179. package/dist/fn/html/html2text.d.ts +17 -0
  180. package/dist/fn/html/html2text.js +22 -0
  181. package/dist/fn/html/isInside.d.ts +2 -0
  182. package/dist/fn/html/isInside.js +23 -0
  183. package/dist/fn/html/makeReactive.d.ts +2 -0
  184. package/dist/fn/html/makeReactive.js +185 -0
  185. package/dist/fn/html/selector.d.ts +10 -0
  186. package/dist/fn/html/selector.js +12 -0
  187. package/dist/fn/init.d.ts +13 -0
  188. package/dist/fn/init.js +25 -12
  189. package/dist/fn/loop/each.d.ts +33 -0
  190. package/dist/fn/loop/each.js +54 -0
  191. package/dist/fn/loop/fori.d.ts +36 -0
  192. package/dist/fn/loop/fori.js +53 -0
  193. package/dist/fn/loop/forir.d.ts +36 -0
  194. package/dist/fn/loop/forir.js +53 -0
  195. package/dist/fn/loop/iterate.d.ts +22 -0
  196. package/dist/fn/loop/iterate.js +36 -0
  197. package/dist/fn/loop/riterate.d.ts +21 -0
  198. package/dist/fn/loop/riterate.js +24 -0
  199. package/dist/fn/misc/analyzeFunction.d.ts +11 -0
  200. package/dist/fn/misc/analyzeFunction.js +141 -0
  201. package/dist/fn/misc/getTimeoff.d.ts +14 -0
  202. package/dist/fn/misc/getTimeoff.js +19 -0
  203. package/dist/fn/misc/money.d.ts +23 -0
  204. package/dist/fn/misc/money.js +122 -0
  205. package/dist/fn/misc/percent.d.ts +23 -0
  206. package/dist/fn/misc/percent.js +25 -0
  207. package/dist/fn/misc/randomInt.d.ts +22 -0
  208. package/dist/fn/misc/randomInt.js +24 -0
  209. package/dist/fn/misc/roundDecimal.d.ts +11 -0
  210. package/dist/fn/misc/roundDecimal.js +13 -0
  211. package/dist/fn/misc/translate.d.ts +2 -0
  212. package/dist/fn/misc/translate.js +8 -0
  213. package/dist/fn/object/_compareValues.d.ts +40 -0
  214. package/dist/fn/object/_compareValues.js +78 -0
  215. package/dist/fn/object/arrayFromProp.d.ts +33 -0
  216. package/dist/fn/object/arrayFromProp.js +41 -0
  217. package/dist/fn/object/autoExtend.d.ts +33 -0
  218. package/dist/fn/object/autoExtend.js +44 -0
  219. package/dist/fn/object/checkProps.d.ts +2 -0
  220. package/dist/fn/object/checkProps.js +5 -0
  221. package/dist/fn/object/checkPropsDetails.d.ts +2 -0
  222. package/dist/fn/object/checkPropsDetails.js +53 -0
  223. package/dist/fn/object/checkPropsOrDie.d.ts +2 -0
  224. package/dist/fn/object/checkPropsOrDie.js +9 -0
  225. package/dist/fn/object/circularReplacer.d.ts +7 -0
  226. package/dist/fn/object/circularReplacer.js +39 -0
  227. package/dist/fn/object/clone.d.ts +19 -0
  228. package/dist/fn/object/clone.js +33 -0
  229. package/dist/fn/object/compare.d.ts +53 -0
  230. package/dist/fn/object/compare.js +150 -0
  231. package/dist/fn/object/compareConditions.d.ts +46 -0
  232. package/dist/fn/object/compareConditions.js +86 -0
  233. package/dist/fn/object/count.d.ts +56 -0
  234. package/dist/fn/object/count.js +59 -0
  235. package/dist/fn/object/createObject.d.ts +2 -0
  236. package/dist/fn/object/createObject.js +9 -0
  237. package/dist/fn/object/deepPath.d.ts +57 -0
  238. package/dist/fn/object/deepPath.js +78 -0
  239. package/dist/fn/object/deleteProp.d.ts +8 -0
  240. package/dist/fn/object/deleteProp.js +13 -0
  241. package/dist/fn/object/diffObj.d.ts +79 -0
  242. package/dist/fn/object/diffObj.js +168 -0
  243. package/dist/fn/object/extend.d.ts +87 -0
  244. package/dist/fn/object/extend.js +158 -0
  245. package/dist/fn/object/extendOut.d.ts +18 -0
  246. package/dist/fn/object/extendOut.js +40 -0
  247. package/dist/fn/object/filter.d.ts +50 -0
  248. package/dist/fn/object/filter.js +94 -0
  249. package/dist/fn/object/filterToConditions.d.ts +48 -0
  250. package/dist/fn/object/filterToConditions.js +68 -0
  251. package/dist/fn/object/findAll.d.ts +57 -0
  252. package/dist/fn/object/findAll.js +73 -0
  253. package/dist/fn/object/getField.d.ts +30 -0
  254. package/dist/fn/object/getField.js +37 -0
  255. package/dist/fn/object/getFieldValues.d.ts +30 -0
  256. package/dist/fn/object/getFieldValues.js +41 -0
  257. package/dist/fn/object/getProp.d.ts +8 -0
  258. package/dist/fn/object/getProp.js +13 -0
  259. package/dist/fn/object/getProperty.d.ts +30 -0
  260. package/dist/fn/object/getProperty.js +39 -0
  261. package/dist/fn/object/getRow.d.ts +42 -0
  262. package/dist/fn/object/getRow.js +49 -0
  263. package/dist/fn/object/map.d.ts +74 -0
  264. package/dist/fn/object/map.js +83 -0
  265. package/dist/fn/object/move.d.ts +34 -0
  266. package/dist/fn/object/move.js +43 -0
  267. package/dist/fn/object/multiorder.d.ts +40 -0
  268. package/dist/fn/object/multiorder.js +60 -0
  269. package/dist/fn/object/numProperties.d.ts +31 -0
  270. package/dist/fn/object/numProperties.js +36 -0
  271. package/dist/fn/object/order.d.ts +28 -0
  272. package/dist/fn/object/order.js +36 -0
  273. package/dist/fn/object/pickValue.d.ts +2 -0
  274. package/dist/fn/object/pickValue.js +6 -0
  275. package/dist/fn/object/removeEmpty.d.ts +18 -0
  276. package/dist/fn/object/removeEmpty.js +47 -0
  277. package/dist/fn/object/removePrivateProp.d.ts +24 -0
  278. package/dist/fn/object/removePrivateProp.js +41 -0
  279. package/dist/fn/object/search.d.ts +101 -0
  280. package/dist/fn/object/search.js +177 -0
  281. package/dist/fn/object/setProp.d.ts +11 -0
  282. package/dist/fn/object/setProp.js +17 -0
  283. package/dist/fn/object/setProperty.d.ts +30 -0
  284. package/dist/fn/object/setProperty.js +50 -0
  285. package/dist/fn/object/shortenObj.d.ts +25 -0
  286. package/dist/fn/object/shortenObj.js +40 -0
  287. package/dist/fn/object/shuffle.d.ts +2 -0
  288. package/dist/fn/object/shuffle.js +13 -0
  289. package/dist/fn/object/stat.d.ts +2 -0
  290. package/dist/fn/object/stat.js +49 -0
  291. package/dist/fn/object/sum.d.ts +46 -0
  292. package/dist/fn/object/sum.js +57 -0
  293. package/dist/fn/object/unique.d.ts +18 -0
  294. package/dist/fn/object/unique.js +22 -0
  295. package/dist/fn/string/baseName.d.ts +24 -0
  296. package/dist/fn/string/baseName.js +39 -0
  297. package/dist/fn/string/br2nl.d.ts +19 -0
  298. package/dist/fn/string/br2nl.js +22 -0
  299. package/dist/fn/string/camelToCss.d.ts +18 -0
  300. package/dist/fn/string/camelToCss.js +26 -0
  301. package/dist/fn/string/camelize.d.ts +20 -0
  302. package/dist/fn/string/camelize.js +27 -0
  303. package/dist/fn/string/correctCase.d.ts +18 -0
  304. package/dist/fn/string/correctCase.js +20 -0
  305. package/dist/fn/string/crc32.d.ts +2 -0
  306. package/dist/fn/string/crc32.js +20 -0
  307. package/dist/fn/string/dirName.d.ts +17 -0
  308. package/dist/fn/string/dirName.js +33 -0
  309. package/dist/fn/string/escapeDquotes.d.ts +2 -0
  310. package/dist/fn/string/escapeDquotes.js +8 -0
  311. package/dist/fn/string/escapeRegExp.d.ts +19 -0
  312. package/dist/fn/string/escapeRegExp.js +21 -0
  313. package/dist/fn/string/escapeSquotes.d.ts +2 -0
  314. package/dist/fn/string/escapeSquotes.js +8 -0
  315. package/dist/fn/string/escapeTicks.d.ts +2 -0
  316. package/dist/fn/string/escapeTicks.js +8 -0
  317. package/dist/fn/string/escapeUrl.d.ts +9 -0
  318. package/dist/fn/string/escapeUrl.js +47 -0
  319. package/dist/fn/string/fileExt.d.ts +38 -0
  320. package/dist/fn/string/fileExt.js +47 -0
  321. package/dist/fn/string/format.d.ts +2 -0
  322. package/dist/fn/string/format.js +14 -0
  323. package/dist/fn/string/formatBytes.d.ts +14 -0
  324. package/dist/fn/string/formatBytes.js +20 -0
  325. package/dist/fn/string/formatSize.d.ts +2 -0
  326. package/dist/fn/string/formatSize.js +12 -0
  327. package/dist/fn/string/hash.d.ts +7 -0
  328. package/dist/fn/string/hash.js +42 -0
  329. package/dist/fn/string/md5.d.ts +22 -0
  330. package/dist/fn/string/md5.js +142 -0
  331. package/dist/fn/string/nl2br.d.ts +17 -0
  332. package/dist/fn/string/nl2br.js +20 -0
  333. package/dist/fn/string/printf.d.ts +10 -0
  334. package/dist/fn/string/printf.js +15 -0
  335. package/dist/fn/string/quotes2html.d.ts +30 -0
  336. package/dist/fn/string/quotes2html.js +39 -0
  337. package/dist/fn/string/randomString.d.ts +28 -0
  338. package/dist/fn/string/randomString.js +72 -0
  339. package/dist/fn/string/removeAccents.d.ts +17 -0
  340. package/dist/fn/string/removeAccents.js +30 -0
  341. package/dist/fn/string/removeExtraSpaces.d.ts +7 -0
  342. package/dist/fn/string/removeExtraSpaces.js +9 -0
  343. package/dist/fn/string/removeHtmlComments.d.ts +2 -0
  344. package/dist/fn/string/removeHtmlComments.js +8 -0
  345. package/dist/fn/string/removeTrailingChars.d.ts +11 -0
  346. package/dist/fn/string/removeTrailingChars.js +25 -0
  347. package/dist/fn/string/repeat.d.ts +16 -0
  348. package/dist/fn/string/repeat.js +18 -0
  349. package/dist/fn/string/replaceAll.d.ts +23 -0
  350. package/dist/fn/string/replaceAll.js +29 -0
  351. package/dist/fn/string/sanitize.d.ts +17 -0
  352. package/dist/fn/string/sanitize.js +34 -0
  353. package/dist/fn/string/shorten.d.ts +27 -0
  354. package/dist/fn/string/shorten.js +42 -0
  355. package/dist/fn/string/simpleHash.d.ts +2 -0
  356. package/dist/fn/string/simpleHash.js +8 -0
  357. package/dist/fn/string/simpleHash1.d.ts +2 -0
  358. package/dist/fn/string/simpleHash1.js +10 -0
  359. package/dist/fn/string/simpleHash2.d.ts +2 -0
  360. package/dist/fn/string/simpleHash2.js +10 -0
  361. package/dist/fn/string/substr.d.ts +23 -0
  362. package/dist/fn/string/substr.js +38 -0
  363. package/dist/fn/string/trim.d.ts +2 -0
  364. package/dist/fn/string/trim.js +20 -0
  365. package/dist/fn/string/uniqString.d.ts +18 -0
  366. package/dist/fn/string/uniqString.js +49 -0
  367. package/dist/fn/style/addColors.d.ts +17 -0
  368. package/dist/fn/style/addColors.js +76 -0
  369. package/dist/fn/style/addStyle.d.ts +12 -0
  370. package/dist/fn/style/addStyle.js +20 -0
  371. package/dist/fn/style/animateCss.d.ts +13 -0
  372. package/dist/fn/style/animateCss.js +31 -0
  373. package/dist/fn/style/center.d.ts +16 -0
  374. package/dist/fn/style/center.js +40 -0
  375. package/dist/fn/style/cssExists.d.ts +12 -0
  376. package/dist/fn/style/cssExists.js +40 -0
  377. package/dist/fn/style/getCssVar.d.ts +7 -0
  378. package/dist/fn/style/getCssVar.js +12 -0
  379. package/dist/fn/style/getScrollBarSize.d.ts +2 -0
  380. package/dist/fn/style/getScrollBarSize.js +25 -0
  381. package/dist/fn/style/lightenDarkenHex.d.ts +20 -0
  382. package/dist/fn/style/lightenDarkenHex.js +45 -0
  383. package/dist/fn/style/outerHeight.d.ts +11 -0
  384. package/dist/fn/style/outerHeight.js +19 -0
  385. package/dist/fn/style/outerWidth.d.ts +10 -0
  386. package/dist/fn/style/outerWidth.js +16 -0
  387. package/dist/fn/style/resize.d.ts +2 -0
  388. package/dist/fn/style/resize.js +39 -0
  389. package/dist/fn/style/setCssVar.d.ts +8 -0
  390. package/dist/fn/style/setCssVar.js +14 -0
  391. package/dist/fn/type/checkType.d.ts +2 -0
  392. package/dist/fn/type/checkType.js +59 -0
  393. package/dist/fn/type/isArray.d.ts +14 -0
  394. package/dist/fn/type/isArray.js +23 -0
  395. package/dist/fn/type/isBlob.d.ts +9 -0
  396. package/dist/fn/type/isBlob.js +18 -0
  397. package/dist/fn/type/isBoolean.d.ts +16 -0
  398. package/dist/fn/type/isBoolean.js +25 -0
  399. package/dist/fn/type/isCanvas.d.ts +16 -0
  400. package/dist/fn/type/isCanvas.js +25 -0
  401. package/dist/fn/type/isColor.d.ts +31 -0
  402. package/dist/fn/type/isColor.js +45 -0
  403. package/dist/fn/type/isComment.d.ts +14 -0
  404. package/dist/fn/type/isComment.js +23 -0
  405. package/dist/fn/type/isCp.d.ts +2 -0
  406. package/dist/fn/type/isCp.js +17 -0
  407. package/dist/fn/type/isDate.d.ts +20 -0
  408. package/dist/fn/type/isDate.js +29 -0
  409. package/dist/fn/type/isDimension.d.ts +11 -0
  410. package/dist/fn/type/isDimension.js +24 -0
  411. package/dist/fn/type/isDom.d.ts +14 -0
  412. package/dist/fn/type/isDom.js +23 -0
  413. package/dist/fn/type/isEmail.d.ts +23 -0
  414. package/dist/fn/type/isEmail.js +37 -0
  415. package/dist/fn/type/isEmpty.d.ts +41 -0
  416. package/dist/fn/type/isEmpty.js +57 -0
  417. package/dist/fn/type/isEvent.d.ts +9 -0
  418. package/dist/fn/type/isEvent.js +18 -0
  419. package/dist/fn/type/isFunction.d.ts +16 -0
  420. package/dist/fn/type/isFunction.js +25 -0
  421. package/dist/fn/type/isHostname.d.ts +2 -0
  422. package/dist/fn/type/isHostname.js +16 -0
  423. package/dist/fn/type/isIP.d.ts +2 -0
  424. package/dist/fn/type/isIP.js +12 -0
  425. package/dist/fn/type/isInt.d.ts +18 -0
  426. package/dist/fn/type/isInt.js +27 -0
  427. package/dist/fn/type/isIterable.d.ts +27 -0
  428. package/dist/fn/type/isIterable.js +37 -0
  429. package/dist/fn/type/isNull.d.ts +14 -0
  430. package/dist/fn/type/isNull.js +23 -0
  431. package/dist/fn/type/isNumber.d.ts +19 -0
  432. package/dist/fn/type/isNumber.js +30 -0
  433. package/dist/fn/type/isObject.d.ts +19 -0
  434. package/dist/fn/type/isObject.js +28 -0
  435. package/dist/fn/type/isPercent.d.ts +14 -0
  436. package/dist/fn/type/isPercent.js +23 -0
  437. package/dist/fn/type/isPrimitive.d.ts +18 -0
  438. package/dist/fn/type/isPrimitive.js +27 -0
  439. package/dist/fn/type/isPromise.d.ts +18 -0
  440. package/dist/fn/type/isPromise.js +27 -0
  441. package/dist/fn/type/isPropSize.d.ts +2 -0
  442. package/dist/fn/type/isPropSize.js +12 -0
  443. package/dist/fn/type/isSQLDate.d.ts +10 -0
  444. package/dist/fn/type/isSQLDate.js +20 -0
  445. package/dist/fn/type/isSame.d.ts +41 -0
  446. package/dist/fn/type/isSame.js +72 -0
  447. package/dist/fn/type/isString.d.ts +14 -0
  448. package/dist/fn/type/isString.js +23 -0
  449. package/dist/fn/type/isSymbol.d.ts +15 -0
  450. package/dist/fn/type/isSymbol.js +24 -0
  451. package/dist/fn/type/isURL.d.ts +2 -0
  452. package/dist/fn/type/isURL.js +11 -0
  453. package/dist/fn/type/isValidDimension.d.ts +11 -0
  454. package/dist/fn/type/isValidDimension.js +24 -0
  455. package/dist/fn/type/isValidName.d.ts +27 -0
  456. package/dist/fn/type/isValidName.js +38 -0
  457. package/dist/fn/type/isValue.d.ts +26 -0
  458. package/dist/fn/type/isValue.js +36 -0
  459. package/dist/fn/type/isVue.d.ts +16 -0
  460. package/dist/fn/type/isVue.js +42 -0
  461. package/dist/fn.d.ts +4 -5
  462. package/dist/fn.js +226 -228
  463. package/package.json +1 -1
package/dist/bundle.d.ts CHANGED
@@ -1,56 +1,287 @@
1
- declare module "fn/isArray" {
1
+ declare module "fn/type/isArray" {
2
+ /**
3
+ * Returns true if the given argument is array.
4
+ * @method isArray
5
+ * @global
6
+ * @example
7
+ * ```javascript
8
+ * bbn.fn.isArray([5,2,6]);
9
+ * //true
10
+ * ```
11
+ * @memberof bbn.fn
12
+ * @returns {Boolean}
13
+ */
2
14
  const isArray: (...args: any[]) => boolean;
3
15
  export { isArray };
4
16
  }
5
- declare module "fn/isNumber" {
17
+ declare module "fn/type/isNumber" {
18
+ /**
19
+ * Returns true if the given argument is a number
20
+ * @method isNumber
21
+ * @global
22
+ * @example
23
+ * ```javascript
24
+ * bbn.fn.isNumber(5);
25
+ * //true
26
+ * ```
27
+ * @example
28
+ * ```javascript
29
+ * bbn.fn.isNumber(0.5);
30
+ * //true
31
+ * ```
32
+ * @memberof bbn.fn
33
+ * @returns {Boolean}
34
+ */
6
35
  const isNumber: (...args: any[]) => boolean;
7
36
  export { isNumber };
8
37
  }
9
- declare module "fn/isIterable" {
10
- const isIterable: (v: any) => boolean;
38
+ declare module "fn/type/isIterable" {
39
+ /**
40
+ * Returns true if the given object can be iterated as an array (numerically).
41
+ *
42
+ * It is possible to pass as argument a string with hexadecimal value in rgb or the name of the color.
43
+ *
44
+ * @method isIterable
45
+ * @global
46
+ * @memberof bbn.fn
47
+ *
48
+ * @example
49
+ * ```javascript
50
+ * bbn.fn.isIterable([1, 2])
51
+ * // true
52
+ * bbn.fn.isIterable({a: 1, b: 2})
53
+ * // false
54
+ * bbn.fn.isIterable(25)
55
+ * // false
56
+ * bbn.fn.isIterable(document.body.querySelectorAll('.container > div'))
57
+ * // true
58
+ * ```
59
+ *
60
+ * @param {String} st
61
+ *
62
+ * @returns {Boolean}
63
+ */
64
+ const isIterable: (...args: any[]) => boolean;
11
65
  export { isIterable };
12
66
  }
13
- declare module "fn/isString" {
67
+ declare module "fn/type/isString" {
68
+ /**
69
+ * Returns true if the given argument is a string;
70
+ * @method isString
71
+ * @global
72
+ * @example
73
+ * ```javascript
74
+ * bbn.fn.isString('bbn');
75
+ * //true
76
+ * ```
77
+ * @memberof bbn.fn
78
+ * @returns {Boolean}
79
+ */
14
80
  const isString: (...args: any[]) => boolean;
15
81
  export { isString };
16
82
  }
17
- declare module "fn/isInt" {
83
+ declare module "fn/type/isInt" {
84
+ /**
85
+ * Returns true if the given argument is an integer
86
+ * @method isInt
87
+ * @global
88
+ * @example
89
+ * ```javascript
90
+ * bbn.fn.isInt(5);
91
+ * // true
92
+ * bbn.fn.isInt(0.5);
93
+ * // false
94
+ * bbn.fn.isInt("hello");
95
+ * // false
96
+ * ```
97
+ * @memberof bbn.fn
98
+ * @returns {Boolean}
99
+ */
18
100
  const isInt: (...args: any[]) => boolean;
19
101
  export { isInt };
20
102
  }
21
- declare module "fn/isFunction" {
103
+ declare module "fn/type/isFunction" {
104
+ /**
105
+ * Returns true if the given argument is a function.
106
+ * @global
107
+ * @example
108
+ * ```javascript
109
+ * bbn.fn.isFunction(() => {
110
+ * alert('Hello world');
111
+ * });
112
+ * //true
113
+ * ```
114
+ * @method isFunction
115
+ * @memberof bbn.fn
116
+ * @returns {Boolean}
117
+ */
22
118
  const isFunction: (...args: any[]) => boolean;
23
119
  export { isFunction };
24
120
  }
25
- declare module "fn/log" {
121
+ declare module "fn/browser/log" {
122
+ /**
123
+ * Logs the given arguments in the browser's console.
124
+ * @method log
125
+ * @global
126
+ * @example
127
+ * ```javascript
128
+ * //'hello'
129
+ * bbn.fn.log('hello');
130
+ * ```
131
+ * @memberof bbn.fn
132
+ * @param {...any} args
133
+ * @returns
134
+ */
26
135
  const log: (...args: any[]) => any;
27
136
  export { log };
28
137
  }
29
- declare module "fn/substr" {
138
+ declare module "fn/string/substr" {
139
+ /**
140
+ * Basic substring function accepting both positive and negative values.
141
+ *
142
+ * @method substr
143
+ * @global
144
+ *
145
+ * @example
146
+ * ```javascript
147
+ * bbn.fn.substr(bbn.fn, 'Hello', -3, -1);
148
+ * // "ll"
149
+ * bbn.fn.substr(bbn.fn, 'Hello', -3);
150
+ * // "llo"
151
+ * bbn.fn.substr(bbn.fn, 'Hello', 0, 1);
152
+ * // "H"
153
+ * ```
154
+ * @memberof bbn.fn
155
+ * @param {String} str
156
+ * @param {Number} from
157
+ * @param {Number} length
158
+ * @returns {String} Result substring
159
+ */
30
160
  const substr: (str: string, from: number, length?: number) => string;
31
161
  export { substr };
32
162
  }
33
- declare module "fn/removePrivateProp" {
163
+ declare module "fn/object/removePrivateProp" {
164
+ /**
165
+ * Returns an object with the original objects' properties starting with an alphanumeric character.
166
+ *
167
+ * It is presumed that external libraries, bbn variables use prefixes such as _ or $ for
168
+ * naming private properties; this returns a new object purged from these properties.
169
+ *
170
+ * @method removePrivateProp
171
+ * @global
172
+ * @example
173
+ * ```javascript
174
+ * bbn.fn.removePrivateProp({
175
+ * _bbn_timestamp: 1587269593987,
176
+ * name: "Wonka",
177
+ * fname: "Willy"
178
+ * });
179
+ * // {name: "Wonka", fname: "Willy"}
180
+ * ```
181
+ * @memberof bbn.fn
182
+ * @param {Object} obj The original object
183
+ * @param {Boolean} deep If true the function will be reapplied on object properties
184
+ * @returns {Object} A new object without only the _public_ properties.
185
+ */
34
186
  const removePrivateProp: (obj: object, deep?: boolean) => any;
35
187
  export { removePrivateProp };
36
188
  }
37
- declare module "fn/iterate" {
189
+ declare module "fn/loop/iterate" {
190
+ /**
191
+ * Executes the provided function on each property of the given object.
192
+ *
193
+ * @method iterate
194
+ * @global
195
+ * @example
196
+ * ```javascript
197
+ * //["value1", 2]
198
+ * let arr = [];
199
+ * bbn.fn.iterate({field1: "value1", field2: 2}, (val, idx) => {
200
+ * arr.push(value);
201
+ * });
202
+ * ```
203
+ * @memberof bbn.fn
204
+ * @param {(Object|Number)} obj The object to loop on
205
+ * @param {Function} fn The function, gets the array's element and the index as arguments
206
+ * @param {Boolean} noPrivate If set to true the _private_ properties won't be included
207
+ * @param {Boolean} reverse If set to true the order of the keys will be reversed
208
+ * @returns {Object}
209
+ */
38
210
  const iterate: (obj: object, fn: (a: any, b: string) => any, noPrivate?: boolean, reverse?: boolean) => object;
39
211
  export { iterate };
40
212
  }
41
- declare module "fn/each" {
213
+ declare module "fn/loop/each" {
214
+ /**
215
+ * Executes the provided function on each element of the given array.
216
+ *
217
+ * Returning false will stop the loop.
218
+ *
219
+ * @method each
220
+ * @global
221
+ * @example
222
+ * ```javascript
223
+ * let res = 0;
224
+ * bbn.fn.each([4, 5, 5, 10, 1, 2], d => {
225
+ * res += d;
226
+ * });
227
+ * // res = 27
228
+ * ```
229
+ * @example
230
+ * ```javascript
231
+ * let res = 0;
232
+ * bbn.fn.each([4, 5, 5, 10, 1, 2], d => {
233
+ * if (res >= 20) {
234
+ * return false;
235
+ * }
236
+ * res += d;
237
+ * });
238
+ * // res = 24
239
+ * ```
240
+ * @memberof bbn.fn
241
+ * @param {*} arr The array to loop on
242
+ * @param {Function} fn The function, gets the array's element and the index as arguments
243
+ * @returns {[Array, Object, void]}
244
+ */
42
245
  const each: (arr: any, fn: any) => any;
43
246
  export { each };
44
247
  }
45
- declare module "fn/correctCase" {
248
+ declare module "fn/string/correctCase" {
249
+ /**
250
+ * Converts the first character of the string to uppercase.
251
+ *
252
+ * @method correctCase
253
+ * @global
254
+ *
255
+ * @example
256
+ * ```javascript
257
+ * //"This is a test"
258
+ * bbn.fn.correctCase("this is a test");
259
+ * ```
260
+ *
261
+ * @memberof bbn.fn
262
+ * @param {STring} str
263
+ * @returns {String}
264
+ */
46
265
  const correctCase: (str: any) => any;
47
266
  export { correctCase };
48
267
  }
49
- declare module "fn/error" {
268
+ declare module "fn/browser/error" {
269
+ /**
270
+ * Throws an error.
271
+ * @method error
272
+ * @global
273
+ * @ignore
274
+ * ``` javascript
275
+ * bbn.fn.error('I log this error in console with a red background')
276
+ * ```
277
+ * @memberof bbn.fn
278
+ * @param {String} errorMsg
279
+ * @returns
280
+ */
50
281
  const error: (errorMsg: any) => never;
51
282
  export { error };
52
283
  }
53
- declare module "fn/checkType" {
284
+ declare module "fn/type/checkType" {
54
285
  const checkType: (value: any, type: object | string, msg?: string, ...logs: any[]) => void;
55
286
  export { checkType };
56
287
  }
@@ -200,83 +431,449 @@ declare module "db" {
200
431
  const db: Db;
201
432
  export { db };
202
433
  }
203
- declare module "fn/_addLoader" {
434
+ declare module "fn/ajax/_addLoader" {
435
+ /**
436
+ * Creates and adds a "loader" object to the property bbn.env.loaders.
437
+ *
438
+ * @method _addLoader
439
+ * @global
440
+ * @ignore
441
+ * @memberof bbn.fn
442
+ *
443
+ * @param {String} requestId
444
+ * @param {Promise} prom
445
+ * @param {Object} source
446
+ *
447
+ * @returns {Number} The timestamp (in ms)
448
+ */
204
449
  const _addLoader: (requestId: any, prom: any, source: any) => number;
205
450
  export { _addLoader };
206
451
  }
207
- declare module "fn/getProperty" {
452
+ declare module "fn/object/getProperty" {
453
+ /**
454
+ * Returns the value of the given property from the given object.
455
+ *
456
+ * Looks for the given property in the given object, accepting dot (.) separator
457
+ * for deep property access, and returns its value if found and undefined otherwise.
458
+ *
459
+ * @method getProperty
460
+ * @global
461
+ * @example
462
+ * ```javascript
463
+ * bbn.fn.getProperty({a: 1, b: 2}, 'b');
464
+ * // 2
465
+ * ```
466
+ * @example
467
+ * ```javascript
468
+ * bbn.fn.getProperty({a: 1, b: {o: {a: 33, h: 5}}}, 'b.o.a');
469
+ * // 33
470
+ * ```
471
+ * @example
472
+ * ```javascript
473
+ * bbn.fn.getProperty({a: 1, b: {o: {a: 33, h: 5}}}, 'b.h.a');
474
+ * // undefined
475
+ * ```
476
+ * @memberof bbn.fn
477
+ * @param {Object} obj
478
+ * @param {String} prop
479
+ * @returns {*} The property's value or undefined
480
+ */
208
481
  const getProperty: (obj: any, prop: any) => any;
209
482
  export { getProperty };
210
483
  }
211
- declare module "fn/removeAccents" {
484
+ declare module "fn/string/removeAccents" {
485
+ /**
486
+ * Returns the string passed as an argument without accents.
487
+ *
488
+ * @method removeAccents
489
+ * @global
490
+ *
491
+ * @example
492
+ * ```javascript
493
+ * //"eeou"
494
+ * bbn.fn.removeAccents("èéòù");
495
+ * ```
496
+ * @memberof bbn.fn
497
+ * @param {String} st
498
+ * @returns {String}
499
+ */
212
500
  const removeAccents: (st: string) => string;
213
501
  export { removeAccents };
214
502
  }
215
- declare module "fn/isDate" {
503
+ declare module "fn/type/isDate" {
504
+ /**
505
+ * Returns true if the given argument is a date object.
506
+ * @method isDate
507
+ * @global
508
+ * @example
509
+ * ```javascript
510
+ * let date = new Date();
511
+ * bbn.fn.isDate(date);
512
+ * //true
513
+ * ```
514
+ * @example
515
+ * ```javascript
516
+ * bbn.fn.isDate('16/04/2020');
517
+ * //false
518
+ * ```
519
+ * @memberof bbn.fn
520
+ * @returns {Boolean}
521
+ */
216
522
  const isDate: (...args: any[]) => boolean;
217
523
  export { isDate };
218
524
  }
219
- declare module "fn/_compareValues" {
525
+ declare module "fn/object/_compareValues" {
526
+ /**
527
+ * Compares the given property in the given objects and returns -1, 1, or 0 depending on their difference.
528
+ *
529
+ * This is only used as a sorting function by bbn.fn.order and bbn.fn.multiorder.
530
+ *
531
+ * @method _compareValues
532
+ * @global
533
+ * @example
534
+ * ```javascript
535
+ * // Same value
536
+ * bbn.fn._compareValues({year: 2015, value: 2}, {year: 2016, value: 2}, 'value');
537
+ * // 0
538
+ * ```
539
+ * @example
540
+ * ```javascript
541
+ * // First value smaller than second
542
+ * bbn.fn._compareValues({year: 2015, value: 2}, {year: 2016, value: 2}, 'year');
543
+ * // -1
544
+ * ```
545
+ * @example
546
+ * ```javascript
547
+ * // First value greater than second
548
+ * bbn.fn._compareValues({year: 2017, value: 2}, {year: 2016, value: 2}, 'year');
549
+ * // 1
550
+ * ```
551
+ * @example
552
+ * ```javascript
553
+ * // First value is undefined
554
+ * bbn.fn._compareValues({year: 2017}, {year: 2016, value: 2}, 'value');
555
+ * // 1
556
+ * ```
557
+ * @memberof bbn.fn
558
+ * @param {Object} a First object for comparison
559
+ * @param {Object} b Second object for comparison
560
+ * @param {String} prop Property to compare
561
+ * @param {String} [dir=asc] Direction of comparison (desc or asc by default)
562
+ * @returns {Number} Always either -1, 1, or 0
563
+ */
220
564
  const _compareValues: (a: any, b: any, prop: any, dir?: string) => 0 | 1 | -1;
221
565
  export { _compareValues };
222
566
  }
223
- declare module "fn/numProperties" {
567
+ declare module "fn/object/numProperties" {
568
+ /**
569
+ * Returns the number of properties contained in the object.
570
+ *
571
+ * Only takes into account the own properties - not the inherited ones - and the non _private_ ones.
572
+ *
573
+ * @method numProperties
574
+ * @global
575
+ * @example
576
+ * ```javascript
577
+ * bbn.fn.numProperties({author: "Chuck Palahniuk", "title": "Fight club"});
578
+ * // 2
579
+ * ```
580
+ * @example
581
+ * ```javascript
582
+ * bbn.fn.numProperties({username: "chuck", "password": "soap", _bbn_timestamp: 1587323193751});
583
+ * // 2
584
+ * @example
585
+ * ```javascript
586
+ * let d = new Date();
587
+ * bbn.fn.numProperties(d);
588
+ * // 0
589
+ * d.myProp = 1;
590
+ * bbn.fn.numProperties(d);
591
+ * // 1
592
+ * ```
593
+ * @memberof bbn.fn
594
+ * @param {Object} obj The object to analyze
595
+ * @returns {Number} The number of properties
596
+ */
224
597
  const numProperties: (obj: object) => number;
225
598
  export { numProperties };
226
599
  }
227
- declare module "fn/isEmpty" {
600
+ declare module "fn/type/isEmpty" {
601
+ /**
602
+ * Checks if the argument is empty or not.
603
+ * @method isEmpty
604
+ * @global
605
+ *
606
+ * @example
607
+ * ```javascript
608
+ * bbn.fn.isEmpty({});
609
+ * //true
610
+ * ```
611
+ * @example
612
+ * ```javascript
613
+ * bbn.fn.isEmpty({test : 1});
614
+ * //false
615
+ * ```
616
+ * @example
617
+ * ```javascript
618
+ * bbn.fn.isEmpty([]);
619
+ * //true
620
+ * ```
621
+ * @example
622
+ * ```javascript
623
+ * bbn.fn.isEmpty(['test']);
624
+ * //false
625
+ * ```
626
+ * @example
627
+ * ```javascript
628
+ * bbn.fn.isEmpty('');
629
+ * //true
630
+ * ```
631
+ * @example
632
+ * ```javascript
633
+ * bbn.fn.isEmpty('test');
634
+ * //false
635
+ * ```
636
+ * @memberof bbn.fn
637
+ * @param {*} obj
638
+ * @returns {Boolean}
639
+ */
228
640
  const isEmpty: (obj: any) => boolean;
229
641
  export { isEmpty };
230
642
  }
231
- declare module "fn/isNull" {
643
+ declare module "fn/type/isNull" {
644
+ /**
645
+ * Returns true if the given argument is null;
646
+ * @method isNull
647
+ * @global
648
+ * @example
649
+ * ```javascript
650
+ * bbn.fn.isNull(myData);
651
+ * //true
652
+ * ```
653
+ * @memberof bbn.fn
654
+ * @returns {Boolean}
655
+ */
232
656
  const isNull: (...args: any[]) => boolean;
233
657
  export { isNull };
234
658
  }
235
- declare module "fn/isObject" {
659
+ declare module "fn/type/isObject" {
660
+ /**
661
+ * Returns true if the given argument is an object.
662
+ * @method isObject
663
+ * @global
664
+ * @example
665
+ * ```javascript
666
+ * bbn.fn.isObject({name: 'cami', age: 7});
667
+ * //true
668
+ * ```
669
+ * @example
670
+ * ```javascript
671
+ * bbn.fn.isObject([{name: 'cami', age: 7}]);
672
+ * //false
673
+ * ```
674
+ * @memberof bbn.fn
675
+ * @returns {Boolean}
676
+ */
236
677
  const isObject: (...args: any[]) => boolean;
237
678
  export { isObject };
238
679
  }
239
- declare module "fn/isDom" {
680
+ declare module "fn/type/isDom" {
681
+ /**
682
+ * Returns true if the given argument is a dom element;
683
+ * @method isDom
684
+ * @example
685
+ * ```javascript
686
+ * bbn.fn.isDom(document.body.childNodes[0]);
687
+ * //true
688
+ * ```
689
+ * @global
690
+ * @memberof bbn.fn
691
+ * @returns {Boolean}
692
+ */
240
693
  const isDom: (...args: any[]) => boolean;
241
694
  export { isDom };
242
695
  }
243
- declare module "fn/isCp" {
696
+ declare module "fn/type/isCp" {
244
697
  const isCp: (...args: any[]) => boolean;
245
698
  export { isCp };
246
699
  }
247
- declare module "fn/circularReplacer" {
700
+ declare module "fn/object/circularReplacer" {
701
+ /**
702
+ * Returns a function to give to JSON.stringify in order to avoid circular values.
703
+ *
704
+ * @returns Function
705
+ */
248
706
  const circularReplacer: () => (key: any, value: any) => any;
249
707
  export { circularReplacer };
250
708
  }
251
- declare module "fn/simpleHash1" {
709
+ declare module "fn/string/simpleHash1" {
252
710
  const simpleHash1: (str: string) => number;
253
711
  export { simpleHash1 };
254
712
  }
255
- declare module "fn/simpleHash2" {
713
+ declare module "fn/string/simpleHash2" {
256
714
  const simpleHash2: (str: string) => number;
257
715
  export { simpleHash2 };
258
716
  }
259
- declare module "fn/simpleHash" {
717
+ declare module "fn/string/simpleHash" {
260
718
  const simpleHash: (str: any) => string;
261
719
  export { simpleHash };
262
720
  }
263
- declare module "fn/hash" {
721
+ declare module "fn/string/hash" {
722
+ /**
723
+ * Makes a hash out of anything
724
+ * @param {Object|Array} obj
725
+ * @returns {String}
726
+ */
264
727
  const hash: (obj: any) => string;
265
728
  export { hash };
266
729
  }
267
- declare module "fn/isSame" {
730
+ declare module "fn/type/isSame" {
731
+ /**
732
+ * Checks whether the data contained in the given objects is identical.
733
+ *
734
+ * The properties starting with a non alphanumerical character and the
735
+ * inherited ones are removed for the comparison, then the properties are
736
+ * compared individually without the order being taken into account.
737
+ *
738
+ * @method isSame
739
+ * @global
740
+ * @example
741
+ * ```javascript
742
+ * bbn.fn.isSame(
743
+ * {name: "Wonka", fname: "Willy"},
744
+ * {fname: "Willy", name: "Wonka"}
745
+ * );
746
+ * // true
747
+ * ```
748
+ * @example
749
+ * ```javascript
750
+ * // Doesn't take into account properties starting with non-alphanumeric characters
751
+ * bbn.fn.isSame(
752
+ * {name: "Wonka", fname: "Willy", _bbn_timestamp: 1587269593987},
753
+ * {fname: "Willy", name: "Wonka"}
754
+ * );
755
+ * // true
756
+ * ```
757
+ * @example
758
+ * ```javascript
759
+ * bbn.fn.isSame(
760
+ * {name: "Wonka", fname: "Willy", real: false},
761
+ * {fname: "Willy", name: "Wonka"}
762
+ * );
763
+ * // false
764
+ * ```
765
+ * @memberof bbn.fn
766
+ * @param {Object} obj1
767
+ * @param {Object} obj2
768
+ * @returns {Boolean}
769
+ */
268
770
  const isSame: (obj1: any, obj2: any, done?: any[]) => boolean;
269
771
  export { isSame };
270
772
  }
271
- declare module "fn/compare" {
773
+ declare module "fn/object/compare" {
774
+ /**
775
+ * Performs a comparison between two values based on the given operator and returns a boolean.
776
+ *
777
+ * It is internally used by all the filtering functions; the available operators are:
778
+ * - _===_, _=_, _equal_, _eq_, _is_, which stand for __===__
779
+ * - _!==_, _notequal_, _neq_, _isnot_, which stand for __!==__
780
+ * - _!=_, _different_, which stand for __!=__
781
+ * - _contains_, _contain_, _icontains_, _icontain_
782
+ * - _starts_, _start_
783
+ * - _startswith_, _startsi_, _starti_, _istarts_, _istart_
784
+ * - _endswith_, _endsi_, _endi_, _iends_, _iend_
785
+ * - _like_
786
+ * - _gt_, _>_, which stand for __>__
787
+ * - _lt_, _<_, which stand for __<__
788
+ * - _gte_, _>=_, which stand for __>=__
789
+ * - _lte_, _<=_, which stand for __<=__
790
+ * - _isnull_, which stands for __=== null__
791
+ * - _isnotnull_, which stands for __!== null__
792
+ * - _isempty_, which stands for __=== ''__
793
+ * - _isnotempty_, which stands for __!== ''__
794
+ *
795
+ * The defaut operator (if none is given) is __==__ .
796
+ *
797
+ * @method compare
798
+ * @global
799
+ * @example
800
+ * ```javascript
801
+ * bbn.fn.compare('foo', 'bar', 'eq');
802
+ * // false
803
+ * ```
804
+ * @example
805
+ * ```javascript
806
+ * bbn.fn.compare('foo', 'bar', 'neq');
807
+ * // true
808
+ * ```
809
+ * @example
810
+ * ```javascript
811
+ * bbn.fn.compare(3, 1, '>');
812
+ * // true
813
+ * ```
814
+ * @example
815
+ * ```javascript
816
+ * bbn.fn.compare("JavaScript", "script", 'contain');
817
+ * // true
818
+ * ```
819
+ * @memberof bbn.fn
820
+ * @param {String|Number} v1
821
+ * @param {String|Number} v2
822
+ * @param {String} operator
823
+ * @returns {Boolean} True if the values' comparison complies with the operator, false otherwise
824
+ */
272
825
  const compare: (v1: any, v2: any, operator: any) => boolean;
273
826
  export { compare };
274
827
  }
275
- declare module "fn/compareConditions" {
828
+ declare module "fn/object/compareConditions" {
829
+ /**
830
+ * Checks whether the given data object complies or not with the given filter.
831
+ *
832
+ * The filter format must be full (i.e. with the properties logic and conditions) such as
833
+ * seen in the function bbn.fn.search and can be generated by the function bbn.fn.filterToConditions.
834
+ *
835
+ * @method compareConditions
836
+ * @global
837
+ * @example
838
+ * ```javascript
839
+ * let item = {name: "Raiders of the lost ark", director: "Steven Spielberg", year: 1981, id: 589};
840
+ * bbn.fn.compareConditions(item, {
841
+ * logic: "AND",
842
+ * conditions: [
843
+ * {
844
+ * field: "director",
845
+ * value: "Steven Spielberg"
846
+ * }
847
+ * ]
848
+ * });
849
+ * // true
850
+ * bbn.fn.compareConditions(item, bbn.fn.filterToConditions({director: "Steven Soderberg"}));
851
+ * // false
852
+ * bbn.fn.compareConditions(item, bbn.fn.filterToConditions({director: "Steven Spielberg"}));
853
+ * // true
854
+ * bbn.fn.compareConditions(item, bbn.fn.filterToConditions({year: 1980}, ">"));
855
+ * // true
856
+ * bbn.fn.compareConditions(item, {
857
+ * logic: "AND",
858
+ * conditions: [
859
+ * {
860
+ * field: "year",
861
+ * operator: "<",
862
+ * value: 1980
863
+ * }
864
+ * ]
865
+ * });
866
+ * // false
867
+ * ```
868
+ * @memberof bbn.fn
869
+ * @param {Object} data
870
+ * @param {Object} filter
871
+ * @returns {Boolean}
872
+ */
276
873
  const compareConditions: (data: any, filter: any) => boolean;
277
874
  export { compareConditions };
278
875
  }
279
- declare module "fn/filterToConditions" {
876
+ declare module "fn/object/filterToConditions" {
280
877
  interface Condition {
281
878
  field: string;
282
879
  operator?: string;
@@ -286,104 +883,730 @@ declare module "fn/filterToConditions" {
286
883
  conditions?: Condition[];
287
884
  logic?: string;
288
885
  }
886
+ /**
887
+ * Converts the given object 'filter' to a valid format of condition.
888
+ *
889
+ * The resulting format will comply with bbn.fn.compareConditions and also with
890
+ * bbn databases functions and complex filters applied to bbn-vue list components.
891
+ *
892
+ * @method filterToConditions
893
+ * @global
894
+ * @example
895
+ * ```javascript
896
+ * bbn.fn.filterToConditions({num: 3});
897
+ * // {
898
+ * // logic: "AND",
899
+ * // conditions: [{
900
+ * // field: "num",
901
+ * // operator: "=",
902
+ * // value: 3
903
+ * // }]
904
+ * // }
905
+ * ```
906
+ * @example
907
+ * ```javascript
908
+ * bbn.fn.filterToConditions({num: 3}, '>');
909
+ * // {
910
+ * // logic: "AND",
911
+ * // conditions: [{
912
+ * // field: "num",
913
+ * // operator: ">",
914
+ * // value: 3
915
+ * // }]
916
+ * // }
917
+ * ```
918
+ * @memberof bbn.fn
919
+ * @param {Object} filter
920
+ * @param {String} operator
921
+ * @returns {Object}
922
+ */
289
923
  const filterToConditions: (filter: any, operator?: string) => Filter;
290
924
  export { Filter, filterToConditions };
291
925
  }
292
- declare module "fn/search" {
293
- import { Filter } from "fn/filterToConditions";
926
+ declare module "fn/object/search" {
927
+ import { Filter } from "fn/object/filterToConditions";
928
+ /**
929
+ * Retrieves the index of the array's first element corresponding to the given filter.
930
+ *
931
+ * Returns -1 if the element is not found. If the second parameter is an object or function
932
+ * for filtering as defined in bbn.fn.filter, the remaining parameters will be shifted to the
933
+ * left, i.e. val becomes operator, and operator startFrom. And if operator is a number, its value will
934
+ * be given to startFrom and operator will be undefined. The filter object can be complex with different
935
+ * operators (as seen in bbn.fn.compare) and logics (AND/OR), and infinitely nested, of this form:
936
+ * ```javascript
937
+ * {
938
+ * logic: "AND",
939
+ * conditions: [
940
+ * {
941
+ * field: "prop1",
942
+ * operator: "eq",
943
+ * value: "value1"
944
+ * }, {
945
+ * logic: "OR",
946
+ * conditions: [
947
+ * {
948
+ * field: "prop2",
949
+ * operator: "eq",
950
+ * value: 1
951
+ * }. {
952
+ * field: "prop2",
953
+ * operator: "eq",
954
+ * value: 2
955
+ * }
956
+ * ]
957
+ * }
958
+ * ]
959
+ * }
960
+ * ```
961
+ * This way of managing the arguments is used in all the filtering functions.
962
+ *
963
+ * @method search
964
+ * @global
965
+ * @example
966
+ * ```javascript
967
+ * let ar = [
968
+ * {name: "Raiders of the lost ark", director: "Steven Spielberg", year: 1981, id: 589},
969
+ * {name: "Goonies", director: "Richard Donner", year: 1985, id: 689},
970
+ * {name: "Star wars", director: "George Lucas", year: 1977, id: 256},
971
+ * {name: "Jaws", director: "Steven Spielberg", year: 1975, id: 423}
972
+ * ];
973
+ *
974
+ * bbn.fn.search(ar, "id", 256);
975
+ * // 2
976
+ *
977
+ * bbn.fn.search(ar, {director: "Steven Spielberg"});
978
+ * // 0
979
+ *
980
+ * bbn.fn.search(ar, {year: 1975, director: "Steven Spielberg"});
981
+ * // 3
982
+ *
983
+ * bbn.fn.search(ar, {director: "Steven Spielberg"}, 1);
984
+ * // 3
985
+ *
986
+ * // Complex filters
987
+ * bbn.fn.search(ar, {
988
+ * logic: "AND",
989
+ * conditions: [
990
+ * {
991
+ * field: "director",
992
+ * operator: "eq",
993
+ * value: "Steven Spielberg"
994
+ * }, {
995
+ * logic: "OR",
996
+ * conditions: [
997
+ * {
998
+ * field: "year",
999
+ * operator: "eq",
1000
+ * value: 1974
1001
+ * }, {
1002
+ * field: "year",
1003
+ * operator: "eq",
1004
+ * value: 1975
1005
+ * }
1006
+ * ]
1007
+ * }
1008
+ * ]
1009
+ * });
1010
+ * // 3
1011
+ *
1012
+ * Simple array
1013
+ * bbn.fn.search(['a', 'b', 'c'], null, 'b');
1014
+ * // 1
1015
+ *
1016
+ * ```
1017
+ *
1018
+ * @memberof bbn.fn
1019
+ * @param {Array} arr The subject array
1020
+ * @param {(String|Object|Function)} prop A property's name or a filter object or function
1021
+ * @param {*} val The value with which comparing the given property
1022
+ * @param {String} operator The operator to use for comparison with the value as used in bbn.fn.compare
1023
+ * @param {Number} startFrom The index from which the search should start
1024
+ * @returns {Number} The index if found, otherwise -1
1025
+ */
294
1026
  const search: (arr: any[], prop: string | object | Filter | ((a: any, i: string | number | symbol) => boolean), val?: any, operator?: number | string, startFrom?: number) => number;
295
1027
  export { search };
296
1028
  }
297
- declare module "fn/getRow" {
1029
+ declare module "fn/object/getRow" {
1030
+ /**
1031
+ * Returns the first object matching the given filter in an array of objects.
1032
+ *
1033
+ * The filtering arguments follow the same scheme as bbn.fn.search.
1034
+ *
1035
+ * @method getRow
1036
+ * @global
1037
+ * @example
1038
+ * ```javascript
1039
+ * let ar = [
1040
+ * {name: "Raiders of the lost ark", director: "Steven Spielberg", year: 1981, id: 589},
1041
+ * {name: "Goonies", director: "Richard Donner", year: 1985, id: 689},
1042
+ * {name: "Star wars", director: "George Lucas", year: 1977, id: 256},
1043
+ * {name: "Jaws", director: "Steven Spielberg", year: 1975, id: 423}
1044
+ * ];
1045
+ * bbn.fn.getRow(ar, {director: "Steven Spielberg"});
1046
+ * // {name: "Raiders of the lost ark", director: "Steven Spielberg", year: 1981, id: 589},
1047
+ * bbn.fn.getRow(ar, "director", "Steven Spielberg");
1048
+ * // Same result as the previous example
1049
+ * bbn.fn.getRow(ar, {
1050
+ * logic: "OR",
1051
+ * conditions: [
1052
+ * {
1053
+ * field: "director",
1054
+ * value: "Richard Donner"
1055
+ * }, {
1056
+ * field: "director",
1057
+ * value: "George Lucas"
1058
+ * }
1059
+ * ]
1060
+ * );
1061
+ * // {name: "Goonies", director: "Richard Donner", year: 1985, id: 689},
1062
+ * ```
1063
+ * @memberof bbn.fn
1064
+ * @param {Array} arr The subject array
1065
+ * @param {(String|Object|Function)} prop A property's name or a filter object or function
1066
+ * @param {*} val The value with which comparing the given property
1067
+ * @param {String} operator The operator to use for comparison with the value as used in bbn.fn.compare
1068
+ * @returns {Object|Boolean} The item if found, false otherwise
1069
+ */
298
1070
  const getRow: (arr: any[], prop: object | string, val?: any, operator?: string) => any | false;
299
1071
  export { getRow };
300
1072
  }
301
- declare module "fn/_deleteLoader" {
1073
+ declare module "fn/ajax/_deleteLoader" {
1074
+ /**
1075
+ * Deletes a loader and changes its history state after the promise is fullfilled.
1076
+ *
1077
+ * @method _deleteLoader
1078
+ * @global
1079
+ * @ignore
1080
+ * @memberof bbn.fn
1081
+ *
1082
+ * @param {String} requestId The unique ID of the request sent
1083
+ * @param {*} res The result of the request
1084
+ * @param {Boolean} isAbort True if the deletion comes from abortion
1085
+ *
1086
+ * @returns {Boolean} True if the loader was found
1087
+ */
302
1088
  const _deleteLoader: (requestId: string, res?: any, isAbort?: boolean) => boolean;
303
1089
  export { _deleteLoader };
304
1090
  }
305
- declare module "fn/getLoader" {
1091
+ declare module "fn/ajax/getLoader" {
1092
+ /**
1093
+ * Finds the loader object corresponding to the given unique ID and returns it if found.
1094
+ *
1095
+ * The loader is an object representing an Ajax request, with the following properties:
1096
+ * * _key_ is the unique ID (_requestId_) of the loader
1097
+ * * _url_ is the URL called by the request
1098
+ * * _loader_ is the Promise from the Axios XHR
1099
+ * * _source_ is the source object for aborting the request
1100
+ * * _start_ is the timestamp of the moment the request was sent
1101
+ *
1102
+ * @method getLoader
1103
+ * @global
1104
+ * @memberof bbn.fn
1105
+ *
1106
+ * @example
1107
+ * ```javascript
1108
+ * bbn.fn.post('my/script', {a: 1, b: 2});
1109
+ * let requestId = bbn.fn.getRequestId('my/script', {a: 1, b: 2});
1110
+ * if (requestId) {
1111
+ * let loader = bbn.fn.getLoader(requestId);
1112
+ * console.log(loader);
1113
+ * // {
1114
+ * // key: "my/script:af27f0e81533ae2bae3c25dea67359f6",
1115
+ * // url: "my/script",
1116
+ * // loader: {Promise},
1117
+ * // source: {token: {CancelToken}, cancel: {Function}},
1118
+ * // start: 1591804716757
1119
+ * // }
1120
+ * }
1121
+ * ```
1122
+ *
1123
+ * @param {String} requestId The unique ID of the request as used in bbn.env.loaders
1124
+ *
1125
+ * @returns {false|Object} The corresponding loader Object if it exists, false otherwise
1126
+ */
306
1127
  const getLoader: (requestId: string) => BbnLoader | null;
307
1128
  export { getLoader };
308
1129
  }
309
- declare module "fn/abort" {
1130
+ declare module "fn/ajax/abort" {
1131
+ /**
1132
+ * Aborts (client side) the XHR corresponding to the given ID if it still exists.
1133
+ *
1134
+ * This will throw an error if the loader can't be found.
1135
+ *
1136
+ * @method abort
1137
+ * @global
1138
+ * @memberof bbn.fn
1139
+ *
1140
+ * @example
1141
+ * ```javascript
1142
+ * bbn.fn.post('my/script', {a: 1, b: 2});
1143
+ * let requestId = bbn.fn.getRequestId('my/script', {a: 1, b: 2});
1144
+ * if (requestId) {
1145
+ * bbn.fn.abort(requestId);
1146
+ * }
1147
+ * ```
1148
+ *
1149
+ * @param {String} requestId An ID generated by getRequestId
1150
+ *
1151
+ * @returns {undefined}
1152
+ */
310
1153
  const abort: (requestId: any) => void;
311
1154
  export { abort };
312
1155
  }
313
- declare module "fn/filter" {
314
- import { Filter } from "fn/filterToConditions";
1156
+ declare module "fn/object/filter" {
1157
+ import { Filter } from "fn/object/filterToConditions";
1158
+ /**
1159
+ * Returns a new array with only the data matching the given filter.
1160
+ *
1161
+ * The filtering arguments follow the same scheme as bbn.fn.search.
1162
+ *
1163
+ * @method filter
1164
+ * @global
1165
+ * @example
1166
+ * ```javascript
1167
+ * let ar = [
1168
+ * {name: "Raiders of the lost ark", director: "Steven Spielberg", year: 1981, id: 589},
1169
+ * {name: "Goonies", director: "Richard Donner", year: 1985, id: 689},
1170
+ * {name: "Star wars", director: "George Lucas", year: 1977, id: 256},
1171
+ * {name: "Jaws", director: "Steven Spielberg", year: 1975, id: 423}
1172
+ * ];
1173
+ * bbn.fn.filter(ar, {director: "Steven Spielberg"});
1174
+ * // [
1175
+ * // {name: "Raiders of the lost ark", director: "Steven Spielberg", year: 1981, id: 589},
1176
+ * // {name: "Jaws", director: "Steven Spielberg", year: 1975, id: 423}
1177
+ * // ]
1178
+ * bbn.fn.filter(ar, "director", "Steven Spielberg");
1179
+ * // Same result as the previous example
1180
+ * bbn.fn.filter(ar, {
1181
+ * logic: "OR",
1182
+ * conditions: [
1183
+ * {
1184
+ * field: "director",
1185
+ * value: "Richard Donner"
1186
+ * }, {
1187
+ * field: "director",
1188
+ * value: "George Lucas"
1189
+ * }
1190
+ * ]
1191
+ * );
1192
+ * // [
1193
+ * // {name: "Goonies", director: "Richard Donner", year: 1985, id: 689},
1194
+ * // {name: "Star wars", director: "George Lucas", year: 1977, id: 256},
1195
+ * // ]
1196
+ * ```
1197
+ *
1198
+ * @memberof bbn.fn
1199
+ * @param {Array} arr The subject array
1200
+ * @param {(String|Object|Function)} prop A property's name or a filter object or function
1201
+ * @param {*} val The value with which comparing the given property
1202
+ * @param {String} operator The operator to use for comparison with the value as used in bbn.fn.compare
1203
+ * @returns {Array} A new filtered array
1204
+ */
315
1205
  const filter: (arr: any[], prop: string | object | Filter | ((a: any, i: string | number | symbol) => boolean), val?: any, operator?: string) => any[];
316
1206
  export { filter };
317
1207
  }
318
- declare module "fn/abortURL" {
1208
+ declare module "fn/ajax/abortURL" {
1209
+ /**
1210
+ * Aborts (client side) all the XHR using the given URL if it still exists.
1211
+ *
1212
+ * This will throw an error if the loader can't be found.
1213
+ *
1214
+ * @method abortURL
1215
+ * @global
1216
+ * @memberof bbn.fn
1217
+ *
1218
+ * @example
1219
+ * ```javascript
1220
+ * bbn.fn.post('my/script', {a: 1, b: 2});
1221
+ * bbn.fn.post('my/script', {c: 1, d: 2});
1222
+ * bbn.fn.abortURL('my/script');
1223
+ * ```
1224
+ *
1225
+ * @param {String} requestId An ID generated by getRequestId
1226
+ *
1227
+ * @returns {undefined}
1228
+ */
319
1229
  const abortURL: (url: any) => void;
320
1230
  export { abortURL };
321
1231
  }
322
- declare module "fn/addColors" {
1232
+ declare module "fn/style/addColors" {
1233
+ /**
1234
+ * Adds the given color to the object bbn.var.colors in order to be able to use
1235
+ * the css classes bbn-bg-myColor for the background and bbn-myColor for the text color.
1236
+ *
1237
+ * @method addColors
1238
+ * @global
1239
+ * @example
1240
+ * ```javascript
1241
+ * //<div class="bbn-bg-maroon">background</div> <span class="bbn-maroon">text color</span>
1242
+ * bbn.fn.addColors({maroon: '#800000'});
1243
+ * ```
1244
+ * @memberof bbn.fn
1245
+ * @param {Object} colors
1246
+ * @returns
1247
+ */
323
1248
  const addColors: (colors: object) => void;
324
1249
  export { addColors };
325
1250
  }
326
- declare module "fn/addInputs" {
1251
+ declare module "fn/form/addInputs" {
1252
+ /**
1253
+ * Adds the given data to the given form by inserting hidden inputs.
1254
+ *
1255
+ * @method addInputs
1256
+ * @global
1257
+ * @memberof bbn.fn
1258
+ *
1259
+ * @example
1260
+ * ```javascript
1261
+ * let o = {name: "Smith", fname: "John"};
1262
+ * bbn.fn.addInputs(document.getElementById('myform'), o, 'bbn');
1263
+ * // Will write at the end of the given form:
1264
+ * // <input type="hidden" name="bbn[name]" value="Smith">
1265
+ * // <input type="hidden" name="bbn[fname]" value="John">
1266
+ *
1267
+ * ```
1268
+ *
1269
+ * @example
1270
+ * ```javascript
1271
+ * let o = {
1272
+ * People: [
1273
+ * {name: "Smith", fname: "John"},
1274
+ * {name: "Smith", fname: "Eileen"}
1275
+ * ],
1276
+ * Dates: ['2021-08-25', '2021-09-06']
1277
+ * };
1278
+ * bbn.fn.addInputs(document.getElementById('myform'), o);
1279
+ * // Will write at the end of the given form:
1280
+ * // <input type="hidden" name="People[0][name]" value="Smith">
1281
+ * // <input type="hidden" name="People[0][fname]" value="John">
1282
+ * // <input type="hidden" name="People[1][name]" value="Smith">
1283
+ * // <input type="hidden" name="People[1][fname]" value="Eileen">
1284
+ * // <input type="hidden" name="Dates[0]" value="2021-08-25">
1285
+ * // <input type="hidden" name="Dates[1]" value="2021-09-06">
1286
+ * ```
1287
+ *
1288
+ * @param {HTMLElement} form The form to which the inputs should be added
1289
+ * @param {Object} params The data which will be added
1290
+ * @param {String} prefix The optional object's name of the fields in the form
1291
+ * @returns {undefined}
1292
+ */
327
1293
  const addInputs: (form: HTMLFormElement, params?: object, prefix?: string) => void;
328
1294
  export { addInputs };
329
1295
  }
330
- declare module "fn/addStyle" {
1296
+ declare module "fn/style/addStyle" {
1297
+ /**
1298
+ * @ignore
1299
+ * @method addStyle
1300
+ * @todo Add method description for addStyle
1301
+ * @global
1302
+ * @memberof bbn.fn
1303
+ * @param {HTMLElement} ele
1304
+ * @param {Object} o
1305
+ * @returns {*}
1306
+ */
331
1307
  const addStyle: (ele: any, o: any) => void;
332
1308
  export { addStyle };
333
1309
  }
334
- declare module "fn/adjustSize" {
1310
+ declare module "fn/html/adjustSize" {
335
1311
  const adjustSize: (type: any, eles: any) => void;
336
1312
  export { adjustSize };
337
1313
  }
338
- declare module "fn/adjustHeight" {
1314
+ declare module "fn/html/adjustHeight" {
339
1315
  const adjustHeight: () => void;
340
1316
  export { adjustHeight };
341
1317
  }
342
- declare module "fn/adjustWidth" {
1318
+ declare module "fn/html/adjustWidth" {
343
1319
  const adjustWidth: () => void;
344
1320
  export { adjustWidth };
345
1321
  }
346
- declare module "fn/escapeRegExp" {
1322
+ declare module "fn/string/escapeRegExp" {
1323
+ /**
1324
+ * Returns a string escaped.
1325
+ *
1326
+ * To escape the string by reducing the ambiguity between quotation marks and other characters used.
1327
+ *
1328
+ * @method escapeRegExp
1329
+ * @global
1330
+ *
1331
+ * @example
1332
+ * ```javascript
1333
+ * //"this\/is\/a\/test\/string"
1334
+ * bbn.fn.escapeRegExp("this/is/a/test/string");
1335
+ * ```
1336
+ * @memberof bbn.fn
1337
+ * @param {String} str
1338
+ * @returns {String} string with escape
1339
+ */
347
1340
  const escapeRegExp: (str: any) => any;
348
1341
  export { escapeRegExp };
349
1342
  }
350
- declare module "fn/replaceAll" {
1343
+ declare module "fn/string/replaceAll" {
1344
+ /**
1345
+ * Looks for and replaces parts of string with what we want.
1346
+ *
1347
+ * With the first argument you define what to replace,
1348
+ * the second argument with what you have to replace instead and the third argument is the string to be replaced.
1349
+ *
1350
+ * @method replaceAll
1351
+ * @global
1352
+ *
1353
+ * @example
1354
+ * ```javascript
1355
+ * bbn.fn.replaceAll('day', 'night', 'Today is a beautiful day');
1356
+ * //"Tonight is a beautiful night"
1357
+ * ```
1358
+ * @memberof bbn.fn
1359
+ * @param {String} find
1360
+ * @param {String} replace
1361
+ * @param {String|RegExp} str
1362
+ * @param {String} flags
1363
+ * @returns {String}
1364
+ */
351
1365
  const replaceAll: (find: string, replace: string, str: string, flags?: string) => string;
352
1366
  export { replaceAll };
353
1367
  }
354
- declare module "fn/md5" {
1368
+ declare module "fn/string/md5" {
1369
+ /**
1370
+ * Converts and returns the argument passed in a string in md5 format.
1371
+ *
1372
+ * This is a formatted version of popular md5 implementation
1373
+ * Original copyright (c) Paul Johnston & Greg Holt.
1374
+ *
1375
+ *
1376
+ * @method md5
1377
+ * @global
1378
+ *
1379
+ * @example
1380
+ * ```javascript
1381
+ * //"486eb65274adb86441072afa1e2289f3"
1382
+ * bbn.fn.md5("this is a test string");
1383
+ * ```
1384
+ *
1385
+ * @memberof bbn.fn
1386
+ * @param {Mixed} st
1387
+ * @returns {String} in md5 format
1388
+ */
355
1389
  const md5: (st: any) => string;
356
1390
  export { md5 };
357
1391
  }
358
- declare module "fn/getRequestId" {
1392
+ declare module "fn/ajax/getRequestId" {
1393
+ /**
1394
+ * Returns a unique ID for a "loader" based on the URL, the data keys and the datatype.
1395
+ *
1396
+ * The routing functions don't allow to send the same request at the same moment,
1397
+ * therefore a unique ID is generated to identify them, based on the URL,
1398
+ * the keys of the data sent, and the expected returned data type.
1399
+ *
1400
+ * @method getRequestId
1401
+ * @global
1402
+ *
1403
+ * @example
1404
+ * ```javascript
1405
+ * // The URL is the first part of the key
1406
+ * bbn.fn.getRequestId('my/location', {a: 1, b: 2});
1407
+ * // my/location:af27f0e81533ae2bae3c25dea67359f6
1408
+ * bbn.fn.getRequestId('my/other/location', {a: 1, b: 2});
1409
+ * // my/other/location:af27f0e81533ae2bae3c25dea67359f6
1410
+ * ```
1411
+ *
1412
+ * @example
1413
+ * ```javascript
1414
+ * // A change of value will not change the requestId
1415
+ * bbn.fn.getRequestId('my/location', {a: 1, b: 3});
1416
+ * // my/location:af27f0e81533ae2bae3c25dea67359f6
1417
+ * // A change of key will
1418
+ * bbn.fn.getRequestId('my/location', {a: 1, c: 3});
1419
+ * // my/location:fde97ca7c6c998c911f4ab481a136d5f
1420
+ * ```
1421
+ *
1422
+ * @example
1423
+ * ```javascript
1424
+ * // Same with nested object
1425
+ * bbn.fn.getRequestId('my/location', {data: {a: 1, b: 3}});
1426
+ * // my/location:a7a58435275054106c4e4c9fb0cea5e5
1427
+ * bbn.fn.getRequestId('my/location', {data: {a: 1, b: 2}});
1428
+ * // my/location:a7a58435275054106c4e4c9fb0cea5e5
1429
+ * bbn.fn.getRequestId('my/location', {data: {a: 1, c: 3}});
1430
+ * // my/location:730da481e30d421afbadf1f1282dabb7
1431
+ * ```
1432
+ *
1433
+ * @memberof bbn.fn
1434
+ *
1435
+ * @param {String} url The URL used by the request
1436
+ * @param {Object} data The data sent to the URL
1437
+ * @param {String} datatype The type of data requested (JSON by default)
1438
+ *
1439
+ * @returns {String} The unique ID
1440
+ */
359
1441
  const getRequestId: (url: any, data: any, datatype: any) => string;
360
1442
  export { getRequestId };
361
1443
  }
362
- declare module "fn/extend" {
1444
+ declare module "fn/object/extend" {
1445
+ /**
1446
+ * Merges the contents of two or more objects together into the first object.
1447
+ *
1448
+ * A boolean true argument can be done to operate a deep extend. In this case,
1449
+ * the content of properties or subproperties arrays and objects will also be merged.
1450
+ *
1451
+ * @method extend
1452
+ * @global
1453
+ * @example
1454
+ * ```javascript
1455
+ * bbn.fn.extend(
1456
+ * {prop1: 10, prop2: 20},
1457
+ * {prop1: 11, prop3: 21},
1458
+ * {prop2: 22, prop4: false},
1459
+ * {prop5: false, prop3: 45}
1460
+ * );
1461
+ * // {prop1: 11, prop2: 22, prop3: 45, prop4: false, prop5: false}
1462
+ * ```
1463
+ * @example
1464
+ * ```javascript
1465
+ * bbn.fn.extend(
1466
+ * {
1467
+ * prop1: [3, 5, 6],
1468
+ * prop2: {
1469
+ * subprop1: 87,
1470
+ * subprop2: 100
1471
+ * }
1472
+ * }, {
1473
+ * prop1: 11,
1474
+ * prop3: [8, 12, {aProperty: 1, anotherProperty: true}, 26]
1475
+ * }, {
1476
+ * prop2: {
1477
+ * subprop1: 90,
1478
+ * subprop3: 25
1479
+ * },
1480
+ * prop4: false
1481
+ * }, {
1482
+ * prop5: false,
1483
+ * prop3: [8, 45, {anotherProperty: false, andAnother: true}]
1484
+ * }
1485
+ * );
1486
+ * // {
1487
+ * // prop1: 11,
1488
+ * // prop2: {subprop1: 90, subprop3: 25},
1489
+ * // prop3: [8, 45, {anotherProperty: false, andAnother: true}],
1490
+ * // prop4: false,
1491
+ * // prop5: false
1492
+ * // }
1493
+ * ```
1494
+ * @example
1495
+ * ```javascript
1496
+ * // Deep
1497
+ * bbn.fn.extend(
1498
+ * true,
1499
+ * {
1500
+ * prop1: [3, 5, 6],
1501
+ * prop2: {
1502
+ * subprop1: 87,
1503
+ * subprop2: 100
1504
+ * }
1505
+ * }, {
1506
+ * prop1: 11,
1507
+ * prop3: [8, 12, {aProperty: 1, anotherProperty: true}, 26]
1508
+ * }, {
1509
+ * prop2: {
1510
+ * subprop1: 90,
1511
+ * subprop3: 25
1512
+ * },
1513
+ * prop4: false
1514
+ * }, {
1515
+ * prop5: false,
1516
+ * prop3: [8, 45, {anotherProperty: false, andAnother: true}]
1517
+ * }
1518
+ * );
1519
+ * // {
1520
+ * // prop1: 11,
1521
+ * // prop2: {subprop1: 90, subprop3: 25},
1522
+ * // prop3: [8, 45, {aProperty: 1, anotherProperty: false, andAnother: true}, 26],
1523
+ * // prop4: false,
1524
+ * // prop5: false
1525
+ * // }
1526
+ * ```
1527
+ * @memberof bbn.fn
1528
+ * @returns {Object} The first object argument, merged with the other objects given
1529
+ */
363
1530
  const extend: (...originalArgs: (boolean | object)[]) => any;
364
1531
  export { extend };
365
1532
  }
366
- declare module "fn/defaultEndLoadingFunction" {
1533
+ declare module "fn/default/defaultEndLoadingFunction" {
367
1534
  const defaultEndLoadingFunction: (url: string, timestamp: number, data?: object, res?: object) => boolean;
368
1535
  export { defaultEndLoadingFunction };
369
1536
  }
370
- declare module "fn/defaultAjaxErrorFunction" {
1537
+ declare module "fn/default/defaultAjaxErrorFunction" {
371
1538
  const defaultAjaxErrorFunction: (jqXHR: any, textStatus?: string, errorThrown?: object) => boolean;
372
1539
  export { defaultAjaxErrorFunction };
373
1540
  }
374
- declare module "fn/defaultAjaxAbortFunction" {
1541
+ declare module "fn/default/defaultAjaxAbortFunction" {
375
1542
  const defaultAjaxAbortFunction: (message: string, url?: string) => void;
376
1543
  export { defaultAjaxAbortFunction };
377
1544
  }
378
- declare module "fn/defaultStartLoadingFunction" {
1545
+ declare module "fn/default/defaultStartLoadingFunction" {
379
1546
  const defaultStartLoadingFunction: (url: string, tst: number, data?: object, requestId?: string) => boolean;
380
1547
  export { defaultStartLoadingFunction };
381
1548
  }
382
- declare module "fn/ajax" {
1549
+ declare module "fn/ajax/ajax" {
1550
+ /**
1551
+ * Creates an XHR object and returns the Promise.
1552
+ *
1553
+ * Checks the URL, makes an ID, creates a loader, sets the general callbacks,
1554
+ * makes a POST if data is given a GET otherwise (GET data should be added
1555
+ * directly in the URL), and returns the Promise.
1556
+ *
1557
+ * @method ajax
1558
+ * @global
1559
+ * @memberof bbn.fn
1560
+ * @example
1561
+ * ```javascript
1562
+ * // Promise
1563
+ * bbn.fn.ajax(
1564
+ * 'my/location',
1565
+ * 'json',
1566
+ * {id: 7},
1567
+ * d => {
1568
+ * console.log(d);
1569
+ * alert("Success!");
1570
+ * },
1571
+ * err => {
1572
+ * console.log(err);
1573
+ * alert("Failure!");
1574
+ * },
1575
+ * () => {
1576
+ * alert("Request aborted!");
1577
+ * }
1578
+ * )
1579
+ * ```
1580
+ *
1581
+ * @example
1582
+ * ```javascript
1583
+ * // Promise
1584
+ * bbn.fn.ajax('my/location')
1585
+ * .then(
1586
+ * d => {
1587
+ * console.log(d);
1588
+ * alert("Success!");
1589
+ * }
1590
+ * )
1591
+ * .catch(
1592
+ * err => {
1593
+ * }
1594
+ * )
1595
+ * ```
1596
+ *
1597
+ * @param {String} url The URL to be requested by XHR
1598
+ * @param {String} datatype The type of data expected
1599
+ * @param {Object} data The data to send through POST
1600
+ * @param {Function} success The function to execute if the request goes well (200)
1601
+ * @param {Function} failure The function to execute if the request goes bad
1602
+ * @param {Function} abort The function to execute if the request is aborted
1603
+ *
1604
+ * @returns {Promise} The Promise created by the generated XHR.
1605
+ */
383
1606
  const ajax: (url: any, datatype: string, data: any, success?: (data: object, headers?: object) => any, failure?: (url: string, o?: object) => any, abort?: (message: string, url: string) => any) => any;
384
1607
  export { ajax };
385
1608
  }
386
- declare module "fn/analyzeFunction" {
1609
+ declare module "fn/misc/analyzeFunction" {
387
1610
  const analyzeFunction: (fn: any) => {
388
1611
  body: any;
389
1612
  args: any[];
@@ -396,343 +1619,1462 @@ declare module "fn/analyzeFunction" {
396
1619
  };
397
1620
  export { analyzeFunction };
398
1621
  }
399
- declare module "fn/animateCss" {
1622
+ declare module "fn/style/animateCss" {
1623
+ /**
1624
+ * @ignore
1625
+ * @method animateCss
1626
+ * @todo Add method description for animateCss
1627
+ * @global
1628
+ * @memberof bbn.fn
1629
+ * @param {HTMLElement} ele
1630
+ * @param {String} animationName
1631
+ * @param {Function} callback
1632
+ * @returns {*}
1633
+ */
400
1634
  const animateCss: (ele: any, animationName: any, callback: any) => void;
401
1635
  export { animateCss };
402
1636
  }
403
- declare module "fn/arrayBuffer2String" {
1637
+ declare module "fn/convert/arrayBuffer2String" {
404
1638
  const arrayBuffer2String: (buf: any) => any;
405
1639
  export { arrayBuffer2String };
406
1640
  }
407
- declare module "fn/arrayFromProp" {
1641
+ declare module "fn/object/arrayFromProp" {
1642
+ /**
1643
+ * Creates and returns a new array made of the given property's values from the given array of objects.
1644
+ *
1645
+ * The returned array will always have the same length of the given array, even if the property is not found.
1646
+ *
1647
+ * @method arrayFromProp
1648
+ * @global
1649
+ * @example
1650
+ * ```javascript
1651
+ * bbn.fn.arrayFromProp([
1652
+ * {movie: "Brazil", year: 1985},
1653
+ * {movie: "Donnie Darko", year: 2001},
1654
+ * {movie: "Barry Lindon", year: 1976}
1655
+ * ], "year");
1656
+ * // [1985, 2001, 1976]
1657
+ * ```
1658
+ * @example
1659
+ * ```javascript
1660
+ * bbn.fn.arrayFromProp([
1661
+ * {pupil: "Agnes Varda", grade: {year: "B", month: "A"}},
1662
+ * {pupil: "Jacques Rivette"},
1663
+ * {pupil: "Luc Besson", grade: {year: "C", month: "D"}},
1664
+ * {pupil: "Nicole Garcia", grade: {year: "B", month: "B"}}
1665
+ * ], "grade.month");
1666
+ * // ["A", undefined, "D", "B"]
1667
+ * ```
1668
+ * @memberof bbn.fn
1669
+ * @param {Array} arr
1670
+ * @param {String} prop
1671
+ * @returns {Array} The new array
1672
+ */
408
1673
  const arrayFromProp: (arr: any, prop: any) => any[];
409
1674
  export { arrayFromProp };
410
1675
  }
411
- declare module "fn/autoExtend" {
1676
+ declare module "fn/object/autoExtend" {
1677
+ /**
1678
+ * Extends the bbn object by passing the namespace and the object it will merge with.
1679
+ *
1680
+ * This function is a self-centric shortcut for adding functions or proerties
1681
+ * to the bbn object itself.
1682
+ *
1683
+ * @method autoExtend
1684
+ * @global
1685
+ * @example
1686
+ * ```javascript
1687
+ * bbn.fn.autoExtend("fn", {myOwnFunction: () => "Result of my own function"});
1688
+ * bbn.fn.myOwnFunction();
1689
+ * // Result of my own function
1690
+ * ```
1691
+ * @example
1692
+ * ```javascript
1693
+ * bbn.fn.autoExtend("env", {serverLanguage: "php"});
1694
+ * bbn.env.sercerLanguage
1695
+ * // php
1696
+ * ```
1697
+ * @example
1698
+ * ```javascript
1699
+ * bbn.fn.autoExtend("myProject", {name: "My Project"});
1700
+ * bbn.myProject.name
1701
+ * // Project
1702
+ * ```
1703
+ * @memberof bbn.fn
1704
+ * @param {String} namespace The bbn property, existing or not, in which the object will be merged
1705
+ * @param {Object} obj The object to merge
1706
+ * @returns {undefined} No return value
1707
+ */
412
1708
  const autoExtend: (namespace: any, obj: any) => void;
413
1709
  export { autoExtend };
414
1710
  }
415
- declare module "fn/baseName" {
1711
+ declare module "fn/string/baseName" {
1712
+ /**
1713
+ * Returns the name of the element indicated by path given to it as an argument.
1714
+ *
1715
+ * @method baseName
1716
+ * @global
1717
+ *
1718
+ * @example
1719
+ * ```javascript
1720
+ * // "file.png"
1721
+ * bbn.fn.baseName('folder/other_folder/file.png');
1722
+ * ```
1723
+ * @example
1724
+ * ```javascript
1725
+ * // "file"
1726
+ * bbn.fn.baseName('folder/other_folder/file.png', '.png');
1727
+ * ```
1728
+ *
1729
+ * @memberof bbn.fn
1730
+ * @param {String} path The path from which the basename must be extracted
1731
+ * @param {String} suffix An optional suffix that will be removed from the basename
1732
+ * @returns {String} The basename of path
1733
+ */
416
1734
  const baseName: (path: string, suffix?: string) => string;
417
1735
  export { baseName };
418
1736
  }
419
- declare module "fn/br2nl" {
1737
+ declare module "fn/string/br2nl" {
1738
+ /**
1739
+ * Replaces the html <br> tag with new line characters '\ n' if present in the string.
1740
+ *
1741
+ * @method br2nl
1742
+ * @global
1743
+ *
1744
+ * @example
1745
+ * ```javascript
1746
+ * //"hello
1747
+ * //world!"
1748
+ * bbn.fn.br2nl('hello <br> world!')
1749
+ * ```
1750
+ *
1751
+ * @memberof bbn.fn
1752
+ * @param string st
1753
+ * @returns {String}
1754
+ */
420
1755
  const br2nl: (st: any) => string;
421
1756
  export { br2nl };
422
1757
  }
423
- declare module "fn/date" {
1758
+ declare module "fn/datetime/date" {
1759
+ /**
1760
+ * Returns a date object from the given argument.
1761
+ *
1762
+ * @method date
1763
+ * @global
1764
+ *
1765
+ * @example
1766
+ * ``` javascript
1767
+ * //Mon Feb 11 2019 12:00:00 GMT+0100 (Central European Standard Time)
1768
+ * bbn.fn.date('2019/02/11')
1769
+ * ```
1770
+ *
1771
+ * @memberof bbn.fn
1772
+ * @param {String|Number} v
1773
+ * @returns {date}
1774
+ */
424
1775
  const date: (v: any) => any;
425
1776
  export { date };
426
1777
  }
427
- declare module "fn/fdatetime" {
1778
+ declare module "fn/datetime/fdatetime" {
1779
+ /**
1780
+ * @method fdatetime
1781
+ * @todo Add method description for fdatetime
1782
+ * @global
1783
+ * @memberof bbn.fn
1784
+ * @returns {*}
1785
+ */
428
1786
  const fdatetime: (d?: Date | number | string, wrong_result?: boolean | string) => any;
429
1787
  export { fdatetime };
430
1788
  }
431
- declare module "fn/fdate" {
1789
+ declare module "fn/datetime/fdate" {
1790
+ /**
1791
+ * @method fdate
1792
+ * @todo Add method description for fdate
1793
+ * @global
1794
+ * @memberof bbn.fn
1795
+ * @param {String|Date} d
1796
+ * @param {String} wrong_result
1797
+ * @returns
1798
+ */
432
1799
  const fdate: (d: Date | number | string, wrong_result?: boolean | string) => any;
433
1800
  export { fdate };
434
1801
  }
435
- declare module "fn/calendar" {
1802
+ declare module "fn/datetime/calendar" {
436
1803
  const calendar: (d?: Date | number | string, wrong_result?: string) => any;
437
1804
  export { calendar };
438
1805
  }
439
- declare module "fn/defaultLinkFunction" {
1806
+ declare module "fn/default/defaultLinkFunction" {
440
1807
  const defaultLinkFunction: (responseObj: any, ele: any) => boolean;
441
1808
  export { defaultLinkFunction };
442
1809
  }
443
- declare module "fn/defaultPostLinkFunction" {
1810
+ declare module "fn/default/defaultPostLinkFunction" {
444
1811
  const defaultPostLinkFunction: (r: object, ele?: HTMLElement) => boolean;
445
1812
  export { defaultPostLinkFunction };
446
1813
  }
447
- declare module "fn/defaultAlertFunction" {
1814
+ declare module "fn/default/defaultAlertFunction" {
448
1815
  const defaultAlertFunction: (msg: string, title?: string) => void;
449
1816
  export { defaultAlertFunction };
450
1817
  }
451
- declare module "fn/callback" {
1818
+ declare module "fn/ajax/callback" {
1819
+ /**
1820
+ * Executes a serie of predefined actions once an Ajax request has been done.
1821
+ *
1822
+ * Used to treat all the requests functions results, it expects at least url and res to be defined;
1823
+ * The following properties from the object res have direct effects:
1824
+ * - __url__ {String}: if not given it will be automatically defined by the url parameter;
1825
+ * __the given URL will be passed to location.href (without reloading)__
1826
+ * - __prescript__ {String}: if defined it will attempt to evaluate the code contained in the property
1827
+ * - __content__ {String}: if defined and ele is defined too, the string will be inserted as content in the element
1828
+ * - __script__ {String}: if defined it will be evaluated, executed, and its result will be returned
1829
+ * - __data__ {Object}:
1830
+ * - __postscript__ {String}: if defined it will be evaluated and executed
1831
+ * - __error__ {String}: if defined it will be trigger bbn.fn.defaultAlertFunction
1832
+ *
1833
+ * If fn is defined it will be executed after prescript, otherwise it will be bbn.fn.defaultLinkFunction.
1834
+ *
1835
+ * The rest of the function comes executed if either of these results is not empty.
1836
+ *
1837
+ * If fn2 is defined it will be executed after script, otherwise it will be bbn.fn.defaultPostLinkFunction.
1838
+ *
1839
+ * Although not private this function should only be used internally.
1840
+ *
1841
+ * @method callback
1842
+ * @todo Add method description for callback
1843
+ * @global
1844
+ * @memberof bbn.fn
1845
+ *
1846
+ * @param {String} url The URL that has been called
1847
+ * @param {Object} res The object returned by the request
1848
+ * @param {Function} fn A first callback function to execute
1849
+ * @param {Function} fn2 A second callback function to execute
1850
+ * @param {HTMLElement} ele A DOM element where the content will be inserted
1851
+ *
1852
+ * @returns {*} The result of the main callback function: res.script, fn, or bbn.fn.defaultLinkFunction
1853
+ */
452
1854
  const callback: (url: string, res?: BbnAjaxResult, fn?: (a: BbnAjaxResult, b?: HTMLElement) => any, fn2?: (a: BbnAjaxResult) => any, ele?: HTMLElement | HTMLInputElement | HTMLTextAreaElement) => boolean;
453
1855
  export { callback };
454
1856
  }
455
- declare module "fn/camelize" {
1857
+ declare module "fn/string/camelize" {
1858
+ /**
1859
+ * Returns the string passed as an argument in camelize mode.
1860
+ *
1861
+ * A string can be separated for example by a underscore, a dash or space;
1862
+ * so the camelize function will automatically convert them to a single string.
1863
+ *
1864
+ * @method camelize
1865
+ * @global
1866
+ *
1867
+ * @example
1868
+ * ```javascript
1869
+ * //"thisIsATest"
1870
+ * bbn.fn.camelize("this_is-a test");
1871
+ * ```
1872
+ * @memberof bbn.fn
1873
+ * @param {String} str
1874
+ * @returns {String}
1875
+ */
456
1876
  const camelize: (str: any) => any;
457
1877
  export { camelize };
458
1878
  }
459
- declare module "fn/camelToCss" {
1879
+ declare module "fn/string/camelToCss" {
1880
+ /**
1881
+ * Returns the string passed as an argument in camelize mode for css.
1882
+ *
1883
+ * @method camelToCss
1884
+ * @global
1885
+ *
1886
+ * @example
1887
+ * ```javascript
1888
+ * //"this-is-a-test"
1889
+ * bbn.fn.camelToCss("thisIsATest");
1890
+ * ```
1891
+ *
1892
+ * @memberof bbn.fn
1893
+ * @param {String} str
1894
+ * @returns {String}
1895
+ */
460
1896
  const camelToCss: (str: any) => any;
461
1897
  export { camelToCss };
462
1898
  }
463
- declare module "fn/canvasToImage" {
1899
+ declare module "fn/convert/canvasToImage" {
1900
+ /**
1901
+ * Returns a canvas in a HTML element img
1902
+ * @method canvasToImage
1903
+ * @global
1904
+ * ``` javascript
1905
+ * //<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAAgCAYAAABO6BuSAAAUzUlEQVRYRz2ZWXBc95Xef/f27Xtv7w000AsaADdwh0iKlETRtrbYpi3ZsZNUJaOZcs2MPQ95SSaVrSqVqrykUqmkKp4lNfMwM/Ikk1lijxyrrLEkW5QtS6LMVQt3guAGEGiggUbv611T54+xu6rJJtG493/O+b7vfOdc7RuxUmhGoxiageYF6B5E0dFCndD30cKAqGXg+z66pWOnEnRHPYpTBV7+1m+hj2X5P//7L+jeqRBrjUj1QoqRNLrvE8XCwyCMRhgRMHJHRAiIYxJDJ4K8Qhz5GWBkEhC3WFlbYVdhGqfeJuVHsQPUdzU0PM3CsyJ4tklogE2A6zpomkY0ZhOJ6nhaSBjRiVombuCqu/zypf3PL/yTMBKJoPsa/sjBH3rgBwQjF9d16TRbGJbBYNij2WsT6iFDd8gLp7/Ar3/zN/GSMVpbLb73R6/QWVylGMQY1hpMmuOMHBcHjT4OHpCIJcjEEliBRtAf4DsOqWSGdr/HyAwZRaA56hOPx0noUZIYxAYhtgemrxNqOkHE+FXAkgVTCwlch1CPqMJEDANfRwVsmFGCwCMMQ/UOggDtR//6P4a6rqP7EDgumgdaCHg+nuOqyvphQK/XoTPsEUvY1DsNTn/5y+w8uAd9PKO+f/uDy7z//TcZrdSwHQ2n45BIp3ElYF8C1ojqEXAc/N6QGBFSsTgjb8Sm28C0UoxPFbDTGY7Mz3Pr8qe0KxtMECPmhBiehh6CF4ngRyO4UR1NA9330AMfLRJVAUuQEqwe3f4ssW0H620H/Np/+E+hwEEPQgIvwAx1LIE4xt9nRyMMfQICvMAlOZaiUq3w+S9+ga1+m5nD++i02+QzBRZ++iFnX38bYwROb0TUjrHV6+GGPm4YbCfS8dAdh1hgYBkRuqMBVirGrkP7OXj0KOUds8QnClx6/U0+fPMM8UFIwgXLEwpohJoEbBAYusJ5OmKhE4D8qQUEoYaPJMBAi0DMToAWCEkVqrXv/5f/HIZBgDdycEceJjp21CSiRQh9D0KNqGmgR3Vanaa6SavT4uXf+HXabp9qr0EymSQVmhST41z78BKfXviUfL5IbWuLmX1zdAd9esOBuu5kKosVQm2pwtLSQ1zdZ+7wQeYOHSBXKJJIJakuV1i+vcjP/t8bUOuRcMB2NSIBBBoEuo6no3ib0AzMiIFhmEQimqq0YUYwTVv9WxKhS24ExbqO9vZ3/vhXAXuOCI1U2EYHfNdTMBTOur5DvVUnYuhKGL74pdMMQ5fYWBJDkrFeRxv6dDebvP3jM3z80RXFpcT4OC4BumEwOZZlZ2GKQnacWKDjuyP2zB8gVyqgm1Fc31fJ21qvkcLi0jvv0bhbwR4FRPoefn/E0BkxkLfr4PshfndEzDAxDEFkgE+oPkej23CWZAiktVBTXNXO/fCvBGiEfoAWaOoLZsRUwY5GI9zhSAmWF3pKZS0rSiwZozhVUhCPxqNAQC41xvK9hwollco6r73+JnrMZBh4dIcDBSdLbt4dYnge+6d3Mj9/iGe++CxO4NF3XFw/JJMZI5fIovVd7l25QT6awRz66AMfdzBkNBhuB+06eJ5HMPQx9CiO49BsNmk3mgyHQ/UzeacSSXwRz6HLyBmgXfjxdxWHJQMiChHNUH8PekP6vY66kG2bZLMZVeXBaEgqlSCejpPPT7CyusRseUrdtFarce4XF1l8+JBWr8+Z994lm5+gVt/Ctm1mSmVioQ6DIY8fOMwLzz9DOpdR7SU7llO867UH7JiaZfHGAr2NJtlIDNuPIJgT9ClYahqBgiuM+h521FKf+/2+SoigU4mVD51Oh2F/QLfVpdtuoV1977VQSi6V6Xe6DPtD1ZaEE9GIQSqVYqu+iWWZmKYhlFZipkU1ds6WWVpcIJtJEYsnGToe12/eYml1lbfefYfKxiaT5RJ3794nk0kxv28fq/cesnuqzKkTT1IuFnj+hc8qfnt+oEROojcjUT4+9zFxw8bWTEbtHk5/SMKyFVRFQwS6k/kCth0nYpjYpqUq22q0MXSdRCwOfkjMklRp+I7PcNRHu3X270LJQrvdVYFKr5Q+GCGiILGy/IioGaFQyBONRhgMBmzUqgShx7HHDnPrysdkUkl27Znj+u0F7j5cYml1hffPn1OGQoLodLt02k12l6fZXF2jPDnJP//m72CbOsXCBPv375Wz0ZF2ZafYXK/x0zM/wx0GtBttVbVBt690NhLRGbkOZsykWCpTmpkhm82qt7TRfqdPzLaZyOSwLIt0LKXi8F1ftVjt5s9fD4Xsnucr3gYBGJquVE4CfLS0jB0zyWTSCtry3WvXr7C4uMDeXTthNGRu107agwEeIWubNWrNOj95910erVbYtXs316/f4qknj7F8/z4bK22+8qXPUMwXmD+wl3w+zdHHDrO50WCr0aGQn+LDDy/w8/fOMhx4tNpdwhDava6CbBhKe/QV2jK5cdK5HIVCgVK+QDKeIJPKMF2aojRZVAFLe5UieW6AaZpo1376WigwsaKWykCvN8AZDIlEosRiMfXlmGUqJTYM6YQBZ8++zwcffMBMKc9sqcBnnz6llDhi2bz2xt9R3rGDv/6b7zI1M836+jr1zRqF/ARWJMLqoxVeeO4ZJsbHmCpOUi7lsE2DtUoVy0pQzM/w6g9+yK3bi3T6DoOhCKON4/r0hj3FX1/6ujdSajzyHdLpNKlkkuJkkaOH5jl04DCTuQlipo1kq9PuEYaa6gDatTOvhYL9AE0Ji23FFeal0mI4JKvZdBLD0BkM+wz7PS5eOs+1K1fZN7ebmVJBZS4/VeLR2hrvnn2fr339H/PK//pzXnjh83zvr/6G9UqFbDrF/n1zrK2s8OJLX1Ktbv7QfvxRF2c0UM46m5nAGYX86I23qTc6rKxv0h6MlH/3xVCEHrGYhR7RGI0GBL67rSeapooUtxMc3n+A/XsPsHNmlumpGZLJFMPeUImY6JH2yVuvho4nBlvfhkDEVBeIx5MqI5IM35VM9+iJyumw/PABN2/eZHwsQ7O+Qahr9EdDDDtGIptmLJtT6BAH9nDxHjeuXuPpkycZz2a4fuMqJ04c560zb/HM506yY7ZILGqQScq1ely9coubN+8ycAPuL6+gW3GMmMXI93B9D9uMoimP6WHo0l1cdC2kudVkNPDJpVMU8nkeP/I4zz/7HIVCCV8cpGkrbdI++ckPQjEFsVgCGSL6/aEKMplIMTGZU9Vr1bfo9Tu4oyF2zKJR2+TcuXOsr1dYfLDIY0eOELUtJosldbBLlz7iX/3L32Xt0Qp/9Ad/yEyxyOPHjnHyySdY31hjbWMND5/sWBJNG5FOxDF1m5WlClc/uclmrcX9BxVagyH56WmVSMd1GTgDQt9lNOyj+yHZVBycIVZEo91s4zkOlljNEOYPPcbXvvaP2Lf3AJZlq/iEutrt998KhbsSWCKVUdXt9Xo4jqcSoIge+IonoszOcMDa2hpn33+P24t32HfoIENnwLPPP8dGrcathZu4jsOTxx9nZnqaP/79P1SW8tf+6T9jc3OTO3cX+fjKp6zXqszuKLN3bppkPIahmYg1a9S7rK3Xef1HP8OwDYrlaWKppDqLJz6g16XbbCirWMiNYRIgtnrU6xONbLenRm2LwmSRF09/ic997lmS6SyJRBIEEa2Fj8J6va4a99hYTl242W4pVRNIi/GIaDqLi4vq8+H5g7TbbS5fvkyvP2R65y4uXrxIt9fkt377G3zw/jtU1h6xd88Ojswf5s9feYW9e+b4F7/7b/n3/+bfMbtjN49Wqzx18hTtTp0zP/4hG9VVchNFDh6Yp9bscOHSp6xX60TtuDrXxMSEsrSa7yF+Y9CRXhsyO1NWVROtkYDFLI1nsmpIEed49OhRXn75ZaamZ2i1WtjxGNryuXfCsYmcqkK1tkm1WlXeM5lMKx4K0UXMpFdvbW2RiKdIZ5IsPXzE5Y8/otntK5v5ve/+Nb434Pf+x3+lUnnID77/f/nqV19irVJhfGyCVrPLu++dpVSeZdfO/cw/doQb16+xvnqXpQf36fT6YJjUWwOqtTrdvoMfhOr+YxKEjKmeg21EwHOI6JCTCtuWapUDCbjbYyKXU/7fGY7Ys2cPzz33HEcfP6aQO5RFQe36xbDT66ov6EZEZUsatTiUTCaj/LRAfnx8XGW71+6RTMZZXl7he99/leT4OOXpaXxvyBs/+iE6Hom4RbddZ3aHwDXBoD/i6vUbvPTSV/nGb36Tsx+c50//7DtSBp55+rhS3Ga7w/0Hy9y5v0RPWpEps7LP5OSkMhW4PsNeC1M2G4amAhZfn8qkt1V6OKLbbpNNZ1TxBv0++Xxe/e6LL75IuVym1++jrV07H969e1cZ71KpxEy5rMYpxWsjquArcJYqT5VLWEZUXURucufuPaqNBoVSnlKxwO3bN3nt1b/lyNFDpONxqtU1njh+gm9/+/dJplN02l1qjSarK5uUZ6Z47tnPsGdmmnKpgGHafPTpVd58+6fcf7iMJ23IC5mZmVHnipkW7WadUa+j5mgruu2lJ/J54smEssH1Wo3A89UAJDoiVJAYTp8+zfHjx4lEDbR7l95TKx5Z50im43aMsbExJf29dkcNDQJzuYD4YbmYwFtdOBGj57ps1mrEbJPp6Wnu3l5QQ0Wv2ebPXvkThRCp0te//nX+8i//guXVClNTU+zYuZOt2gajTpt0Mkk8maa2VefarTtUN2tiY8TpKk3ZvXMXhckc7VaTerWKGY2QTgq/A/KlIrlcjlx2TInpxnpV7eIMPUK5NKViOHDgAE888QTjkxNoGwtXQk32QkGAMxopOMu/pbfJa/H2bXbt2kXm781H3LLpdsUsjEiPj3Hv0RJvvPUmhw/O89RTTymxiOpRxnbv5jv/7b/Tbjf51re+xdbWJucvn+fpp59Sq5dqdZ12s8Wo0+Hm1WvcvfeApnjuXp92t0+7M6DR7qvlXblcpDxVwh0OVEtMJWJM5sYVyrLjY6THsspabmxssHTvvmqrMjzsnN2BFoRKi0TABNZar/IgrG6sq1aUsC2VUTEZooYiGJ7rKOUT87+6+khdIJGMKZNixmx67ohzly4y6A7UiPjFz59GDzVMw+Lq1asc2DtHPBFTM7S4tcraMpc/vry9PgoCwqHL5fMXuHHzNgPHQfYyoSzqvEB1gdFwqDy96Imhge+MKBUmKRWK+IGHZdsqcEGR0G91aXnbR8QTzM7MMOz1VWv9zNOntgMOO5shAulen3pjS01M2WwaSyAjA2UY0tiosrb6iGZ9SyVkYnJcCUOj22R5vcLySkVNKeJXT544ydGjx+g1trePWuirRJVmpjhz5i26gxatVlOZiFwmzfpShWqlqtqGBCzDgidjXSyGYdnq8M1mXe2zbFk+2Ca7ZncwVSoquggOBXGiK0LLzY0Nta4SzZGkeK6rIP8PX/oKs7OzaJWFa2p4ENFynCGtZoODB/eTjMXxA1e5q/PnfsHlyxe5t7igLlooTBI1DLWY002dTm9A3IozMZHHH/k4jsvhvfM888wz6jD9QZeLF89z4+ZVIrIgMba3iBPZMfqNLtlURvXTlco6D5YeokeiqivIcCDDhwQmBxfOCrV2795NPpfbnn9bbeUPpMpCR9EXYaMacTVNBSsLgFMnn+bUqVNoreV7ykvLaChZXVp6oMy5cHVyMkejucUf/N63SaWTLC0tqSoL36dnpkgkk0TjJlHTVmCYKkzR2GoogVtdXlXzqQig3LzRrLG5tYFs4gSiYlEnx3OkrQS+G6hD15tS/ZY6R0ZaESjz8+DBA2qbVfUdz3OIx2IUiwVy2XGVDBFVme7Gx7Mq+XLmfC7P3NxutW4SJ3f8+BPs2zeH5m9WQ1mgjXpdtpoNlpeXGRvLKCsp20rJ8Hf+9E+IJ2zeeecdZmbK3Lt3Tz0xmD96RJmRQqmo1P3Q/oNsVjewTJOl+w+UgdnarGFaUTzfV5WWRb4cTNrS1GSJTr2tYCj8EygLZSRJskaSxMpbLKn8rrTKVquhEimJSCYS6KGMrQYj12cw6BG1bHV90YJWu8Heuf0cO/oYJ0+eojhVRBs8Wg7tdErBpddqKfGaLBbQDIP6ZpWFhQUuXDyvAv/bV1/lyadOKPmXG8vgLT8X6ApfpJUZocbBQwfYqq5z48YN1itrJBIJ8sWCamuyV5bZWlAhra2+scnm+qYaQ0UIZfwTgZKAxATJZwXddoOVlRVVTRE/mX4EqhPjk+rMruuTTCdIpjJq4RiJyh4uzeOPn+Cznz3F3Nw+1X206vVroazw84UCqMCVCiij7fuu2hDeunWLO3fucOHyBSqVilrWabrOtWvXlBLi+8rXyqrm9OefVw5o7dEyn3zyEbG4pR6niOuJRi3WqpusVTdoNdt0O2IionTbHcVBCVgIKNsMgbW8hOtSWYFzo9FQkDflkYoepdtq0+8OGB8bw44l1D5aNy0iZoTdc3t54qkTHD70GHvmdim3d//BXbStGzdCWW6LaDxaWVHiJQ+hDj02T2pyUjq/PMWiX6+r/xfIN1pNVQGB4UeXLnP+Fx8SFTM/O8XXvvJlms2aspr12qY6oHBY1yPUm10ePFzh0fIKw6GHGbVJxIX/rrq/vGQakplbYKr4KvxvbOuG3P+XVlf+P2bF2VnewaFDh1Rvr7eapMayTE2XyU7kGMuNq7FVUCLUk7Nr4dp6iBFRcH7zJz9mZXVVwe/Z5/+BUsr1japyKM1WCytmq6cI3X6PMEAN2mPJNGHgs1Wt8PP3zmBHIZGMYkZ1FhZucG9xUT3uGLoeriPMN6hvdWh3+qpXxmP2r7YW4vSG/b4SNV2TFWtLwVmClTOJAZJ+WyqX2bdvH9NTUxTzZdpbddbW18lMjFM8eAA8l2Gviz0xjtPrYgpyfvkwLRw5If2+quSju3cUV4WjpfIUVizBkSeO8/DhEpP5Io7vsXjvjvK30vdaggZ0XGdE3DawTI3axiq3F67TaddJJhNqfbO2VuXC+YtUN+rkJ8sEga4CTidT8rQI1x2p3ik8llaoVjFhQG1rU/H/+IkTyg/vO3hAmQhJgKCrWlljx8wOxeFPrnxKrVHn6LFj7JjbjS+otUwsO67alax4hDL/H0xJ7BFdZf6MAAAAAElFTkSuQmCC">
1906
+ * let a = '<canvas width="60" height="32"></canvas>';
1907
+ * bbn.fn.canvasToImage(a);
1908
+ * ```
1909
+ *
1910
+ * @memberof bbn.fn
1911
+ * @param {canvas} canvas
1912
+ * @returns {HTMLElement}
1913
+ */
464
1914
  const canvasToImage: (canvas: any) => HTMLImageElement;
465
1915
  export { canvasToImage };
466
1916
  }
467
- declare module "fn/center" {
1917
+ declare module "fn/style/center" {
1918
+ /**
1919
+ * Centers the given element by giving it a position absolute.
1920
+ *
1921
+ * @method center
1922
+ * @global
1923
+ * @example
1924
+ * ```javascript
1925
+ * //<div style="position: absolute; top: 73px; left: 0px;">Documentation</div>
1926
+ * bbn.fn.center('<div>Documentation</div>')
1927
+ * ```
1928
+ * @memberof bbn.fn
1929
+ * @param {HTMLElement} ele
1930
+ * @returns {HTMLElement} The dom element with the new style.
1931
+ */
468
1932
  const center: (ele: any) => any;
469
1933
  export { center };
470
1934
  }
471
- declare module "fn/checkPropsDetails" {
1935
+ declare module "fn/object/checkPropsDetails" {
472
1936
  const checkPropsDetails: (obj: object, props: string | string[], checkEmpty?: boolean) => BbnResError;
473
1937
  export { checkPropsDetails };
474
1938
  }
475
- declare module "fn/checkProps" {
1939
+ declare module "fn/object/checkProps" {
476
1940
  const checkProps: (obj: object, props: string | string[], checkEmpty?: boolean) => boolean;
477
1941
  export { checkProps };
478
1942
  }
479
- declare module "fn/checkPropsOrDie" {
1943
+ declare module "fn/object/checkPropsOrDie" {
480
1944
  const checkPropsOrDie: (obj: object, props: string | string[], checkEmpty?: boolean) => boolean;
481
1945
  export { checkPropsOrDie };
482
1946
  }
483
- declare module "fn/clone" {
1947
+ declare module "fn/object/clone" {
1948
+ /**
1949
+ * Creates and returns a perfect clone - but different - from the given object.
1950
+ *
1951
+ * @method clone
1952
+ * @global
1953
+ * @example
1954
+ * ```javascript
1955
+ * let obj = {name: "Thomas"};
1956
+ * let objCopy = bbn.fn.clone(obj);
1957
+ * obj.name = "Julie";
1958
+ * // obj: {name: "Julie"}
1959
+ * // objCopy: {name: "Thomas"}
1960
+ * ```
1961
+ * @memberof bbn.fn
1962
+ * @param {Object} obj The source object
1963
+ * @returns {Object} A new object
1964
+ */
484
1965
  const clone: (obj: any) => any;
485
1966
  export { clone };
486
1967
  }
487
- declare module "fn/colorToHex" {
1968
+ declare module "fn/convert/colorToHex" {
1969
+ /**
1970
+ * Returns the hex color of the given rgb or color name.
1971
+ * @method colorToHex
1972
+ * @global
1973
+ * @example
1974
+ * ```javascript
1975
+ * //"#ff0000"
1976
+ * bbn.fn.colorToHex('red');
1977
+ * ```
1978
+ *
1979
+ * @example
1980
+ * ```javascript
1981
+ * //"#ff0000"
1982
+ * bbn.fn.colorToHex('rgb(255,0,0)');
1983
+ * ```
1984
+ * @memberof bbn.fn
1985
+ * @returns {String}
1986
+ */
488
1987
  const colorToHex: (color: any) => string | CanvasGradient | CanvasPattern;
489
1988
  export { colorToHex };
490
1989
  }
491
- declare module "fn/copy" {
1990
+ declare module "fn/browser/copy" {
1991
+ /**
1992
+ * Copies to the clipboard the value of the given string.
1993
+ * @method copy
1994
+ * @global
1995
+ * ``` javascript
1996
+ * let myVal = 'the value you want to copy to clipbord';
1997
+ * bbn.fn.copy(myVal);
1998
+ *
1999
+ * ```
2000
+ * @memberof bbn.fn
2001
+ * @param {String} st The string to copy.
2002
+ * @returns
2003
+ */
492
2004
  const copy: (st: any) => Promise<unknown>;
493
2005
  export { copy };
494
2006
  }
495
- declare module "fn/count" {
2007
+ declare module "fn/object/count" {
2008
+ /**
2009
+ * Counts the number of objects matching the given filter in the given array.
2010
+ *
2011
+ * The arguments follow the same scheme as bbn.fn.search.
2012
+ *
2013
+ * @method count
2014
+ * @global
2015
+ * @example
2016
+ * ```javascript
2017
+ * let ar = [
2018
+ * {name: "Raiders of the lost ark", director: "Steven Spielberg", year: 1981, id: 589},
2019
+ * {name: "Goonies", director: "Richard Donner", year: 1985, id: 689},
2020
+ * {name: "Star wars", director: "George Lucas", year: 1977, id: 256},
2021
+ * {name: "Jaws", director: "Steven Spielberg", year: 1975, id: 423}
2022
+ * ];
2023
+ * bbn.fn.count(ar, "id", 256);
2024
+ * // 1
2025
+ * bbn.fn.count(ar, {director: "Steven Spielberg"});
2026
+ * // 2
2027
+ * bbn.fn.search(ar, "year", 1975, ">");
2028
+ * // 3
2029
+ * // Complex filters: all the movies from Spielberg between 1974 and 1980
2030
+ * bbn.fn.search(ar, {
2031
+ * logic: "AND",
2032
+ * conditions: [
2033
+ * {
2034
+ * field: "director",
2035
+ * operator: "eq",
2036
+ * value: "Steven Spielberg"
2037
+ * }, {
2038
+ * logic: "AND",
2039
+ * conditions: [
2040
+ * {
2041
+ * field: "year",
2042
+ * operator: ">=",
2043
+ * value: 1974
2044
+ * }, {
2045
+ * field: "year",
2046
+ * operator: "<=",
2047
+ * value: 1980
2048
+ * }
2049
+ * ]
2050
+ * }
2051
+ * ]
2052
+ * });
2053
+ * // 1
2054
+ * ```
2055
+ * @memberof bbn.fn
2056
+ * @param {Array} arr The subject array
2057
+ * @param {(String|Object|Function)} prop A property's name or a filter object or function
2058
+ * @param {*} val The value with which comparing the given property
2059
+ * @param {String} operator The operator to use for comparison with the value as used in bbn.fn.compare
2060
+ * @returns {Number} The number of items
2061
+ */
496
2062
  const count: (arr: any[], prop: object | string, val?: any, operator?: string) => number;
497
2063
  export { count };
498
2064
  }
499
- declare module "fn/crc32" {
2065
+ declare module "fn/string/crc32" {
500
2066
  const crc32: (str: any) => number;
501
2067
  export { crc32 };
502
2068
  }
503
- declare module "fn/createObject" {
2069
+ declare module "fn/object/createObject" {
504
2070
  const createObject: (...args: any[]) => any;
505
2071
  export { createObject };
506
2072
  }
507
- declare module "fn/cssExists" {
2073
+ declare module "fn/style/cssExists" {
2074
+ /**
2075
+ * not used
2076
+ * @ignore
2077
+ * @method cssExists
2078
+ * @todo Add method description for cssExists
2079
+ * @global
2080
+ * @memberof bbn.fn
2081
+ * @param {String} f
2082
+ * @returns
2083
+ */
508
2084
  const cssExists: (f: any) => boolean;
509
2085
  export { cssExists };
510
2086
  }
511
- declare module "fn/dateSQL" {
512
- const dateSQL: (v: any, dayOnly: any) => string;
513
- export { dateSQL };
514
- }
515
- declare module "fn/daysInMonth" {
516
- const daysInMonth: (v: any) => number | false;
2087
+ declare module "fn/datetime/dateSQL" {
2088
+ /**
2089
+ * Returns a date with SQL format.
2090
+ *
2091
+ * @method dateSQL
2092
+ * @global
2093
+ *
2094
+ * @example
2095
+ * ``` javascript
2096
+ * //"2020-04-16 16:15:23"
2097
+ * let date = new Date();
2098
+ * bbn.fn.dateSQL(date,false);
2099
+ * ```
2100
+ *
2101
+ * @memberof bbn.fn
2102
+ * @param {Date|String} v
2103
+ * @param {Boolean} dayOnly Whether or not include the time in the date
2104
+ * @returns {String}
2105
+ */
2106
+ const dateSQL: (v: any, dayOnly: any) => string;
2107
+ export { dateSQL };
2108
+ }
2109
+ declare module "fn/datetime/daysInMonth" {
2110
+ /**
2111
+ * Returns the number of days of the month given in the date.
2112
+ * @method daysInMonth
2113
+ * @global
2114
+ *
2115
+ * @example
2116
+ * ``` javascript
2117
+ * //30
2118
+ * bbn.fn.daysInMonth(new Date());
2119
+ * ```
2120
+ *
2121
+ * @memberof bbn.fn
2122
+ * @param {String|Date} v
2123
+ * @returns {Number}
2124
+ */
2125
+ const daysInMonth: (v: any) => number | false;
517
2126
  export { daysInMonth };
518
2127
  }
519
- declare module "fn/deepPath" {
2128
+ declare module "fn/object/deepPath" {
2129
+ /**
2130
+ * Retrieves all elements of a hierarchical array corresponding to the filter.
2131
+ *
2132
+ * The arguments follow the same scheme as bbn.fn.search.
2133
+ *
2134
+ * @method findAll
2135
+ * @global
2136
+ * @example
2137
+ * ```javascript
2138
+ * let ar = [
2139
+ * {name: "Raiders of the lost ark", director: "Steven Spielberg", year: 1981, id: 589},
2140
+ * {name: "Goonies", director: "Richard Donner", year: 1985, id: 689},
2141
+ * {name: "Star wars", director: "George Lucas", year: 1977, id: 256},
2142
+ * {name: "Jaws", director: "Steven Spielberg", year: 1975, id: 423}
2143
+ * ];
2144
+ * bbn.fn.count(ar, "id", 256);
2145
+ * // 1
2146
+ * bbn.fn.count(ar, {director: "Steven Spielberg"});
2147
+ * // 2
2148
+ * bbn.fn.search(ar, "year", 1975, ">");
2149
+ * // 3
2150
+ * // Complex filters: all the movies from Spielberg between 1974 and 1980
2151
+ * bbn.fn.search(ar, {
2152
+ * logic: "AND",
2153
+ * conditions: [
2154
+ * {
2155
+ * field: "director",
2156
+ * operator: "eq",
2157
+ * value: "Steven Spielberg"
2158
+ * }, {
2159
+ * logic: "AND",
2160
+ * conditions: [
2161
+ * {
2162
+ * field: "year",
2163
+ * operator: ">=",
2164
+ * value: 1974
2165
+ * }, {
2166
+ * field: "year",
2167
+ * operator: "<=",
2168
+ * value: 1980
2169
+ * }
2170
+ * ]
2171
+ * }
2172
+ * ]
2173
+ * });
2174
+ * // 1
2175
+ * ```
2176
+ * @memberof bbn.fn
2177
+ * @todo Do the doc!
2178
+ * @param {Array} arr The subject array
2179
+ * @param {(String|Object|Function)} prop A property's name or a filter object or function
2180
+ * @param {*} val The value with which comparing the given property
2181
+ * @param {String} operator The operator to use for comparison with the value as used in bbn.fn.compare
2182
+ * @returns {Number} The number of items
2183
+ */
520
2184
  const deepPath: (arr: any[], filter: object, deepProperty: string, res?: any[]) => false | any[];
521
2185
  export { deepPath };
522
2186
  }
523
- declare module "fn/defaultConfirmFunction" {
2187
+ declare module "fn/default/defaultConfirmFunction" {
524
2188
  const defaultConfirmFunction: (text: string, yesFn: () => any, noFn: () => any) => void;
525
2189
  export { defaultConfirmFunction };
526
2190
  }
527
- declare module "fn/defaultErrorFunction" {
2191
+ declare module "fn/default/defaultErrorFunction" {
528
2192
  const defaultErrorFunction: (message: any) => void;
529
2193
  export { defaultErrorFunction };
530
2194
  }
531
- declare module "fn/defaultHistoryFunction" {
2195
+ declare module "fn/default/defaultHistoryFunction" {
532
2196
  const defaultHistoryFunction: (obj: any) => boolean;
533
2197
  export { defaultHistoryFunction };
534
2198
  }
535
- declare module "fn/defaultPreLinkFunction" {
2199
+ declare module "fn/default/defaultPreLinkFunction" {
536
2200
  const defaultPreLinkFunction: (url: string, force?: boolean, ele?: HTMLElement) => string;
537
2201
  export { defaultPreLinkFunction };
538
2202
  }
539
- declare module "fn/defaultResizeFunction" {
2203
+ declare module "fn/default/defaultResizeFunction" {
540
2204
  const defaultResizeFunction: () => boolean;
541
2205
  export { defaultResizeFunction };
542
2206
  }
543
- declare module "fn/deleteProp" {
2207
+ declare module "fn/object/deleteProp" {
2208
+ /**
2209
+ * Gets the given property from the given object
2210
+ * @param {Object} obj
2211
+ * @param {String} prop
2212
+ * @returns
2213
+ */
544
2214
  const deleteProp: (obj: object, prop: string) => void;
545
2215
  export { deleteProp };
546
2216
  }
547
- declare module "fn/isValue" {
2217
+ declare module "fn/type/isValue" {
2218
+ /**
2219
+ * Returns true if the given argument is not null or type object or array.
2220
+ * @method isValue
2221
+ * @deprecated
2222
+ * @see bbn.fn.isPrimitive
2223
+ * @example
2224
+ * ```javascript
2225
+ * bbn.fn.isValue('myString');
2226
+ * //true
2227
+ * ```
2228
+ * @example
2229
+ * ```javascript
2230
+ * bbn.fn.isValue(6);
2231
+ * //true
2232
+ * ```
2233
+ * @example
2234
+ * ```javascript
2235
+ * bbn.fn.isValue([80,10,22]);
2236
+ * //false
2237
+ * ```
2238
+ * @global
2239
+ * @memberof bbn.fn
2240
+ * @returns {Boolean}
2241
+ */
548
2242
  const isValue: (...args: any[]) => boolean;
549
2243
  export { isValue };
550
2244
  }
551
- declare module "fn/diffObj" {
2245
+ declare module "fn/object/diffObj" {
2246
+ /**
2247
+ * Returns an object describing the differences for transforming the first given object into the second.
2248
+ *
2249
+ * The returned data will use the objects properties as keys. If unchanged is set to true, all the
2250
+ * properties will be returned, otherwise only the different ones. Each of these keys will have the
2251
+ * following properties:
2252
+ * - type: can be _modified_, _created_, _deleted_, and if unchanged is set to true _unchanged_
2253
+ * - data: the first object's property's value, or the second if type is _created_
2254
+ * - newData: the second object's property's value in case of type _updated_
2255
+ *
2256
+ * @method diffObj
2257
+ * @global
2258
+ * @example
2259
+ * ```javascript
2260
+ * bbn.fn.diffObj(
2261
+ * {
2262
+ * name: "Thomas",
2263
+ * age: 45
2264
+ * }, {
2265
+ * name: "Eva",
2266
+ * sex: "Female",
2267
+ * retired: false
2268
+ * }
2269
+ * );
2270
+ * // {
2271
+ * // name: {
2272
+ * // type: "updated",
2273
+ * // data: "Thomas",
2274
+ * // newData: "Eva"
2275
+ * // },
2276
+ * // age: {
2277
+ * // type: "deleted",
2278
+ * // data: 45
2279
+ * // },
2280
+ * // sex: {
2281
+ * // type: "created",
2282
+ * // data: "Female"
2283
+ * // },
2284
+ * // retired: {
2285
+ * // type: "created",
2286
+ * // data: false
2287
+ * // }
2288
+ * // }
2289
+ * ```
2290
+ * @example
2291
+ * ```javascript
2292
+ * bbn.fn.diffObj(
2293
+ * {pupil: "Agnes Varda", grade: {year: "B", month: "A"}},
2294
+ * {pupil: "Luc Besson", grade: {year: "C", month: "D"}}
2295
+ * );
2296
+ * // {
2297
+ * // "pupil": {
2298
+ * // "type": "updated",
2299
+ * // "data": "Agnes Varda",
2300
+ * // "newData": "Luc Besson"
2301
+ * // },
2302
+ * // "grade": {
2303
+ * // "year": {
2304
+ * // "type": "updated",
2305
+ * // "data": "B",
2306
+ * // "newData": "C"
2307
+ * // },
2308
+ * // "month": {
2309
+ * // "type": "updated",
2310
+ * // "data": "A",
2311
+ * // "newData": "D"
2312
+ * // }
2313
+ * // }
2314
+ * // }
2315
+ * ```
2316
+ * @memberof bbn.fn
2317
+ * @param {Object} obj1
2318
+ * @param {Object} obj2
2319
+ * @param {String} unchanged
2320
+ * @param {Boolean} notRoot
2321
+ * @returns {Object}
2322
+ */
552
2323
  const diffObj: (obj1: object, obj2: object, unchanged?: boolean, notRoot?: boolean) => any;
553
2324
  export { diffObj };
554
2325
  }
555
- declare module "fn/dirName" {
2326
+ declare module "fn/string/dirName" {
2327
+ /**
2328
+ * Returns the path of the folder containing the last hierarchical element of the path.
2329
+ *
2330
+ * @method dirName
2331
+ * @global
2332
+ *
2333
+ * @example
2334
+ * ```javascript
2335
+ * //"folder/other_folder"
2336
+ * bbn.fn.dirName('folder/other_folder/file');
2337
+ * ```
2338
+ * @memberof bbn.fn
2339
+ * @param {String} path
2340
+ * @returns {String} path of the folder
2341
+ */
556
2342
  const dirName: (path: any) => string;
557
2343
  export { dirName };
558
2344
  }
559
- declare module "fn/isBlob" {
2345
+ declare module "fn/type/isBlob" {
2346
+ /**
2347
+ * @method isBlob
2348
+ * @todo Add method description for isFunction
2349
+ * @global
2350
+ * @memberof bbn.fn
2351
+ * @returns {Boolean}
2352
+ */
560
2353
  const isBlob: (...args: any[]) => boolean;
561
2354
  export { isBlob };
562
2355
  }
563
- declare module "fn/fileExt" {
2356
+ declare module "fn/string/fileExt" {
2357
+ /**
2358
+ * Gets the extension from a file's name.
2359
+ *
2360
+ * The extension is returned in lower case; if the filename has no extension
2361
+ * or is not valid it will return an empty string.
2362
+ *
2363
+ * @method fileExt
2364
+ * @global
2365
+ *
2366
+ * @example
2367
+ * ```javascript
2368
+ * // "txt"
2369
+ * bbn.fn.fileExt('my_file.txt')
2370
+ * ```
2371
+ *
2372
+ * @example
2373
+ * ```javascript
2374
+ * // "txt"
2375
+ * bbn.fn.fileExt('MY_FILE.TXT')
2376
+ * ```
2377
+ *
2378
+ * @example
2379
+ * ```javascript
2380
+ * // ""
2381
+ * bbn.fn.fileExt('MY_FILE')
2382
+ * ```
2383
+ *
2384
+ * @example
2385
+ * ```javascript
2386
+ * // ""
2387
+ * bbn.fn.fileExt('.MY_FILE')
2388
+ * ```
2389
+ *
2390
+ * @param {String} filename
2391
+ * @returns {String} The file's extension
2392
+ */
564
2393
  const fileExt: (filename: any) => any;
565
2394
  export { fileExt };
566
2395
  }
567
- declare module "fn/isCanvas" {
2396
+ declare module "fn/type/isCanvas" {
2397
+ /**
2398
+ * Returns true if the given argumen is a Canvas.
2399
+ *
2400
+ * @method isCanvas
2401
+ * @global
2402
+ * @example
2403
+ * ```javascript
2404
+ * let myCanvas = document.createElement('canvas');
2405
+ * bbn.fn.isCanvas(myCanvas);
2406
+ * //true
2407
+ * ```
2408
+ * @memberof bbn.fn
2409
+ * @returns {Boolean}
2410
+ */
568
2411
  const isCanvas: (...args: any[]) => boolean;
569
2412
  export { isCanvas };
570
2413
  }
571
- declare module "fn/downloadContent" {
2414
+ declare module "fn/ajax/downloadContent" {
2415
+ /**
2416
+ * Downloads a file with given filename from the given content.
2417
+ *
2418
+ * Creates a link putting in href a URL Object Blob made of the given content,
2419
+ * which can be a canvas, a file or a blob object, or just a string.
2420
+ *
2421
+ * @method downloadContent
2422
+ * @global
2423
+ * @memberof bbn.fn
2424
+ *
2425
+ * @example
2426
+ * ```javascript
2427
+ * // Download from a string
2428
+ * bbn.fn.downloadContent('myTextFile.txt', 'Just a string\nThat we can save directly in a file', 'text/plain');
2429
+ *
2430
+ * // Download from a file
2431
+ * let file = new File(["foo"], "foo.txt", {type: "text/plain"});
2432
+ * bbn.fn.downloadContent('foo.txt', file);
2433
+ * ```
2434
+ *
2435
+ * @param {String} filename The name for the downloaded file
2436
+ * @param {HTMLCanvasElement|File|String} content A Canvas, a File object or a String
2437
+ * @param {String} type The type of file to be made
2438
+ *
2439
+ * @returns {undefined}
2440
+ */
572
2441
  const downloadContent: (filename: string, content: any, type?: string) => void;
573
2442
  export { downloadContent };
574
2443
  }
575
- declare module "fn/download" {
2444
+ declare module "fn/ajax/download" {
2445
+ /**
2446
+ * Downloads a file with given filename from a URL.
2447
+ *
2448
+ * Gets the file's content as Blob through XHR, then sends it to bbn.fn.downloadContent.
2449
+ * __Attention__ The CORS policy applies
2450
+ *
2451
+ * @method download
2452
+ * @global
2453
+ * @memberof bbn.fn
2454
+ *
2455
+ * @example
2456
+ * ```javascript
2457
+ * // Forcing the download of an image
2458
+ * bbn.fn.download('/bbn/js-title-black.png');
2459
+ *
2460
+ * // Forcing the download of a PDF
2461
+ * bbn.fn.download('/files/my-document.pdf');
2462
+ *
2463
+ * // Changing the name as it is downloaded
2464
+ * bbn.fn.download('/files/f4b1092d71aefd96458feaa71d170f69.pdf', 'myDocument_' + bbn.fn.dateSQL() + '.pdf');
2465
+ * ```
2466
+ *
2467
+ * @param {String} url The URL from which the file will be requested
2468
+ * @param {String} filename The name for the downloaded file (otherwise it will take the basename of the url)
2469
+ * @param {Object} params A data object to send with the request
2470
+ *
2471
+ * @returns {undefined}
2472
+ */
576
2473
  const download: (url: string, filename?: string | object, params?: object) => any;
577
2474
  export { download };
578
2475
  }
579
- declare module "fn/eraseCookie" {
2476
+ declare module "fn/browser/eraseCookie" {
2477
+ /**
2478
+ * Erase the cookie corresponding to the given name;
2479
+ *
2480
+ * @method eraseCookie
2481
+ * @global
2482
+ * @example
2483
+ * ``` javascript
2484
+ * // 'en'
2485
+ * bbn.fn.erase('lang');
2486
+ * ```
2487
+ * @memberof bbn.fn
2488
+ * @returns {*}
2489
+ */
580
2490
  const eraseCookie: (name: any) => void;
581
2491
  export { eraseCookie };
582
2492
  }
583
- declare module "fn/escapeDquotes" {
2493
+ declare module "fn/string/escapeDquotes" {
584
2494
  const escapeDquotes: (str: any) => any;
585
2495
  export { escapeDquotes };
586
2496
  }
587
- declare module "fn/escapeSquotes" {
2497
+ declare module "fn/string/escapeSquotes" {
588
2498
  const escapeSquotes: (str: any) => any;
589
2499
  export { escapeSquotes };
590
2500
  }
591
- declare module "fn/escapeTicks" {
2501
+ declare module "fn/string/escapeTicks" {
592
2502
  const escapeTicks: (str: any) => any;
593
2503
  export { escapeTicks };
594
2504
  }
595
- declare module "fn/escapeUrl" {
2505
+ declare module "fn/string/escapeUrl" {
2506
+ /**
2507
+ * Escapes a URL or a file path, optionally adding parameters (get type, to append to the URL without the first separator).
2508
+ *
2509
+ * @param {*} url
2510
+ * @param {*} params
2511
+ * @returns
2512
+ */
596
2513
  const escapeUrl: (url: any, params: any) => string;
597
2514
  export { escapeUrl };
598
2515
  }
599
- declare module "fn/extendOut" {
2516
+ declare module "fn/object/extendOut" {
2517
+ /**
2518
+ * Returns a new object made of the properties from all the given objects.
2519
+ *
2520
+ * Compared to bbn.fn.extend this still treats the arguments from left to right
2521
+ * but without overwriting existing properties, and returning a new object.
2522
+ *
2523
+ * @method extendOut
2524
+ * @global
2525
+ * @example
2526
+ * ```javascript
2527
+ * //{field1: 1, field2: 2, field3: 3, items: {item: 0, item1: 1, item2: 2}, field4: 4}
2528
+ * bbn.fn.extendOut({field1: 1, field2: 2, field3: 3, items: {item: 0}}, {field4: 4, items: {item1: 1, item2: 2}});
2529
+ * ```
2530
+ * @memberof bbn.fn
2531
+ * @returns {Object}
2532
+ */
600
2533
  const extendOut: (...args: object[]) => any;
601
2534
  export { extendOut };
602
2535
  }
603
- declare module "fn/fieldValue" {
2536
+ declare module "fn/form/fieldValue" {
2537
+ /**
2538
+ * Returns the value of a form's input, differenciating between checkboxes, radio and other inputs.
2539
+ *
2540
+ * @method fieldValue
2541
+ * @global
2542
+ * @memberof bbn.fn
2543
+ * @param {HTMLElement} field The input element
2544
+ *
2545
+ * @returns {Mixed} The value
2546
+ */
604
2547
  const fieldValue: (field: any) => any;
605
2548
  export { fieldValue };
606
2549
  }
607
- declare module "fn/findAll" {
2550
+ declare module "fn/object/findAll" {
2551
+ /**
2552
+ * Retrieves all elements of a hierarchical array corresponding to the filter.
2553
+ *
2554
+ * The arguments follow the same scheme as bbn.fn.search.
2555
+ *
2556
+ * @method findAll
2557
+ * @global
2558
+ * @example
2559
+ * ```javascript
2560
+ * let ar = [
2561
+ * {name: "Raiders of the lost ark", director: "Steven Spielberg", year: 1981, id: 589},
2562
+ * {name: "Goonies", director: "Richard Donner", year: 1985, id: 689},
2563
+ * {name: "Star wars", director: "George Lucas", year: 1977, id: 256},
2564
+ * {name: "Jaws", director: "Steven Spielberg", year: 1975, id: 423}
2565
+ * ];
2566
+ * bbn.fn.count(ar, "id", 256);
2567
+ * // 1
2568
+ * bbn.fn.count(ar, {director: "Steven Spielberg"});
2569
+ * // 2
2570
+ * bbn.fn.search(ar, "year", 1975, ">");
2571
+ * // 3
2572
+ * // Complex filters: all the movies from Spielberg between 1974 and 1980
2573
+ * bbn.fn.search(ar, {
2574
+ * logic: "AND",
2575
+ * conditions: [
2576
+ * {
2577
+ * field: "director",
2578
+ * operator: "eq",
2579
+ * value: "Steven Spielberg"
2580
+ * }, {
2581
+ * logic: "AND",
2582
+ * conditions: [
2583
+ * {
2584
+ * field: "year",
2585
+ * operator: ">=",
2586
+ * value: 1974
2587
+ * }, {
2588
+ * field: "year",
2589
+ * operator: "<=",
2590
+ * value: 1980
2591
+ * }
2592
+ * ]
2593
+ * }
2594
+ * ]
2595
+ * });
2596
+ * // 1
2597
+ * ```
2598
+ * @memberof bbn.fn
2599
+ * @todo Do the doc!
2600
+ * @param {Array} arr The subject array
2601
+ * @param {(String|Object|Function)} prop A property's name or a filter object or function
2602
+ * @param {*} val The value with which comparing the given property
2603
+ * @param {String} operator The operator to use for comparison with the value as used in bbn.fn.compare
2604
+ * @returns {Number} The number of items
2605
+ */
608
2606
  const findAll: (arr: any, filter: any, deepProperty: any, res?: any[]) => any[];
609
2607
  export { findAll };
610
2608
  }
611
- declare module "fn/fori" {
2609
+ declare module "fn/loop/fori" {
2610
+ /**
2611
+ * Executes the provided function on each element of the given array.
2612
+ *
2613
+ * A minimum and a maximum value can be provided, within the boundaries of the
2614
+ * array's indexes. Returning false will stop the loop.
2615
+ *
2616
+ * @method fori
2617
+ * @global
2618
+ * @example
2619
+ * ```javascript
2620
+ * let res = 0;
2621
+ * bbn.fn.fori([4, 5, 5, 10, 1, 2], d => {
2622
+ * res += d;
2623
+ * }, 3);
2624
+ * // res = 24
2625
+ * ```
2626
+ * @example
2627
+ * ```javascript
2628
+ * let res = 0;
2629
+ * bbn.fn.fori([4, 5, 5, 10, 1, 2], d => {
2630
+ * if (res >= 20) {
2631
+ * return false;
2632
+ * }
2633
+ * res += d;
2634
+ * }, 4, 1);
2635
+ * // res = 20
2636
+ * ```
2637
+ * @memberof bbn.fn
2638
+ * @param {Array} arr The array to loop on
2639
+ * @param {Function} fn The function, gets the array's element and the index as arguments
2640
+ * @param {Number} max The index to which the loop will stop
2641
+ * @param {Number} min The index at which the loop will start
2642
+ * @returns {undefined}
2643
+ */
612
2644
  const fori: (arr: any[], fn: (a: any, i: number) => any, max?: number, min?: number) => void;
613
2645
  export { fori };
614
2646
  }
615
- declare module "fn/forir" {
2647
+ declare module "fn/loop/forir" {
2648
+ /**
2649
+ * Executes the provided function on each element of the given array, going backward.
2650
+ *
2651
+ * A maximum and a minimum value can be provided, within the boundaries of the
2652
+ * array's indexes. Returning false will stop the loop.
2653
+ *
2654
+ * @method forir
2655
+ * @global
2656
+ * @example
2657
+ * ```javascript
2658
+ * let res = 0;
2659
+ * bbn.fn.forir([4, 5, 5, 10, 1, 2], d => {
2660
+ * res += d;
2661
+ * }, 4, 2);
2662
+ * // res = 16
2663
+ * ```
2664
+ * @example
2665
+ * ```javascript
2666
+ * let res = 0;
2667
+ * bbn.fn.forir([4, 5, 5, 10, 1, 2], d => {
2668
+ * if (res >= 20) {
2669
+ * return false;
2670
+ * }
2671
+ * res += d;
2672
+ * });
2673
+ * // res = 23
2674
+ * ```
2675
+ * @memberof bbn.fn
2676
+ * @param {Array} arr The array to loop on
2677
+ * @param {Function} fn The function, gets the array's element and the index as arguments
2678
+ * @param {Number} max The index to which the loop will stop
2679
+ * @param {Number} min The index at which the loop will start
2680
+ * @returns {undefined}
2681
+ */
616
2682
  const forir: (arr: any[], fn: (a: any, b: number) => any, max?: number, min?: number) => void;
617
2683
  export { forir };
618
2684
  }
619
- declare module "fn/format" {
2685
+ declare module "fn/string/format" {
620
2686
  const format: (str: any) => any;
621
2687
  export { format };
622
2688
  }
623
- declare module "fn/formatBytes" {
2689
+ declare module "fn/string/formatBytes" {
2690
+ /**
2691
+ * Formats the value given in bytes.
2692
+ * @method formatBytes
2693
+ * @global
2694
+ * @example
2695
+ * //"52.23 MB"
2696
+ * ``` javascript
2697
+ * bbn.fn.formatBytes(54764654);
2698
+ * ```
2699
+ * @memberof bbn.fn
2700
+ * @returns {String}
2701
+ */
624
2702
  const formatBytes: (bytes: any, decimals?: number) => string;
625
2703
  export { formatBytes };
626
2704
  }
627
- declare module "fn/formatDate" {
2705
+ declare module "fn/datetime/formatDate" {
628
2706
  const formatDate: (date: any, format: any) => string;
629
2707
  export { formatDate };
630
2708
  }
631
- declare module "fn/formatSize" {
2709
+ declare module "fn/string/formatSize" {
632
2710
  const formatSize: (st: any, noValid: any) => any;
633
2711
  export { formatSize };
634
2712
  }
635
- declare module "fn/formdata" {
2713
+ declare module "fn/form/formdata" {
2714
+ /**
2715
+ * Returns all the data contained in a form as a single object.
2716
+ *
2717
+ * @method formdata
2718
+ * @global
2719
+ * @memberof bbn.fn
2720
+ * @fires {*}
2721
+ *
2722
+ * @example
2723
+ * ```javascript
2724
+ * // <form id="myform">
2725
+ * // <input type="hidden" name="bbn[name]" value="Smith">
2726
+ * // <input type="hidden" name="bbn[fname]" value="John">
2727
+ * // </form>
2728
+ * bbn.fn.formdata(document.getElementById('myform'));
2729
+ * // {name: "Smith", fname: "John"};
2730
+ *
2731
+ * ```
2732
+ *
2733
+ * @example
2734
+ * ```javascript
2735
+ * // <form id="myform">
2736
+ * // <input type="hidden" name="People[0][name]" value="Smith">
2737
+ * // <input type="hidden" name="People[0][fname]" value="John">
2738
+ * // <input type="hidden" name="People[1][name]" value="Smith">
2739
+ * // <input type="hidden" name="People[1][fname]" value="Eileen">
2740
+ * // <input type="hidden" name="Dates[0]" value="2021-08-25">
2741
+ * // <input type="hidden" name="Dates[1]" value="2021-09-06">
2742
+ * // </form>
2743
+ * bbn.fn.formdata(document.getElementById('myform'));
2744
+ * // {
2745
+ * // People: [
2746
+ * // {name: "Smith", fname: "John"},
2747
+ * // {name: "Smith", fname: "Eileen"}
2748
+ * // ],
2749
+ * // Dates: ['2021-08-25', '2021-09-06']
2750
+ * // }
2751
+ * ```
2752
+ *
2753
+ * @param {HTMLElementL} form
2754
+ *
2755
+ * @returns {Object}
2756
+ */
636
2757
  const formdata: (form: HTMLFormElement) => {};
637
2758
  export { formdata };
638
2759
  }
639
- declare module "fn/fromXml" {
2760
+ declare module "fn/convert/fromXml" {
2761
+ /**
2762
+ * Parses XML and returns an object.
2763
+ *
2764
+ * Picked from https://stackoverflow.com/questions/4200913/xml-to-javascript-object
2765
+ *
2766
+ * @memberof bbn.fn
2767
+ * @param {String} xml The XML to be parsed
2768
+ * @param {Array} arrayTags An array of tag names which should always be returned as array (even if single)
2769
+ * @returns {Object}
2770
+ */
640
2771
  const fromXml: (xml: any, arrayTags: any) => {};
641
2772
  export { fromXml };
642
2773
  }
643
- declare module "fn/ftime" {
2774
+ declare module "fn/datetime/ftime" {
2775
+ /**
2776
+ * @method ftime
2777
+ * @todo Add method description for ftime
2778
+ * @global
2779
+ * @memberof bbn.fn
2780
+ * @returns {*}
2781
+ */
644
2782
  const ftime: (d: any, wrong_result: any) => any;
645
2783
  export { ftime };
646
2784
  }
647
- declare module "fn/unique" {
2785
+ declare module "fn/object/unique" {
2786
+ /**
2787
+ * Removes duplicate values from an array.
2788
+ *
2789
+ * Takes an input array and returns a new array without duplicate values.
2790
+ *
2791
+ * @method unique
2792
+ * @global
2793
+ * @example
2794
+ * ```javascript
2795
+ * bbn.fn.unique(["a", "b", "a", "b", "a", "b", "c", "c", "d"]);
2796
+ * // ["a", "b", "c", "d"]
2797
+ * ```
2798
+ * @memberof bbn.fn
2799
+ * @param {Array} arr
2800
+ * @returns {Array}
2801
+ */
648
2802
  const unique: (arr: any[]) => any[];
649
2803
  export { unique };
650
2804
  }
651
- declare module "fn/getAllTags" {
2805
+ declare module "fn/html/getAllTags" {
2806
+ /**
2807
+ * Gets all the tag names present in the DOM
2808
+ * @returns array
2809
+ */
652
2810
  const getAllTags: () => any[];
653
2811
  export { getAllTags };
654
2812
  }
655
- declare module "fn/getAncestors" {
2813
+ declare module "fn/html/getAncestors" {
656
2814
  const getAncestors: (ele: Element | String, selector?: true | string) => Element[];
657
2815
  export { getAncestors };
658
2816
  }
659
- declare module "fn/getAttributes" {
2817
+ declare module "fn/html/getAttributes" {
2818
+ /**
2819
+ * Check if the property contain sizing
2820
+ * @return {Boolean}
2821
+ */
660
2822
  const getAttributes: (ele: any) => any;
661
2823
  export { getAttributes };
662
2824
  }
663
- declare module "fn/getBrowserName" {
2825
+ declare module "fn/browser/getBrowserName" {
2826
+ /**
2827
+ * Gets the browser's name
2828
+ * @method getBrowserName
2829
+ * @global
2830
+ * @memberof bbn.fn
2831
+ * @returns {String}
2832
+ */
664
2833
  const getBrowserName: () => "Edge" | "Opera" | "Chrome" | "Internet Explorer" | "Firefox" | "Safari" | "Other";
665
2834
  export { getBrowserName };
666
2835
  }
667
- declare module "fn/getBrowserVersion" {
2836
+ declare module "fn/browser/getBrowserVersion" {
2837
+ /**
2838
+ * Gets the browser's version
2839
+ * @method getBrowserVersion
2840
+ * @global
2841
+ * @memberof bbn.fn
2842
+ * @returns {String}
2843
+ */
668
2844
  const getBrowserVersion: () => string;
669
2845
  export { getBrowserVersion };
670
2846
  }
671
- declare module "fn/getCookie" {
2847
+ declare module "fn/browser/getCookie" {
2848
+ /**
2849
+ * If it exsists returns the cookie corresponding to the given name.
2850
+ *
2851
+ * @method getCookie
2852
+ * @example
2853
+ * ``` javascript
2854
+ * // 'en'
2855
+ * bbn.fn.getCookie('lang');
2856
+ * ```
2857
+ * @global
2858
+ * @memberof bbn.fn
2859
+ * @param {String} name
2860
+ * @returns
2861
+ */
672
2862
  const getCookie: (name: any) => any;
673
2863
  export { getCookie };
674
2864
  }
675
- declare module "fn/getCssVar" {
2865
+ declare module "fn/style/getCssVar" {
2866
+ /**
2867
+ * Gets a CSS variable value
2868
+ * @param {String*} varname
2869
+ * @returns
2870
+ */
676
2871
  const getCssVar: (varname: any) => string;
677
2872
  export { getCssVar };
678
2873
  }
679
- declare module "fn/getDay" {
2874
+ declare module "fn/datetime/getDay" {
2875
+ /**
2876
+ * @method getDay
2877
+ * @ignore
2878
+ * @todo Add method description for getDay
2879
+ * @global
2880
+ * @memberof bbn.fn
2881
+ * @param {String|Date} v
2882
+ * @returns
2883
+ */
680
2884
  const getDay: (v: any) => number | false;
681
2885
  export { getDay };
682
2886
  }
683
- declare module "fn/getDeviceType" {
2887
+ declare module "fn/browser/getDeviceType" {
2888
+ /**
2889
+ * Returns the current device type.
2890
+ * @method getDeviceType
2891
+ * @global
2892
+ * @example
2893
+ * ``` javascript
2894
+ * bbn.fn.getDeviceType();
2895
+ * // mobile
2896
+ * ```
2897
+ * @memberof bbn.fn
2898
+ * @returns {String}
2899
+ */
684
2900
  const getDeviceType: () => "mobile" | "tablet" | "desktop";
685
2901
  export { getDeviceType };
686
2902
  }
687
- declare module "fn/getHTMLOfSelection" {
2903
+ declare module "fn/html/getHTMLOfSelection" {
688
2904
  const getHTMLOfSelection: () => string;
689
2905
  export { getHTMLOfSelection };
690
2906
  }
691
- declare module "fn/getEventData" {
2907
+ declare module "fn/browser/getEventData" {
2908
+ /**
2909
+ * Returns a promise having the event's data as argument.
2910
+ * @method getEventData
2911
+ * @global
2912
+ * @example
2913
+ * ``` javascript
2914
+ * let type = e.type;
2915
+ * bbn.fn.getEventData(e).then((data) => {
2916
+ * bbn.fn.log("DATA FROM " + type, data);
2917
+ * });
2918
+ * ```
2919
+ * @memberof bbn.fn
2920
+ * @returns {Promise}
2921
+ */
692
2922
  const getEventData: (e: any) => Promise<unknown>;
693
2923
  export { getEventData };
694
2924
  }
695
- declare module "fn/getField" {
2925
+ declare module "fn/object/getField" {
2926
+ /**
2927
+ * Returns the value of the given field (property) from the first object matching the given filter in an array of objects.
2928
+ *
2929
+ * The filtering arguments follow the same scheme as bbn.fn.search.
2930
+ *
2931
+ * @method getField
2932
+ * @global
2933
+ * @example
2934
+ * ```javascript
2935
+ * let ar = [
2936
+ * {name: "Raiders of the lost ark", director: "Steven Spielberg", year: 1981, id: 589},
2937
+ * {name: "Goonies", director: "Richard Donner", year: 1985, id: 689},
2938
+ * {name: "Star wars", director: "George Lucas", year: 1977, id: 256},
2939
+ * {name: "Jaws", director: "Steven Spielberg", year: 1975, id: 423}
2940
+ * ];
2941
+ * bbn.fn.getField(ar, "name", {id: 256});
2942
+ * // Star wars
2943
+ * bbn.fn.getField(ar, "name", "id", 689);
2944
+ * // Goonies
2945
+ * ```
2946
+ * @memberof bbn.fn
2947
+ * @param {Array} arr The subject array
2948
+ * @param {String} field The property from which the value is returned
2949
+ * @param {(String|Object|Function)} prop A property's name or a filter object or function
2950
+ * @param {*} val The value with which comparing the given property
2951
+ * @param {String} operator The operator to use for comparison with the value as used in bbn.fn.compare
2952
+ * @returns {*}
2953
+ */
696
2954
  const getField: (arr: any[], field: string, prop?: object | string, val?: any, operator?: string) => any;
697
2955
  export { getField };
698
2956
  }
699
- declare module "fn/getFieldValues" {
2957
+ declare module "fn/object/getFieldValues" {
2958
+ /**
2959
+ * Returns all the unique values of the given field (property) from the first object matching the given filter in an array.
2960
+ *
2961
+ * The filtering arguments follow the same scheme as bbn.fn.search.
2962
+ *
2963
+ * @method getFieldValues
2964
+ * @global
2965
+ * @example
2966
+ * ```javascript
2967
+ * let ar = [
2968
+ * {name: "Raiders of the lost ark", director: "Steven Spielberg", year: 1981, id: 589},
2969
+ * {name: "Star wars", director: "George Lucas", year: 1977, id: 256},
2970
+ * {name: "Jaws", director: "Steven Spielberg", year: 1975, id: 423}
2971
+ * {name: "Barry Lindon", director: "Stanley Kubrick", year: 1975, id: 802}
2972
+ * ];
2973
+ * bbn.fn.getFieldValues(ar, "director");
2974
+ * // ["Steven Spielberg", "George Lucas", "Stanley Kubrick"]
2975
+ * bbn.fn.getFieldValues(ar, "name", {year: 1975});
2976
+ * // ["Jaws", "Barry Lindon"]
2977
+ * ```
2978
+ * @memberof bbn.fn
2979
+ * @param {Array} arr The subject array
2980
+ * @param {String} field The property from which the values are returned
2981
+ * @param {(String|Object|Function)} prop A property's name or a filter object or function
2982
+ * @param {*} val The value with which comparing the given property
2983
+ * @param {String} operator The operator to use for comparison with the value as used in bbn.fn.compare
2984
+ * @returns {*}
2985
+ */
700
2986
  const getFieldValues: (arr: object[], field: string, prop: any, val: any, operator: any) => any[];
701
2987
  export { getFieldValues };
702
2988
  }
703
- declare module "fn/removeHtmlComments" {
2989
+ declare module "fn/string/removeHtmlComments" {
704
2990
  const removeHtmlComments: (str: string) => string;
705
2991
  export { removeHtmlComments };
706
2992
  }
707
- declare module "fn/getHtml" {
2993
+ declare module "fn/html/getHtml" {
708
2994
  const getHtml: (ele: any, stripComments?: boolean) => any;
709
2995
  export { getHtml };
710
2996
  }
711
- declare module "fn/getPath" {
2997
+ declare module "fn/html/getPath" {
2998
+ /**
2999
+ * @method getPath
3000
+ * @todo Add method description for getPath
3001
+ * @global
3002
+ * @ignore
3003
+ * @memberof bbn.fn
3004
+ * @returns {*}
3005
+ */
712
3006
  const getPath: (element: any) => string;
713
3007
  export { getPath };
714
3008
  }
715
- declare module "fn/getProp" {
3009
+ declare module "fn/object/getProp" {
3010
+ /**
3011
+ * Gets the given property from the given object
3012
+ * @param {Object} obj
3013
+ * @param {String} prop
3014
+ * @returns
3015
+ */
716
3016
  const getProp: (obj: any, prop: any) => any;
717
3017
  export { getProp };
718
3018
  }
719
- declare module "fn/getScrollBarSize" {
3019
+ declare module "fn/style/getScrollBarSize" {
720
3020
  const getScrollBarSize: () => number;
721
3021
  export { getScrollBarSize };
722
3022
  }
723
- declare module "fn/getText" {
3023
+ declare module "fn/html/getText" {
724
3024
  const getText: (ele: any) => string;
725
3025
  export { getText };
726
3026
  }
727
- declare module "fn/getTimeoff" {
3027
+ declare module "fn/misc/getTimeoff" {
3028
+ /**
3029
+ * Returns the length of time the window has not been focused in seconds.
3030
+ * @method getTimeoff
3031
+ * @global
3032
+ * @example
3033
+ * ``` javascript
3034
+ * bbn.fn.getTimeoff();
3035
+ * // 0
3036
+ * ```
3037
+ * @memberof bbn.fn
3038
+ * @returns {Boolean}
3039
+ */
728
3040
  const getTimeoff: () => number;
729
3041
  export { getTimeoff };
730
3042
  }
731
- declare module "fn/happy" {
3043
+ declare module "fn/browser/happy" {
3044
+ /**
3045
+ * Logs the given argument in the browser's console highlighting it with a green background.
3046
+ * @method happy
3047
+ * @global
3048
+ * @example
3049
+ * ``` javascript
3050
+ * bbn.fn.happy('I want to log the success of my function');
3051
+ * ```
3052
+ * @memberof bbn.fn
3053
+ * @param {...any} args
3054
+ * @returns
3055
+ */
732
3056
  const happy: (...args: any[]) => any;
733
3057
  export { happy };
734
3058
  }
735
- declare module "fn/hex2rgb" {
3059
+ declare module "fn/convert/hex2rgb" {
3060
+ /**
3061
+ * Convert an hexadecimmal string to RGB.
3062
+ *
3063
+ * Converts a string that expresses a color in hexadecimal format into an object with
3064
+ * the properties that define the color and the corresponding value.
3065
+ *
3066
+ * @method hex2rgb
3067
+ * @global
3068
+ *
3069
+ * @example
3070
+ * ```javascript
3071
+ * //{r:255, g:0, b:0}
3072
+ * bbn.fn.hex2rgb("#FF0000");
3073
+ * ```
3074
+ *
3075
+ * @memberof bbn.fn
3076
+ * @returns {*}
3077
+ */
736
3078
  const hex2rgb: (hex: any) => {
737
3079
  r: number;
738
3080
  g: number;
@@ -740,344 +3082,1565 @@ declare module "fn/hex2rgb" {
740
3082
  };
741
3083
  export { hex2rgb };
742
3084
  }
743
- declare module "fn/history" {
3085
+ declare module "fn/browser/history" {
744
3086
  const history: () => false | History;
745
3087
  export { history };
746
3088
  }
747
- declare module "fn/html2text" {
3089
+ declare module "fn/html/html2text" {
3090
+ /**
3091
+ * Convert text in html format to plain text.
3092
+ *
3093
+ * @method html2text
3094
+ * @global
3095
+ *
3096
+ * @example
3097
+ * ```javascript
3098
+ * //"Hello world!"
3099
+ * bbn.fn.html2text("<div><p>Hello <b>world!</b></p></div>");
3100
+ * ```
3101
+ * @memberof bbn.fn
3102
+ * @param {String} st
3103
+ * @returns {String}
3104
+ */
748
3105
  const html2text: (st: any) => string;
749
3106
  export { html2text };
750
3107
  }
751
- declare module "fn/imageToCanvas" {
3108
+ declare module "fn/convert/imageToCanvas" {
3109
+ /**
3110
+ * Draws the given html image nto a canvas.
3111
+ * @method imageToCanvas
3112
+ * @example
3113
+ * ``` javascript
3114
+ * //<canvas width="60" height="32"></canvas>
3115
+ * bbn.fn.imageToCanvas('<img src="path/myImage.png">');
3116
+ * ```
3117
+ * @global
3118
+ * @memberof bbn.fn
3119
+ * @param {HTMLElement} img
3120
+ * @returns
3121
+ */
752
3122
  const imageToCanvas: (img: any) => HTMLCanvasElement;
753
3123
  export { imageToCanvas };
754
3124
  }
755
- declare module "fn/imgToBase64" {
3125
+ declare module "fn/convert/imgToBase64" {
756
3126
  const imgToBase64: (img: any, type?: string) => string;
757
3127
  export { imgToBase64 };
758
3128
  }
759
- declare module "fn/info" {
3129
+ declare module "fn/browser/info" {
3130
+ /**
3131
+ * Logs the given argument in the browser's console highlighting it with a blue background.
3132
+ * @method info
3133
+ * @global
3134
+ * @memberof bbn.fn
3135
+ * @param {...any} args
3136
+ * @returns {*}
3137
+ */
760
3138
  const info: (...args: any[]) => any;
761
3139
  export { info };
762
3140
  }
763
- declare module "fn/treatAjaxArguments" {
3141
+ declare module "fn/ajax/treatAjaxArguments" {
3142
+ /**
3143
+ * Transforms unordered arguments into a configuratiuon object for Ajax shortcut functions.
3144
+ *
3145
+ * The final object will have the following arguments: url, obj, datatype, force, successFn,
3146
+ * errorFn, abortFn, e, and ele; The rules are:
3147
+ * * The first string found is the URL
3148
+ * * The second string found is the datatype
3149
+ * * The first function is successFn
3150
+ * * The second function is errorFn
3151
+ * * The third function is abortFn
3152
+ * * A boolean true is force
3153
+ * * An Event is e
3154
+ * * An HTML element is ele
3155
+ *
3156
+ * If no object is given the _bbn property will be added in order to always post something
3157
+ * and let the bbn server scripts know if a whole DOM is requested or a JSON answer
3158
+ *
3159
+ * @method treatAjaxArguments
3160
+ * @global
3161
+ * @memberof bbn.fn
3162
+ *
3163
+ * @example
3164
+ * ```javascript
3165
+ * bbn.fn.treatAjaxArguments(['my/script', 'json', {a:1, b:2}, () => bbn.fn.log('Hi'), () => bbn.fn.log('Bye'), () => bbn.fn.log('Argh'), true])
3166
+ * // {
3167
+ * // "url": "my/script",
3168
+ * // "datatype": "json",
3169
+ * // "obj": {
3170
+ * // "a": 1,
3171
+ * // "b": 2
3172
+ * // },
3173
+ * // "successFn": () => bbn.fn.log('Hi'),
3174
+ * // "errorFn": () => bbn.fn.log('Bye'),
3175
+ * // "abortFn": () => bbn.fn.log('Argh'),
3176
+ * // "force": true
3177
+ * // }
3178
+ *
3179
+ * bbn.fn.treatAjaxArguments(['my/script?id=1'])
3180
+ * // {
3181
+ * // "url": "my/script?id=1",
3182
+ * // "obj": {
3183
+ * // "_bbn": "public"
3184
+ * // },
3185
+ * // "datatype": "json"
3186
+ * // }
3187
+ * ```
3188
+ *
3189
+ * @param {*} args
3190
+ *
3191
+ * @returns {Object} The configuration object
3192
+ */
764
3193
  const treatAjaxArguments: (args: any) => BbnAjaxCfg;
765
3194
  export { treatAjaxArguments };
766
3195
  }
767
- declare module "fn/setNavigationVars" {
3196
+ declare module "fn/ajax/setNavigationVars" {
3197
+ /**
3198
+ * Changes the URL and the associated variables and updates the history.
3199
+ *
3200
+ * @method setNavigationVars
3201
+ * @todo Add method description for setNavigationVars
3202
+ * @global
3203
+ * @memberof bbn.fn
3204
+ *
3205
+ * @example
3206
+ * ```javascript
3207
+ * // Changing URL
3208
+ * bbn.fn.setNavigationVars('my/page', 'My page');
3209
+ * // Replacing the previous state
3210
+ * bbn.fn.setNavigationVars('my/page/deeper', 'My deeper page', null, true);
3211
+ * ```
3212
+ *
3213
+ * @param {String} url The URL which will become the location.href
3214
+ * @param {String} title The title corresponding to the given URL
3215
+ * @param {Object} data The data if any
3216
+ * @param {Boolean} repl If true the history state object will replace the current one, will be added otherwise
3217
+ *
3218
+ * @returns {undefined}
3219
+ */
768
3220
  const setNavigationVars: (url: any, title: any, data?: object, repl?: boolean) => void;
769
3221
  export { setNavigationVars };
770
3222
  }
771
- declare module "fn/link" {
3223
+ declare module "fn/ajax/link" {
3224
+ /**
3225
+ * Follows a link and if needed by sending the corresponding Ajax request and executing bbn.fn.defaultPreLinkFunction.
3226
+ *
3227
+ * Once bbn has been initiated this function will be triggered every time a link is clicked.
3228
+ * It accepts the same arguments as seen in treatAjaxArguments but will tipically just be called with a URL,
3229
+ * the defaultLinkURL functions being in charge of loading the content
3230
+ *
3231
+ * @method link
3232
+ * @todo Manage anchors + returned data unclear
3233
+ * @global
3234
+ * @memberof bbn.fn
3235
+ *
3236
+ * @example
3237
+ * ```javascript
3238
+ * // Will open in a new window/tab
3239
+ * bbn.fn.link('https://nytimes.com');
3240
+ * // Will send an Ajax request
3241
+ * bbn.fn.link('my/page');
3242
+ * // Will open your default email program
3243
+ * bbn.fn.link('mailto:postmaster@test.com');
3244
+ * ```
3245
+ *
3246
+ * @returns
3247
+ */
772
3248
  const link: (...args: any[]) => any;
773
3249
  export { link };
774
3250
  }
775
- declare module "fn/post" {
3251
+ declare module "fn/ajax/post" {
3252
+ /**
3253
+ * Creates a POST XHR through bbn.fn.ajax then launches bbn.fn.callback with the result.
3254
+ *
3255
+ * URL is the only mandatory argument (see treatAjaxArguments for the arguments).
3256
+ *
3257
+ * @method post
3258
+ * @global
3259
+ * @memberof bbn.fn
3260
+ *
3261
+ * @example
3262
+ * ```javascript
3263
+ * bbn.fn.post('logout').then(() => {
3264
+ * document.location.reload();
3265
+ * });
3266
+ * // With data
3267
+ * bbn.fn.post('login', {user: 'tn', pass: 'xxx'}).then((d) => {
3268
+ * if (d && d.success) {
3269
+ * alert('Welcome!');
3270
+ * }
3271
+ * });
3272
+ * // With the callback as argument
3273
+ * bbn.fn.post('login', {user: 'tn', pass: 'xxx'}, (d) => {
3274
+ * if (d && d.success) {
3275
+ * alert('Welcome!');
3276
+ * }
3277
+ * }, (err) => {
3278
+ * bbn.fn.log(err);
3279
+ * mySpecialErrorFunction(err);
3280
+ * });
3281
+ * ```
3282
+ *
3283
+ * @returns {undefined|Promise}
3284
+ */
776
3285
  const post: (...args: any[]) => any;
777
3286
  export { post };
778
3287
  }
779
- declare module "fn/submit" {
3288
+ declare module "fn/form/submit" {
3289
+ /**
3290
+ * Submit a form's data through an Ajax request.
3291
+ *
3292
+ * It will also prevent the event if given, and execute the given callback,
3293
+ * or look for one in the data-script attribute.
3294
+ *
3295
+ * @method submit
3296
+ * @global
3297
+ * @memberof bbn.fn
3298
+ * @fires {*}
3299
+ * @fires {*}
3300
+ *
3301
+ * @param {HTMLElement} form The form to submit
3302
+ * @param {Event} e The optional submit event - which will be prevented
3303
+ * @param {Function} fn An optional callback function
3304
+ *
3305
+ * @returns {*}
3306
+ */
780
3307
  const submit: (form: HTMLFormElement, e?: Event, fn?: Function) => void;
781
3308
  export { submit };
782
3309
  }
783
- declare module "fn/resize" {
3310
+ declare module "fn/style/resize" {
784
3311
  const resize: () => void;
785
3312
  export { resize };
786
3313
  }
787
- declare module "fn/isMobileDevice" {
3314
+ declare module "fn/browser/isMobileDevice" {
788
3315
  const isMobileDevice: () => boolean;
789
3316
  export { isMobileDevice };
790
3317
  }
791
- declare module "fn/isTabletDevice" {
3318
+ declare module "fn/browser/isTabletDevice" {
3319
+ /**
3320
+ * Returns true if the current device type is a tablet.
3321
+ * @method isTabletDevice
3322
+ * @global
3323
+ * @example
3324
+ * ``` javascript
3325
+ * bbn.fn.isTabletDevice();
3326
+ * // false
3327
+ * ```
3328
+ * @memberof bbn.fn
3329
+ * @returns {Boolean}
3330
+ */
792
3331
  const isTabletDevice: () => boolean;
793
3332
  export { isTabletDevice };
794
3333
  }
795
- declare module "fn/isMobile" {
3334
+ declare module "fn/browser/isMobile" {
3335
+ /**
3336
+ * Returns true if the current browser is on a mobile device (smartphone or tablet).
3337
+ * @method isMobile
3338
+ * @global
3339
+ * @example
3340
+ * ``` javascript
3341
+ * bbn.fn.isMobile();
3342
+ * // false
3343
+ * ```
3344
+ * @memberof bbn.fn
3345
+ * @returns {Boolean}
3346
+ */
796
3347
  const isMobile: () => boolean;
797
3348
  export { isMobile };
798
3349
  }
799
3350
  declare module "fn/init" {
3351
+ /**
3352
+ * Initializes the library bbn basing on the given configuration object.
3353
+ * - Gives to the environment the dimension of the window.innerWidth and window.innerHeight
3354
+ * - Defines the server's path (difference between the host and the current dir)
3355
+ * - Adds the colors contained in bbn.var.colors to define the css classes for background and colors.
3356
+ * - Adds the event listener to the document
3357
+ * - Activates the history
3358
+ * @method init
3359
+ * @global
3360
+ * @memberof bbn.fn
3361
+ * @param {Object} cfg
3362
+ * @returns
3363
+ */
800
3364
  const init: (cfg: any, force: any) => void;
801
3365
  export { init };
802
3366
  }
803
- declare module "fn/isActiveInterface" {
3367
+ declare module "fn/browser/isActiveInterface" {
3368
+ /**
3369
+ * Tells if the interface is beeing active for the past x seconds.
3370
+ * @method isActiveInterface
3371
+ * @global
3372
+ * @example
3373
+ * // true
3374
+ * ``` javascript
3375
+ * bbn.fn.isActiveInterface(54764654);
3376
+ * ```
3377
+ * @memberof bbn.fn
3378
+ * @returns {Boolean}
3379
+ */
804
3380
  const isActiveInterface: (secs?: number) => boolean;
805
3381
  export { isActiveInterface };
806
3382
  }
807
- declare module "fn/isBoolean" {
3383
+ declare module "fn/type/isBoolean" {
3384
+ /**
3385
+ * Returns true if the given argument is a boolean
3386
+ * @method isBoolean
3387
+ * @global
3388
+ * @example
3389
+ * ```javascript
3390
+ * const sb = true;
3391
+ * bbn.fn.isBoolean(sb); // true
3392
+ * const sb = 1;
3393
+ * bbn.fn.isBoolean(sb); // false
3394
+ * ```
3395
+ * @memberof bbn.fn
3396
+ * @returns {Boolean}
3397
+ */
808
3398
  const isBoolean: (...args: any[]) => boolean;
809
3399
  export { isBoolean };
810
3400
  }
811
- declare module "fn/isColor" {
3401
+ declare module "fn/type/isColor" {
3402
+ /**
3403
+ * Intended to check if the argument provided is a color.
3404
+ *
3405
+ * It is possible to pass as argument a string with hexadecimal value in rgb or the name of the color.
3406
+ *
3407
+ * @method isColor
3408
+ * @global
3409
+ *
3410
+ * @example
3411
+ * ```javascript
3412
+ * bbn.fn.isColor("#FF0000")
3413
+ * //true
3414
+ * ```
3415
+ *
3416
+ * @example
3417
+ * ```javascript
3418
+ * bbn.fn.isColor("rgb 255, 0, 0");
3419
+ * //true
3420
+ * ```
3421
+ *
3422
+ * @example
3423
+ * ```javascript
3424
+ * bbn.fn.isColor("red");
3425
+ * //true
3426
+ * ```
3427
+ * @memberof bbn.fn
3428
+ * @param {String} st
3429
+ * @returns {Boolean}
3430
+ */
812
3431
  const isColor: (...args: any[]) => boolean;
813
3432
  export { isColor };
814
3433
  }
815
- declare module "fn/isComment" {
3434
+ declare module "fn/type/isComment" {
3435
+ /**
3436
+ * Returns true if the given argument is a dom comment;
3437
+ * @method isComment
3438
+ * @example
3439
+ * ```javascript
3440
+ * bbn.fn.isComment(node.childNodes[0]);
3441
+ * //true
3442
+ * ```
3443
+ * @global
3444
+ * @memberof bbn.fn
3445
+ * @returns {Boolean}
3446
+ */
816
3447
  const isComment: (...args: any[]) => boolean;
817
3448
  export { isComment };
818
3449
  }
819
- declare module "fn/isDesktopDevice" {
3450
+ declare module "fn/browser/isDesktopDevice" {
3451
+ /**
3452
+ * Returns true if the current device type is a desktop.
3453
+ * @method isDesktopDevice
3454
+ * @global
3455
+ * @example
3456
+ * ``` javascript
3457
+ * bbn.fn.isDesktopDevice();
3458
+ * // true
3459
+ * ```
3460
+ * @memberof bbn.fn
3461
+ * @returns {Boolean}
3462
+ */
820
3463
  const isDesktopDevice: () => boolean;
821
3464
  export { isDesktopDevice };
822
3465
  }
823
- declare module "fn/isValidDimension" {
3466
+ declare module "fn/type/isValidDimension" {
3467
+ /**
3468
+ * Returns true if the given value is a valid CSS dimension string, false otherwise.
3469
+ *
3470
+ * @method isValidDimension
3471
+ * @global
3472
+ * @memberof bbn.fn
3473
+ * @param {String} st
3474
+ * @returns
3475
+ */
824
3476
  const isValidDimension: (st: any) => boolean;
825
3477
  export { isValidDimension };
826
3478
  }
827
- declare module "fn/isDimension" {
3479
+ declare module "fn/type/isDimension" {
3480
+ /**
3481
+ * Returns true if the given value is a valid CSS dimension string or a number, false otherwise.
3482
+ *
3483
+ * @method isDimension
3484
+ * @global
3485
+ * @memberof bbn.fn
3486
+ * @param {String} st
3487
+ * @returns
3488
+ */
828
3489
  const isDimension: (...args: any[]) => boolean;
829
3490
  export { isDimension };
830
3491
  }
831
- declare module "fn/isEmail" {
3492
+ declare module "fn/type/isEmail" {
3493
+ /**
3494
+ * Intended to check if the argument provided is an e-mail address written correctly
3495
+ *
3496
+ * @method isEmail
3497
+ * @global
3498
+ *
3499
+ * @example
3500
+ * ```javascript
3501
+ * bbn.fn.isEmail('test@testorg');
3502
+ * //false
3503
+ * ```
3504
+ *
3505
+ * @example
3506
+ * ```javascript
3507
+ * bbn.fn.isEmail('test@test.org');
3508
+ * //true
3509
+ * ```
3510
+ * @memberof bbn.fn
3511
+ * @param {String} st
3512
+ * @returns {Boolean}
3513
+ */
832
3514
  const isEmail: (...args: any[]) => boolean;
833
3515
  export { isEmail };
834
3516
  }
835
- declare module "fn/isEvent" {
3517
+ declare module "fn/type/isEvent" {
3518
+ /**
3519
+ * Returns true if the given argument is an event.
3520
+ * @method isEvent
3521
+ * @global
3522
+ * @memberof bbn.fn
3523
+ * @returns {Boolean}
3524
+ */
836
3525
  const isEvent: (...args: any[]) => boolean;
837
3526
  export { isEvent };
838
3527
  }
839
- declare module "fn/isFocused" {
3528
+ declare module "fn/browser/isFocused" {
3529
+ /**
3530
+ * Checks whether the given elemet is focused or not.
3531
+ *
3532
+ * @method isFocused
3533
+ * @global
3534
+ * @example
3535
+ * ``` javascript
3536
+ * bbn.fn.isFocused(document.getElementById('input_name'));
3537
+ * // false
3538
+ * bbn.fn.isFocused(bbn.sel('.container'));
3539
+ * // true
3540
+ * ```
3541
+ * @memberof bbn.fn
3542
+ *
3543
+ * @param {Element} ele The element to be checked for focus
3544
+ * @param {Boolean} contain If true will check if the focused element is contained in the given element
3545
+ *
3546
+ * @returns {Boolean} True if focused
3547
+ */
840
3548
  const isFocused: (ele: HTMLElement, contain?: boolean) => boolean;
841
3549
  export { isFocused };
842
3550
  }
843
- declare module "fn/isIP" {
3551
+ declare module "fn/type/isIP" {
844
3552
  const isIP: (...args: any[]) => boolean;
845
3553
  export { isIP };
846
3554
  }
847
- declare module "fn/isHostname" {
3555
+ declare module "fn/type/isHostname" {
848
3556
  const isHostname: (...args: any[]) => boolean;
849
3557
  export { isHostname };
850
3558
  }
851
- declare module "fn/isInside" {
3559
+ declare module "fn/html/isInside" {
852
3560
  const isInside: (ele: any, ancestor: any) => boolean;
853
3561
  export { isInside };
854
3562
  }
855
- declare module "fn/isPercent" {
3563
+ declare module "fn/type/isPercent" {
3564
+ /**
3565
+ * Returns true if the given argument is a percentage.
3566
+ * @method isPercent
3567
+ * @global
3568
+ * @example
3569
+ * ```javascript
3570
+ * bbn.fn.isPercent('5%');
3571
+ * //true
3572
+ * ```
3573
+ * @memberof bbn.fn
3574
+ * @returns {Boolean}
3575
+ */
856
3576
  const isPercent: (...args: any[]) => boolean;
857
3577
  export { isPercent };
858
3578
  }
859
- declare module "fn/isPrimitive" {
3579
+ declare module "fn/type/isPrimitive" {
3580
+ /**
3581
+ * Returns true if the given arguments are primitive;
3582
+ * @method isPrimitive
3583
+ * @global
3584
+ * @example
3585
+ * ```javascript
3586
+ * bbn.fn.isPrimitive('myString', 6, true);
3587
+ * //true
3588
+ * bbn.fn.isPrimitive([80,10,22]);
3589
+ * //false
3590
+ * bbn.fn.isPrimitive({});
3591
+ * //false
3592
+ * ```
3593
+ * @memberof bbn.fn
3594
+ * @returns {Boolean}
3595
+ */
860
3596
  const isPrimitive: (...args: any[]) => boolean;
861
3597
  export { isPrimitive };
862
3598
  }
863
- declare module "fn/isPromise" {
3599
+ declare module "fn/type/isPromise" {
3600
+ /**
3601
+ * Returns true if the given argument is a promise.
3602
+ * @global
3603
+ * @example
3604
+ * ```javascript
3605
+ * bbn.fn.isPromise(bbn.fn.post('myUrl'));
3606
+ * // true
3607
+ * bbn.fn.isPromise(setTimeout(() => {}))
3608
+ * // false
3609
+ * bbn.fn.isPromise(myVueObject.$nextTick());
3610
+ * // true
3611
+ * ```
3612
+ * @method isFunction
3613
+ * @memberof bbn.fn
3614
+ * @returns {Boolean}
3615
+ */
864
3616
  const isPromise: (...args: any[]) => boolean;
865
3617
  export { isPromise };
866
3618
  }
867
- declare module "fn/isPropSize" {
3619
+ declare module "fn/type/isPropSize" {
868
3620
  const isPropSize: (name: any) => boolean;
869
3621
  export { isPropSize };
870
3622
  }
871
- declare module "fn/isSQLDate" {
3623
+ declare module "fn/type/isSQLDate" {
3624
+ /**
3625
+ * @ignore
3626
+ * @method isSQLDate
3627
+ * @todo Add method description for isSQLDate
3628
+ * @global
3629
+ * @memberof bbn.fn
3630
+ * @returns {Boolean}
3631
+ */
872
3632
  const isSQLDate: (...args: any[]) => boolean;
873
3633
  export { isSQLDate };
874
3634
  }
875
- declare module "fn/isSymbol" {
3635
+ declare module "fn/type/isSymbol" {
3636
+ /**
3637
+ * Returns true if the given argument is a symbol;
3638
+ * @method isSymbol
3639
+ * @global
3640
+ * @example
3641
+ * ```javascript
3642
+ * const sb = Symbol();
3643
+ * bbn.fn.isSymbol(sb);
3644
+ * //true
3645
+ * ```
3646
+ * @memberof bbn.fn
3647
+ * @returns {Boolean}
3648
+ */
876
3649
  const isSymbol: (...args: any[]) => boolean;
877
3650
  export { isSymbol };
878
3651
  }
879
- declare module "fn/isURL" {
3652
+ declare module "fn/type/isURL" {
880
3653
  const isURL: (...args: any[]) => boolean;
881
3654
  export { isURL };
882
3655
  }
883
- declare module "fn/isValidName" {
3656
+ declare module "fn/type/isValidName" {
3657
+ /**
3658
+ * Returns true if the given value is a valid name for a function without checking in reserved words, false otherwise
3659
+ * @method isValidName
3660
+ * @global
3661
+ * @example
3662
+ * ```javascript
3663
+ * bbn.fn.isValidName('$myFunc_tion')
3664
+ * // true
3665
+ * ```
3666
+ * @example
3667
+ * ```javascript
3668
+ * bbn.fn.isValidName('7Y')
3669
+ * // false
3670
+ * ```
3671
+ *
3672
+ * @example
3673
+ * ```javascript
3674
+ * bbn.fn.isValidName('function')
3675
+ * // true
3676
+ * ```
3677
+ *
3678
+ * @memberof bbn.fn
3679
+ * @param {String} st
3680
+ * @returns {Boolean}
3681
+ */
884
3682
  const isValidName: (...args: any[]) => boolean;
885
3683
  export { isValidName };
886
3684
  }
887
- declare module "fn/isVue" {
3685
+ declare module "fn/type/isVue" {
3686
+ /**
3687
+ * Returns true if the given argumen is a VueJS object.
3688
+ *
3689
+ * @method isVue
3690
+ * @global
3691
+ * @example
3692
+ * ```javascript
3693
+ * let myObj = new Vue({});
3694
+ * bbn.fn.isVue(myObj);
3695
+ * //true
3696
+ * ```
3697
+ * @memberof bbn.fn
3698
+ * @returns {Boolean}
3699
+ */
888
3700
  const isVue: (...args: any[]) => boolean;
889
3701
  export { isVue };
890
3702
  }
891
- declare module "fn/lightenDarkenHex" {
3703
+ declare module "fn/style/lightenDarkenHex" {
3704
+ /**
3705
+ * Takes color in hex format and lightens or darkens it with the given value.
3706
+ * @method lightenDarkenHex
3707
+ * @global
3708
+ * @example
3709
+ * ```javascript
3710
+ * //"#eccb28"
3711
+ * bbn.fn.lightenDarkenHex('#c4a300', 40);
3712
+ * ```
3713
+ *
3714
+ * @example
3715
+ * ```javascript
3716
+ * //"#9c7b00"
3717
+ * bbn.fn.lightenDarkenHex(#c4a300', -40);
3718
+ * ```
3719
+ * @memberof bbn.fn
3720
+ * @returns {String}
3721
+ */
892
3722
  const lightenDarkenHex: (hex: any, amt: any) => string;
893
3723
  export { lightenDarkenHex };
894
3724
  }
895
- declare module "fn/warning" {
3725
+ declare module "fn/browser/warning" {
3726
+ /**
3727
+ * Logs the given argument in the browser's console highlighting it with a yellow background and red color.
3728
+ * @method warning
3729
+ * @global
3730
+ * @example
3731
+ * ```javascript
3732
+ * bbn.fn.warning('whatever you want to log as a warning');
3733
+ * ```
3734
+ * @memberof bbn.fn
3735
+ * @param {...any} args
3736
+ * @returns
3737
+ */
896
3738
  const warning: (message: string) => void;
897
3739
  export { warning };
898
3740
  }
899
- declare module "fn/makeReactive" {
3741
+ declare module "fn/html/makeReactive" {
900
3742
  const makeReactive: (obj: any, onSet: any, parent: any, parentProp: any) => any;
901
3743
  export { makeReactive };
902
3744
  }
903
- declare module "fn/map" {
3745
+ declare module "fn/object/map" {
3746
+ /**
3747
+ * Returns a new array generated by the execution of a function for each item of the given array.
3748
+ *
3749
+ * The deepProp argument is the name of property which should contain a nested array on which
3750
+ * the function should also be applied recursively.
3751
+ *
3752
+ * @method map
3753
+ * @global
3754
+ * @example
3755
+ * ```javascript
3756
+ * bbn.fn.map([1, 2, 3, 4], a => {
3757
+ * return a + 1;
3758
+ * });
3759
+ * // [2, 3, 4, 5]
3760
+ * ```
3761
+ * @example
3762
+ * ```javascript
3763
+ * bbn.fn.map(
3764
+ * [{
3765
+ * name: "tools",
3766
+ * items: [
3767
+ * {
3768
+ * name: "hammers"
3769
+ * }, {
3770
+ * name: "screwdrivers",
3771
+ * items: [
3772
+ * {name: "flat screwdrivers"},
3773
+ * {name: "slotted screwdrivers"},
3774
+ * {name: "Hex screwdrivers"},
3775
+ * ]
3776
+ * }
3777
+ * ]
3778
+ * }, {
3779
+ * name: "Kitchenware"
3780
+ * }],
3781
+ * d => {
3782
+ * d.warranty = d.name === "Hex screwdrivers" ? "10 years" : "1 year";
3783
+ * return d;
3784
+ * },
3785
+ * "items"
3786
+ * );
3787
+ * // [
3788
+ * // {
3789
+ * // name: "tools",
3790
+ * // warranty: "1 year",
3791
+ * // items: [
3792
+ * // {
3793
+ * // name: "hammers",
3794
+ * // warranty: "1 year",
3795
+ * // }, {
3796
+ * // name: "screwdrivers",
3797
+ * // warranty: "1 year",
3798
+ * // items: [
3799
+ * // {name: "flat screwdrivers", warranty: "1 year"},
3800
+ * // {name: "slotted screwdrivers", warranty: "1 year"},
3801
+ * // {name: "Hex screwdrivers", warranty: "10 year"},
3802
+ * // ]
3803
+ * // }
3804
+ * // ]
3805
+ * // }, {
3806
+ * // name: "Kitchenware",
3807
+ * // warranty: "1 year"
3808
+ * // }
3809
+ * // ]
3810
+ * ```
3811
+ * @memberof bbn.fn
3812
+ * @param {Array} arr
3813
+ * @param {Function} fn
3814
+ * @param {Boolean} deepProp
3815
+ * @param {Number} level
3816
+ * @returns {Array}
3817
+ */
904
3818
  const map: (arr: any, fn: any, deepProp: any, level?: number) => any;
905
3819
  export { map };
906
3820
  }
907
- declare module "fn/money" {
3821
+ declare module "fn/misc/money" {
3822
+ /**
3823
+ * Returns the given value to money format basing on the given configuration.
3824
+ *
3825
+ * @method money
3826
+ * @global
3827
+ *
3828
+ * @example
3829
+ * ``` javascript
3830
+ * // "5 856.0 $"
3831
+ * bbn.fn.money(5856, false, '$', false, '.' ,false, 1);
3832
+ * ```
3833
+ *
3834
+ * @memberof bbn.fn
3835
+ * @param {String|Number} val The value.
3836
+ * @param {Boolean} kilo If the value has to be rendered in kilo.
3837
+ * @param {String} currency The currency.
3838
+ * @param {String} novalue The string to return if no valid value is given.
3839
+ * @param {String} decimal The character to use separate decimals.
3840
+ * @param {String} thousands The character to use to separate thounsands.
3841
+ * @param {Number} precision The number of decimals places.
3842
+ */
908
3843
  const money: (val: number, kilo?: boolean, currency?: string, novalue?: string | false, decimal?: string, thousands?: string, precision?: number) => string;
909
3844
  export { money };
910
3845
  }
911
- declare module "fn/move" {
3846
+ declare module "fn/object/move" {
3847
+ /**
3848
+ * Moves an element to a different position within the given array.
3849
+ *
3850
+ * The same array is returned, with its elements reordered according to the executed movement.
3851
+ *
3852
+ * @method move
3853
+ * @global
3854
+ * @todo Finish doc
3855
+ * @example
3856
+ * ```javascript
3857
+ * bbbn.fn.move([
3858
+ * {movie: "Brazil", year: 1985},
3859
+ * {movie: "Donnie Darko", year: 2001},
3860
+ * {movie: "Out of Africa", year: 1985}
3861
+ * ], 1, 2);
3862
+ * // [
3863
+ * // {movie: "Brazil", year: 1985},
3864
+ * // {movie: "Out of Africa", year: 1985},
3865
+ * // {movie: "Donnie Darko", year: 2001}
3866
+ * // ]
3867
+ * ```
3868
+ * @example
3869
+ * ```javascript
3870
+ * bbn.fn.move([1, 2, 3, 4], 3, 0);
3871
+ * // [4, 1, 2, 3]
3872
+ * ```
3873
+ * @memberof bbn.fn
3874
+ * @param {Array} arr The array
3875
+ * @param {Number} fromIndex The index of the element to move
3876
+ * @param {Number} toIndex The future index of the element
3877
+ * @returns {Array} The same array, with elements repositionned.
3878
+ */
912
3879
  const move: (arr: any[], fromIndex: number, toIndex: number) => any[];
913
3880
  export { move };
914
3881
  }
915
- declare module "fn/multiorder" {
3882
+ declare module "fn/object/multiorder" {
3883
+ /**
3884
+ * Sorts an array of objects based on a set of properties.
3885
+ *
3886
+ * The resulting array is the same object, the order is based on _compareValues function
3887
+ * applied for each given properties in orders argument.
3888
+ *
3889
+ * @method multiorder
3890
+ * @global
3891
+ * @example
3892
+ * ```javascript
3893
+ * let ar = [
3894
+ * {movie: "Brazil", year: 1985},
3895
+ * {movie: "Donnie Darko", year: 2001},
3896
+ * {movie: "Out of Africa", year: 1985},
3897
+ * {movie: "Ran", year: 1985},
3898
+ * {movie: "Back to the future", year: 1985},
3899
+ * {movie: "Barry Lindon", year: 1976}
3900
+ * ];
3901
+ * bbn.fn.multiorder(ar, [
3902
+ * {field: "year", dir: "desc"},
3903
+ * {field: "movie", dir: "asc"}
3904
+ * ]);
3905
+ * // [
3906
+ * // {movie: "Donnie Darko", year: 2001},
3907
+ * // {movie: "Back to the future", year: 1985},
3908
+ * // {movie: "Brazil", year: 1985},
3909
+ * // {movie: "Out of Africa", year: 1985},
3910
+ * // {movie: "Ran", year: 1985},
3911
+ * // {movie: "Barry Lindon", year: 1976}
3912
+ * // ]
3913
+ * bbn.fn.multiorder(ar, {year: "desc", movie: "asc"});
3914
+ * // Same result with object shortcut
3915
+ * ```
3916
+ * @memberof bbn.fn
3917
+ * @param {Array} arr The array to order
3918
+ * @param {Array|Object} orders The properties and directions (asc, desc) to order by
3919
+ * @returns {Array} The same array (arr), ordered differently
3920
+ */
916
3921
  const multiorder: (arr: object[], orders: object | BbnOrderItem[]) => object[];
917
3922
  export { multiorder };
918
3923
  }
919
- declare module "fn/nl2br" {
3924
+ declare module "fn/string/nl2br" {
3925
+ /**
3926
+ * Replaces all new line characters '\ n' with html tag '<br>'.
3927
+ *
3928
+ * @method nl2br
3929
+ * @global
3930
+ *
3931
+ * @example
3932
+ * ```javascript
3933
+ * bbn.fn.nl2br('hello \n world!');
3934
+ * //"hello <br> world!"
3935
+ * ```
3936
+ * @memberof bbn.fn
3937
+ * @param {String} st
3938
+ * @returns {String}
3939
+ */
920
3940
  const nl2br: (st: any, keepNl: any) => string;
921
3941
  export { nl2br };
922
3942
  }
923
- declare module "fn/objectToFormData" {
3943
+ declare module "fn/form/objectToFormData" {
3944
+ /**
3945
+ * @method objectToFormData
3946
+ * @todo Add method description for objectToFormData
3947
+ * @global
3948
+ * @memberof bbn.fn
3949
+ * @param {Object|Array|File} obj
3950
+ * @param {String} key
3951
+ * @param {Array} ignoreList
3952
+ * @returns
3953
+ */
924
3954
  const objectToFormData: (obj: object, key?: string, ignoreList?: string[]) => FormData;
925
3955
  export { objectToFormData };
926
3956
  }
927
- declare module "fn/order" {
3957
+ declare module "fn/object/order" {
3958
+ /**
3959
+ * Sorts an array of objects based on the given property.
3960
+ *
3961
+ * The resulting array is the same object, the order is based on _compareValues function.
3962
+ *
3963
+ * @method order
3964
+ * @global
3965
+ * @example
3966
+ * ```javascript
3967
+ * bbn.fn.order([
3968
+ * {movie: "Brazil", year: 1985},
3969
+ * {movie: "Donnie Darko", year: 2001},
3970
+ * {movie: "Barry Lindon", year: 1976}
3971
+ * ], 'year', 'DESC')
3972
+ * // [
3973
+ * // {movie: "Donnie Darko", year: 2001},
3974
+ * // {movie: "Brazil", year: 1985},
3975
+ * // {movie: "Barry Lindon", year: 1976}
3976
+ * // ]
3977
+ * ```
3978
+ * @memberof bbn.fn
3979
+ * @param {Array} arr The array to order
3980
+ * @param {String} prop The property on which the order is based
3981
+ * @param {String} [dir=asc] The direction of the order (desc or asc by default)
3982
+ * @returns {Array}
3983
+ */
928
3984
  const order: (arr: any, prop: any, dir?: string) => any;
929
3985
  export { order };
930
3986
  }
931
- declare module "fn/selector" {
3987
+ declare module "fn/html/selector" {
3988
+ /**
3989
+ * @ignore
3990
+ * @method selector
3991
+ * @todo Add method description for selector
3992
+ * @global
3993
+ * @memberof bbn.fn
3994
+ * @returns {*}
3995
+ */
932
3996
  const selector: (ele: string | HTMLElement) => HTMLElement | undefined;
933
3997
  export { selector };
934
3998
  }
935
- declare module "fn/outerHeight" {
3999
+ declare module "fn/style/outerHeight" {
4000
+ /**
4001
+ *
4002
+ * @ignore
4003
+ * @method outerHeight
4004
+ * @todo Add method description for outerHeight
4005
+ * @global
4006
+ * @memberof bbn.fn
4007
+ * @returns {*}
4008
+ */
936
4009
  const outerHeight: (ele: HTMLElement) => number | false;
937
4010
  export { outerHeight };
938
4011
  }
939
- declare module "fn/outerWidth" {
4012
+ declare module "fn/style/outerWidth" {
4013
+ /**
4014
+ * @ignore
4015
+ * @method outerWidth
4016
+ * @todo Add method description for outerWidth
4017
+ * @global
4018
+ * @memberof bbn.fn
4019
+ * @returns {*}
4020
+ */
940
4021
  const outerWidth: (ele: HTMLElement) => number | false;
941
4022
  export { outerWidth };
942
4023
  }
943
- declare module "fn/percent" {
4024
+ declare module "fn/misc/percent" {
4025
+ /**
4026
+ * Returns the value of the proportion giving the percentage and the total from where to be calculated.
4027
+ * @method percent
4028
+ * @global
4029
+ *
4030
+ * @example
4031
+ * ```javascript
4032
+ * //150
4033
+ * bbn.fn.percent('15',1000);
4034
+ * ```
4035
+ *
4036
+ * @example
4037
+ * ```javascript
4038
+ * //75
4039
+ * bbn.fn.percent(15,500);
4040
+ * ```
4041
+ * @memberof bbn.fn
4042
+ * @param {Number|String} percent
4043
+ * @param {Number|String} cent
4044
+ * @returns {Number}
4045
+ */
944
4046
  const percent: (percent: any, cent: any) => number;
945
4047
  export { percent };
946
4048
  }
947
- declare module "fn/pickValue" {
4049
+ declare module "fn/object/pickValue" {
948
4050
  const pickValue: (arr: any[]) => any;
949
4051
  export { pickValue };
950
4052
  }
951
- declare module "fn/postOut" {
4053
+ declare module "fn/ajax/postOut" {
4054
+ /**
4055
+ * Posts a request in a new window.
4056
+ *
4057
+ * @method postOut
4058
+ * @global
4059
+ * @memberof bbn.fn
4060
+ *
4061
+ * @example
4062
+ * ```javascript
4063
+ * bbn.fn.postOut('https://external-service.com/download/account-2019-06.pdf', {clientId: 547912, token: xxx});
4064
+ * ```
4065
+ *
4066
+ * @param {String} url The url to which the request should be sent
4067
+ * @param {Object} data The data to be sent
4068
+ * @param {Function} success A function to execute in case of success
4069
+ * @param {String} target The target attribute of the form
4070
+ *
4071
+ * @returns {undefined}
4072
+ */
952
4073
  const postOut: (url: string, data: BbnBasicObject, success?: () => any, target?: string) => void;
953
4074
  export { postOut };
954
4075
  }
955
- declare module "fn/printf" {
4076
+ declare module "fn/string/printf" {
4077
+ /**
4078
+ * @method printf
4079
+ * @todo Add method description for printf
4080
+ * @global
4081
+ * @memberof bbn.fn
4082
+ * @param String format
4083
+ * @returns {*}
4084
+ */
956
4085
  const printf: (format: any) => any;
957
4086
  export { printf };
958
4087
  }
959
- declare module "fn/quotes2html" {
4088
+ declare module "fn/string/quotes2html" {
4089
+ /**
4090
+ * Replace quotes in ASCII code
4091
+ *
4092
+ * @method quotes2html
4093
+ * @global
4094
+ *
4095
+ * @example
4096
+ * ```javascript
4097
+ * bbn.fn.quotes2html("hello 'world'!", 's');
4098
+ * // hello &#39;world&#39;!
4099
+ * ```
4100
+ *
4101
+ * @example
4102
+ * ```javascript
4103
+ * bbn.fn.quotes2html('hello "world\'s"!', 'd');
4104
+ * // hello &quot;world'sd&quot;!
4105
+ * ```
4106
+ *
4107
+ * @example
4108
+ * ```javascript
4109
+ * bbn.fn.quotes2html('hello "world\'s"!');
4110
+ * // hello &quot;world&#39;sd&quot;!
4111
+ * ```
4112
+ *
4113
+ * @memberof bbn.fn
4114
+ * @param {String} st
4115
+ * @returns {String}
4116
+ */
960
4117
  const quotes2html: (st: string, type?: string) => string;
961
4118
  export { quotes2html };
962
4119
  }
963
- declare module "fn/randomInt" {
4120
+ declare module "fn/misc/randomInt" {
4121
+ /**
4122
+ * Returns a random integer.
4123
+ *
4124
+ * Generates and returns a random number in a range of numbers defined
4125
+ * by passed arguments a minimum and a maximum.
4126
+ *
4127
+ * @method randomInt
4128
+ * @global
4129
+ *
4130
+ * @example
4131
+ * ```javascript
4132
+ * //56
4133
+ * bbn.fn.randomInt(1,100);
4134
+ * ```
4135
+ *
4136
+ * @memberof bbn.fn
4137
+ * @param {Number} min
4138
+ * @param {Number} max
4139
+ * @returns {Number}
4140
+ */
964
4141
  const randomInt: (min: number, max: number) => number;
965
4142
  export { randomInt };
966
4143
  }
967
- declare module "fn/randomString" {
4144
+ declare module "fn/string/randomString" {
4145
+ /**
4146
+ * Returns a random String with random lenght,
4147
+ *
4148
+ * Generates a random string from the length of the random number,
4149
+ * taken from a range of numbers providing either only the minimum or also the maximum as arguments.
4150
+ *
4151
+ * @method randomString
4152
+ * @global
4153
+ *
4154
+ * @example
4155
+ * ```javascript
4156
+ * //"U7xXO0Xb"
4157
+ * bbn.fn.randomString(3,10);
4158
+ * ```
4159
+ *
4160
+ * @example
4161
+ * ```javascript
4162
+ * //"H8F"
4163
+ * bbn.fn.randomString(3);
4164
+ * ```
4165
+ *
4166
+ * @memberof bbn.fn
4167
+ * @param {Number} length
4168
+ * @param {String} chars
4169
+ * @returns {String}
4170
+ */
968
4171
  const randomString: (min?: number, max?: string | number, types?: string) => string;
969
4172
  export { randomString };
970
4173
  }
971
- declare module "fn/removeEmpty" {
4174
+ declare module "fn/object/removeEmpty" {
4175
+ /**
4176
+ * Returns a new array, having removed all elements deemed empty from the given array.
4177
+ *
4178
+ * Removes all the elements which are empty, i.e. false, 0, null, '', NaN, or undefined.
4179
+ *
4180
+ * @method removeEmpty
4181
+ * @global
4182
+ * @example
4183
+ * ```javascript
4184
+ * bbn.fn.removeEmpty([{prop1: 10, prop2: 20}, '', {}, null, 1, undefined, 0, false, 25]);
4185
+ * // [{prop1: 10, prop2: 20}, 1, 25]
4186
+ * ```
4187
+ * @memberof bbn.fn
4188
+ * @param {Array} arr
4189
+ * @returns {Array}
4190
+ */
972
4191
  const removeEmpty: (arr: any[]) => any[];
973
4192
  export { removeEmpty };
974
4193
  }
975
- declare module "fn/removeExtraSpaces" {
4194
+ declare module "fn/string/removeExtraSpaces" {
4195
+ /**
4196
+ * Removes all group of spaces by one single space.
4197
+ * @param {String} str
4198
+ * @returns
4199
+ */
976
4200
  const removeExtraSpaces: (str: string) => string;
977
4201
  export { removeExtraSpaces };
978
4202
  }
979
- declare module "fn/removeTrailingChars" {
4203
+ declare module "fn/string/removeTrailingChars" {
4204
+ /**
4205
+ * @method removeTrailingChars
4206
+ * @todo Add method description for removeTrailingChars
4207
+ * @global
4208
+ * @memberof bbn.fn
4209
+ * @param {String} st
4210
+ * @param {String} char
4211
+ * @returns {*}
4212
+ */
980
4213
  const removeTrailingChars: (st: string, char?: string) => string;
981
4214
  export { removeTrailingChars };
982
4215
  }
983
- declare module "fn/repeat" {
4216
+ declare module "fn/string/repeat" {
4217
+ /**
4218
+ * Returns a string which is the repetition of the first argument for the number passed in the second argument.
4219
+ *
4220
+ * @method repeat
4221
+ * @global
4222
+ *
4223
+ * @example
4224
+ * ```javascript
4225
+ * //"HelloHelloHello"
4226
+ * bbn.fn.repeat('Hello', 3);
4227
+ * ```
4228
+ * @memberof bbn.fn
4229
+ * @returns {String}
4230
+ */
984
4231
  const repeat: (st: string, num: number) => string;
985
4232
  export { repeat };
986
4233
  }
987
- declare module "fn/replaceSelection" {
4234
+ declare module "fn/browser/replaceSelection" {
988
4235
  const replaceSelection: (html: any, selectInserted: any) => void;
989
4236
  export { replaceSelection };
990
4237
  }
991
- declare module "fn/rgb2hex" {
4238
+ declare module "fn/convert/rgb2hex" {
4239
+ /**
4240
+ * Convert an RGB string to hexadecimal.
4241
+ *
4242
+ * Passing a string with the format that defines the rgb value as an argument,
4243
+ * it will return the corresponding string in hexadecimal format.
4244
+ *
4245
+ * @method rgb2hex
4246
+ * @global
4247
+ *
4248
+ * @example
4249
+ * ```javascript
4250
+ * //"#ff0000"
4251
+ * bbn.fn.rgb2hex("rgb(255, 0, 0)");
4252
+ * ```
4253
+ * @memberof bbn.fn
4254
+ * @param {String} rgb
4255
+ * @returns {String}
4256
+ */
992
4257
  const rgb2hex: (rgb: any) => string;
993
4258
  export { rgb2hex };
994
4259
  }
995
- declare module "fn/riterate" {
4260
+ declare module "fn/loop/riterate" {
4261
+ /**
4262
+ * Executes the provided function on each property of the given object.
4263
+ *
4264
+ * @method riterate
4265
+ * @global
4266
+ * @example
4267
+ * ```javascript
4268
+ * //["value1", 2]
4269
+ * let arr = [];
4270
+ * bbn.fn.iterate({field1: "value1", field2: 2}, (val, idx) => {
4271
+ * arr.push(value);
4272
+ * });
4273
+ * ```
4274
+ * @memberof bbn.fn
4275
+ * @param {(Object|Number)} obj The object to loop on
4276
+ * @param {Function} fn The function, gets the array's element and the index as arguments
4277
+ * @param {Boolean} noPrivate If set to true the _private_ properties won't be included
4278
+ * @returns {Object}
4279
+ */
996
4280
  const riterate: (obj: object, fn: (a: any, b: string) => any, noPrivate?: boolean) => object;
997
4281
  export { riterate };
998
4282
  }
999
- declare module "fn/roundDecimal" {
4283
+ declare module "fn/misc/roundDecimal" {
4284
+ /**
4285
+ * @method roundDecimal
4286
+ * @todo Add method description for roundDecimal
4287
+ * @global
4288
+ * @memberof bbn.fn
4289
+ * @param {Number} value
4290
+ * @param {Number} decimals
4291
+ * @returns {}
4292
+ */
1000
4293
  const roundDecimal: (value: number, decimals: number) => number;
1001
4294
  export { roundDecimal };
1002
4295
  }
1003
- declare module "fn/trim" {
4296
+ declare module "fn/string/trim" {
1004
4297
  const trim: (str: any, hair?: string) => any;
1005
4298
  export { trim };
1006
4299
  }
1007
- declare module "fn/sanitize" {
4300
+ declare module "fn/string/sanitize" {
4301
+ /**
4302
+ * Removes all unacceptable characters in a DOM node.
4303
+ *
4304
+ * @method sanitize
4305
+ * @global
4306
+ *
4307
+ * @example
4308
+ * ```javascript
4309
+ * //"this_is_a_test"
4310
+ * bbn.fn.sanitize("this&is_$a^test");
4311
+ * ```
4312
+ *
4313
+ * @memberof bbn.fn
4314
+ * @returns {String} str
4315
+ */
1008
4316
  const sanitize: (str: any, separator?: string) => any;
1009
4317
  export { sanitize };
1010
4318
  }
1011
- declare module "fn/selectElementText" {
4319
+ declare module "fn/browser/selectElementText" {
4320
+ /**
4321
+ * Selects the content of an element.
4322
+ *
4323
+ * @method selectElementText
4324
+ * @global
4325
+ * @example
4326
+ * ``` javascript
4327
+ * bbn.fn.selectElementText(document.getElementById('my_input_id'));
4328
+ * // false
4329
+ * bbn.fn.selectElementText(bbn.$('#my_span_id'));
4330
+ * // true
4331
+ * ```
4332
+ * @memberof bbn.fn
4333
+ *
4334
+ * @param {Element} ele The element in which the text should be selected
4335
+ * @param {Boolean} win The window object
4336
+ *
4337
+ * @returns {Boolean} True if focused
4338
+ */
1012
4339
  const selectElementText: (ele: HTMLElement, win?: Window) => void;
1013
4340
  export { selectElementText };
1014
4341
  }
1015
- declare module "fn/setCookie" {
4342
+ declare module "fn/browser/setCookie" {
4343
+ /**
4344
+ * Creates a cookie and assigns it to document.cookie.
4345
+ * @method setCookie
4346
+ * @global
4347
+ * @example
4348
+ * ``` javascript
4349
+ * bbn.fn.setCookie('lang', 'en', 2);
4350
+ * ```
4351
+ * @memberof bbn.fn
4352
+ * @param {String} name The name of the cookie.
4353
+ * @param {String} value The value of the cookie.
4354
+ * @param {Number} days The days before expiration of the cookie.
4355
+ * @returns
4356
+ */
1016
4357
  const setCookie: (name: any, value: any, days: any) => void;
1017
4358
  export { setCookie };
1018
4359
  }
1019
- declare module "fn/setCssVar" {
4360
+ declare module "fn/style/setCssVar" {
4361
+ /**
4362
+ * Creates a CSS variable
4363
+ * @param {String*} varname
4364
+ * @param {String*} value
4365
+ * @returns
4366
+ */
1020
4367
  const setCssVar: (varname: any, value: any) => void;
1021
4368
  export { setCssVar };
1022
4369
  }
1023
- declare module "fn/setProp" {
4370
+ declare module "fn/object/setProp" {
4371
+ /**
4372
+ * Sets a given property on the given object
4373
+ *
4374
+ * @param {Object} obj
4375
+ * @param {String} prop
4376
+ * @param {*} value
4377
+ * @param {Boolean} writable
4378
+ * @param {Boolean} configurable
4379
+ */
1024
4380
  const setProp: (obj: object, prop: string, value: any, writable?: boolean, configurable?: boolean) => void;
1025
4381
  export { setProp };
1026
4382
  }
1027
- declare module "fn/setProperty" {
4383
+ declare module "fn/object/setProperty" {
4384
+ /**
4385
+ * Returns the value of the given property from the given object.
4386
+ *
4387
+ * Looks for the given property in the given object, accepting dot (.) separator
4388
+ * for deep property access, and returns its value if found and undefined otherwise.
4389
+ *
4390
+ * @method getProperty
4391
+ * @global
4392
+ * @example
4393
+ * ```javascript
4394
+ * bbn.fn.getProperty({a: 1, b: 2}, 'b');
4395
+ * // 2
4396
+ * ```
4397
+ * @example
4398
+ * ```javascript
4399
+ * bbn.fn.getProperty({a: 1, b: {o: {a: 33, h: 5}}}, 'b.o.a');
4400
+ * // 33
4401
+ * ```
4402
+ * @example
4403
+ * ```javascript
4404
+ * bbn.fn.getProperty({a: 1, b: {o: {a: 33, h: 5}}}, 'b.h.a');
4405
+ * // undefined
4406
+ * ```
4407
+ * @memberof bbn.fn
4408
+ * @param {Object} obj
4409
+ * @param {String} prop
4410
+ * @returns {*} The property's value or undefined
4411
+ */
1028
4412
  const setProperty: (obj: object, prop: string, value: any, force?: boolean) => void;
1029
4413
  export { setProperty };
1030
4414
  }
1031
- declare module "fn/shorten" {
4415
+ declare module "fn/string/shorten" {
4416
+ /**
4417
+ * Shortens the given string after *len* characters.
4418
+ *
4419
+ * Provides an abbreviation to the string passed as the first argument,
4420
+ * deciding through the second argument the number of characters to keep and the remainder replaced
4421
+ * by what is passed as the third argument and if not given a defalut it is: '...'
4422
+ *
4423
+ * @method shorten
4424
+ * @global
4425
+ *
4426
+ * @example
4427
+ * ```javascript
4428
+ * //"test***"
4429
+ * bbn.fn.shorten('testing', 4, '***');
4430
+ * ```
4431
+ * @example
4432
+ * ```javascript
4433
+ * //"test..."
4434
+ * bbn.fn.shorten('testing', 4);
4435
+ * ```
4436
+ * @memberof bbn.fn
4437
+ * @param {String} st
4438
+ * @param {Number} len
4439
+ * @returns {String}
4440
+ */
1032
4441
  const shorten: (st: string, len?: number, adj?: string) => string;
1033
4442
  export { shorten };
1034
4443
  }
1035
- declare module "fn/shortenObj" {
4444
+ declare module "fn/object/shortenObj" {
4445
+ /**
4446
+ * Shortens all the strings contained in the object properties or element in a array.
4447
+ *
4448
+ * Modifies directly the given object by cuttin all its too long strings, and adding ellipsis (...) in this case.
4449
+ *
4450
+ * @method shortenObj
4451
+ * @global
4452
+ * @example
4453
+ * ```javascript
4454
+ * bbn.fn.shortenObj({
4455
+ * title: "Once upon a time in the west",
4456
+ * synopsis: "There's a single piece of land around Flagstone with water on it, and rail baron Morton (Gabriele Ferzetti) aims to have it, knowing the new railroad will have to stop there. He sends his henchman Frank (Henry Fonda) to scare the land's owner, McBain (Frank Wolff), but Frank kills him instead and pins it on a known bandit, Cheyenne (Jason Robards). Meanwhile, a mysterious gunslinger with a score to settle (Charles Bronson) and McBain's new wife, Jill (Claudia Cardinale), arrive in town."
4457
+ * }, 50)
4458
+ * // {
4459
+ * // "title": "Once upon a time in the west",
4460
+ * // "synopsis": "There's a single piece of land around Flagstone wi..."
4461
+ * // }
4462
+ * ```
4463
+ * @memberof bbn.fn
4464
+ * @param {(Object|Array)} obj
4465
+ * @param {Number} [max=100]
4466
+ * @returns {(Object|Array)} The same object, modified
4467
+ */
1036
4468
  const shortenObj: (obj: any, max?: number) => object;
1037
4469
  export { shortenObj };
1038
4470
  }
1039
- declare module "fn/shuffle" {
4471
+ declare module "fn/object/shuffle" {
1040
4472
  const shuffle: (array: any[]) => any[];
1041
4473
  export { shuffle };
1042
4474
  }
1043
- declare module "fn/chrono" {
4475
+ declare module "fn/datetime/chrono" {
4476
+ /**
4477
+ * Starts a timer and gives it a name.
4478
+ * @method startChrono
4479
+ * @global
4480
+ * ``` javascript
4481
+ * bbn.fn.startChrono('myChrono');
4482
+ * ```
4483
+ * @memberof bbn.fn
4484
+ * @returns
4485
+ */
1044
4486
  const startChrono: (name: any) => void;
4487
+ /**
4488
+ * @method stopChrono
4489
+ * @global
4490
+ * @example
4491
+ * ``` javascript
4492
+ * bbn.fn.stopChrono('myChrono');
4493
+ * // 20162
4494
+ * ```
4495
+ * @memberof bbn.fn
4496
+ * @param {String} name
4497
+ * @returns {Number}
4498
+ */
1045
4499
  const stopChrono: (name: any) => number;
1046
4500
  export { startChrono, stopChrono };
1047
4501
  }
1048
- declare module "fn/stat" {
1049
- const stat: (returnStat: any) => void;
1050
- export { stat };
1051
- }
1052
- declare module "fn/string2ArrayBuffer" {
4502
+ declare module "fn/convert/string2ArrayBuffer" {
1053
4503
  const string2ArrayBuffer: (str: string) => ArrayBuffer;
1054
4504
  export { string2ArrayBuffer };
1055
4505
  }
1056
- declare module "fn/sum" {
4506
+ declare module "fn/object/sum" {
4507
+ /**
4508
+ * Returns the sum of the given property or function for the array's elements matching the filter.
4509
+ *
4510
+ * The filtering arguments follow the same scheme as bbn.fn.search.
4511
+ *
4512
+ * @method sum
4513
+ * @global
4514
+ * @example
4515
+ * ```javascript
4516
+ * let invited = [
4517
+ * {name: "Robert De Niro", attendees: 2, confirmed: true},
4518
+ * {name: "Al Pacino", attendees: 1, confirmed: false},
4519
+ * {name: "James Caan", attendees: 4, confirmed: false},
4520
+ * {name: "Harvey Keitel", attendees: 5, confirmed: true}
4521
+ * ];
4522
+ * // No filter
4523
+ * bbn.fn.sum(invited, "attendees");
4524
+ * // 12
4525
+ * // Filter
4526
+ * bbn.fn.sum(invited, "attendees", {confirmed: true});
4527
+ * // 7
4528
+ * ```
4529
+ * @example
4530
+ * ```javascript
4531
+ * let cart = [
4532
+ * {article: "Toothpaste", price: 2.50, quantity: 1},
4533
+ * {article: "Toothbrush", price: 6, quantity: 2},
4534
+ * {article: "Banana", price: 0.50, quantity: 3},
4535
+ * {article: "T-shirt", price: 14, quantity: 3}
4536
+ * ];
4537
+ * bbn.fn.sum(cart, a => a.price * a.quantity);
4538
+ * // 58
4539
+ * // Only the items with a quantity equal to 3
4540
+ * bbn.fn.sum(cart, a => a.price * a.quantity, {quantity: 3});
4541
+ * // 43.5
4542
+ * ```
4543
+ * @memberof bbn.fn
4544
+ * @param {Array} arr The subject array
4545
+ * @param {(String|Function)} numberProp The property's name for which the value should be added to the sum, or a function returning the number.
4546
+ * @param {(String|Object|Function)} prop A property's name or a filter object or function
4547
+ * @param {*} val The value with which comparing the given property
4548
+ * @param {String} operator The operator to use for comparison with the value as used in bbn.fn.compare
4549
+ * @returns {Number} The sum
4550
+ */
1057
4551
  const sum: (arr: object[], numberProp: string | ((a: any) => any), prop: object | string, val?: any, operator?: string) => number;
1058
4552
  export { sum };
1059
4553
  }
1060
- declare module "fn/timestamp" {
4554
+ declare module "fn/datetime/timestamp" {
4555
+ /**
4556
+ * Returns the timestamp of the given seconds if an argument is given, else returns the timestamp of new Date().
4557
+ * @method timestamp
4558
+ * @global
4559
+ * @example
4560
+ * ```javascript
4561
+ * //1587031047918
4562
+ * bbn.fn.timestamp();
4563
+ * ```
4564
+ * @memberof bbn.fn
4565
+ * @param {Number} seconds
4566
+ * @returns {Boolean}
4567
+ */
1061
4568
  const timestamp: (seconds?: boolean) => number;
1062
4569
  export { timestamp };
1063
4570
  }
1064
- declare module "fn/toCSV" {
4571
+ declare module "fn/convert/toCSV" {
4572
+ /**
4573
+ * Returns a CSV string from the given array of arrays or objects.
4574
+ *
4575
+ * @method toCSV
4576
+ * @global
4577
+ * @example
4578
+ * ```javascript
4579
+ * bbn.fn.toCSV([['a', 'b', 'c'], ['d', 'e', 'f']]);
4580
+ * // "a","b","c";
4581
+ * // "d","e","f"
4582
+ * ```
4583
+ * @example
4584
+ * ```javascript
4585
+ * bbn.fn.toCSV([{name: "Capuche", fname: "Marc-Antoine"}, {name: "Orfin", fname: "Louis"}]);
4586
+ * // "Capuche","Marc-Antoine";
4587
+ * // "Orfin","Louis"
4588
+ * ```
4589
+ * @memberof bbn.fn
4590
+ * @param {Array} arr The array to convert
4591
+ * @param {String} [valSep=,] The value separator character
4592
+ * @param {String} [rowSep=;] The row separator character
4593
+ * @param {String} [valEsc="] The string escaper character
4594
+ * @returns {String} A CSV string
4595
+ */
1065
4596
  const toCSV: (arr: any[], valSep?: string, rowSep?: string, valEsc?: string) => string;
1066
4597
  export { toCSV };
1067
4598
  }
1068
- declare module "fn/toggleFullScreen" {
4599
+ declare module "fn/browser/toggleFullScreen" {
1069
4600
  const toggleFullScreen: () => void;
1070
4601
  export { toggleFullScreen };
1071
4602
  }
1072
- declare module "fn/translate" {
4603
+ declare module "fn/misc/translate" {
1073
4604
  const translate: (o: object, namespace?: string) => void;
1074
4605
  export { translate };
1075
4606
  }
1076
- declare module "fn/uniqString" {
4607
+ declare module "fn/string/uniqString" {
4608
+ /**
4609
+ * Create a unique string in md5 format.
4610
+ *
4611
+ * Converts and return all the arguments inserted in a unique string in md5 format.
4612
+ *
4613
+ * @method uniqString
4614
+ * @global
4615
+ *
4616
+ * @example
4617
+ * ```javascript
4618
+ * //"6cb083da4d4987af9b4fa4ad8ca23bb1"
4619
+ * bbn.fn.uniqString('test',['test'],{id:1, test:2},4);
4620
+ * ```
4621
+ * @memberof bbn.fn
4622
+ * @returns {String} The unique string in md5 format
4623
+ */
1077
4624
  const uniqString: (...args: any[]) => string;
1078
4625
  export { uniqString };
1079
4626
  }
1080
- declare module "fn/upload" {
4627
+ declare module "fn/ajax/upload" {
4628
+ /**
4629
+ * Uploads a file synchronously through an XHR indicating progress.
4630
+ *
4631
+ * @method upload
4632
+ * @todo examples
4633
+ * @global
4634
+ * @memberof bbn.fn
4635
+ *
4636
+ * @param {String} url The URL to which the file should be uploaded
4637
+ * @param {File} file A File object or an array of data
4638
+ * @param {Function} success A function to execute after success
4639
+ * @param {Function} failure A function to execute after failure
4640
+ * @param {Function} progress A function to execute during progress
4641
+ *
4642
+ * @returns {Promise}
4643
+ */
1081
4644
  const upload: (url: string, file: any, success?: (d: any) => any, failure?: (d: any) => any, progress?: (d: any, l: any, t: any) => any) => any;
1082
4645
  export { upload };
1083
4646
  }
@@ -1167,8 +4730,8 @@ declare module "fn" {
1167
4730
  fdatetime: (d?: string | number | Date, wrong_result?: string | boolean) => any;
1168
4731
  fieldValue: (field: any) => any;
1169
4732
  fileExt: (filename: any) => any;
1170
- filter: (arr: any[], prop: string | object | import("fn/filterToConditions").Filter | ((a: any, i: string | number | symbol) => boolean), val?: any, operator?: string) => any[];
1171
- filterToConditions: (filter: any, operator?: string) => import("fn/filterToConditions").Filter;
4733
+ filter: (arr: any[], prop: string | object | import("fn/object/filterToConditions").Filter | ((a: any, i: string | number | symbol) => boolean), val?: any, operator?: string) => any[];
4734
+ filterToConditions: (filter: any, operator?: string) => import("fn/object/filterToConditions").Filter;
1172
4735
  findAll: (arr: any, filter: any, deepProperty: any, res?: any[]) => any[];
1173
4736
  fori: (arr: any[], fn: (a: any, i: number) => any, max?: number, min?: number) => void;
1174
4737
  forir: (arr: any[], fn: (a: any, b: number) => any, max?: number, min?: number) => void;
@@ -1236,7 +4799,7 @@ declare module "fn" {
1236
4799
  isInside: (ele: any, ancestor: any) => boolean;
1237
4800
  isInt: (...args: any[]) => boolean;
1238
4801
  isIP: (...args: any[]) => boolean;
1239
- isIterable: (v: any) => boolean;
4802
+ isIterable: (...args: any[]) => boolean;
1240
4803
  isMobile: () => boolean;
1241
4804
  isMobileDevice: () => boolean;
1242
4805
  isNull: (...args: any[]) => boolean;
@@ -1294,7 +4857,7 @@ declare module "fn" {
1294
4857
  riterate: (obj: object, fn: (a: any, b: string) => any, noPrivate?: boolean) => object;
1295
4858
  roundDecimal: (value: number, decimals: number) => number;
1296
4859
  sanitize: (str: any, separator?: string) => any;
1297
- search: (arr: any[], prop: string | object | import("fn/filterToConditions").Filter | ((a: any, i: string | number | symbol) => boolean), val?: any, operator?: string | number, startFrom?: number) => number;
4860
+ search: (arr: any[], prop: string | object | import("fn/object/filterToConditions").Filter | ((a: any, i: string | number | symbol) => boolean), val?: any, operator?: string | number, startFrom?: number) => number;
1298
4861
  selectElementText: (ele: HTMLElement, win?: Window) => void;
1299
4862
  selector: (ele: string | HTMLElement) => HTMLElement;
1300
4863
  setCookie: (name: any, value: any, days: any) => void;
@@ -1309,7 +4872,6 @@ declare module "fn" {
1309
4872
  simpleHash1: (str: string) => number;
1310
4873
  simpleHash2: (str: string) => number;
1311
4874
  startChrono: (name: any) => void;
1312
- stat: (returnStat: any) => void;
1313
4875
  stopChrono: (name: any) => number;
1314
4876
  string2ArrayBuffer: (str: string) => ArrayBuffer;
1315
4877
  submit: (form: HTMLFormElement, e?: Event, fn?: Function) => void;