@bbn/bbn 1.0.59 → 1.0.61

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 +4062 -501
  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 +39 -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
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Returns the first object matching the given filter in an array of objects.
3
+ *
4
+ * The filtering arguments follow the same scheme as bbn.fn.search.
5
+ *
6
+ * @method getRow
7
+ * @global
8
+ * @example
9
+ * ```javascript
10
+ * let ar = [
11
+ * {name: "Raiders of the lost ark", director: "Steven Spielberg", year: 1981, id: 589},
12
+ * {name: "Goonies", director: "Richard Donner", year: 1985, id: 689},
13
+ * {name: "Star wars", director: "George Lucas", year: 1977, id: 256},
14
+ * {name: "Jaws", director: "Steven Spielberg", year: 1975, id: 423}
15
+ * ];
16
+ * bbn.fn.getRow(ar, {director: "Steven Spielberg"});
17
+ * // {name: "Raiders of the lost ark", director: "Steven Spielberg", year: 1981, id: 589},
18
+ * bbn.fn.getRow(ar, "director", "Steven Spielberg");
19
+ * // Same result as the previous example
20
+ * bbn.fn.getRow(ar, {
21
+ * logic: "OR",
22
+ * conditions: [
23
+ * {
24
+ * field: "director",
25
+ * value: "Richard Donner"
26
+ * }, {
27
+ * field: "director",
28
+ * value: "George Lucas"
29
+ * }
30
+ * ]
31
+ * );
32
+ * // {name: "Goonies", director: "Richard Donner", year: 1985, id: 689},
33
+ * ```
34
+ * @memberof bbn.fn
35
+ * @param {Array} arr The subject array
36
+ * @param {(String|Object|Function)} prop A property's name or a filter object or function
37
+ * @param {*} val The value with which comparing the given property
38
+ * @param {String} operator The operator to use for comparison with the value as used in bbn.fn.compare
39
+ * @returns {Object|Boolean} The item if found, false otherwise
40
+ */
41
+ declare const getRow: (arr: any[], prop: object | string, val?: any, operator?: string) => any | false;
42
+ export { getRow };
@@ -0,0 +1,49 @@
1
+ import { search } from './search';
2
+ /**
3
+ * Returns the first object matching the given filter in an array of objects.
4
+ *
5
+ * The filtering arguments follow the same scheme as bbn.fn.search.
6
+ *
7
+ * @method getRow
8
+ * @global
9
+ * @example
10
+ * ```javascript
11
+ * let ar = [
12
+ * {name: "Raiders of the lost ark", director: "Steven Spielberg", year: 1981, id: 589},
13
+ * {name: "Goonies", director: "Richard Donner", year: 1985, id: 689},
14
+ * {name: "Star wars", director: "George Lucas", year: 1977, id: 256},
15
+ * {name: "Jaws", director: "Steven Spielberg", year: 1975, id: 423}
16
+ * ];
17
+ * bbn.fn.getRow(ar, {director: "Steven Spielberg"});
18
+ * // {name: "Raiders of the lost ark", director: "Steven Spielberg", year: 1981, id: 589},
19
+ * bbn.fn.getRow(ar, "director", "Steven Spielberg");
20
+ * // Same result as the previous example
21
+ * bbn.fn.getRow(ar, {
22
+ * logic: "OR",
23
+ * conditions: [
24
+ * {
25
+ * field: "director",
26
+ * value: "Richard Donner"
27
+ * }, {
28
+ * field: "director",
29
+ * value: "George Lucas"
30
+ * }
31
+ * ]
32
+ * );
33
+ * // {name: "Goonies", director: "Richard Donner", year: 1985, id: 689},
34
+ * ```
35
+ * @memberof bbn.fn
36
+ * @param {Array} arr The subject array
37
+ * @param {(String|Object|Function)} prop A property's name or a filter object or function
38
+ * @param {*} val The value with which comparing the given property
39
+ * @param {String} operator The operator to use for comparison with the value as used in bbn.fn.compare
40
+ * @returns {Object|Boolean} The item if found, false otherwise
41
+ */
42
+ const getRow = function (arr, prop, val = null, operator = '=') {
43
+ var idx = search(arr, prop, val, operator);
44
+ if (idx > -1) {
45
+ return arr[idx];
46
+ }
47
+ return false;
48
+ };
49
+ export { getRow };
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Returns a new array generated by the execution of a function for each item of the given array.
3
+ *
4
+ * The deepProp argument is the name of property which should contain a nested array on which
5
+ * the function should also be applied recursively.
6
+ *
7
+ * @method map
8
+ * @global
9
+ * @example
10
+ * ```javascript
11
+ * bbn.fn.map([1, 2, 3, 4], a => {
12
+ * return a + 1;
13
+ * });
14
+ * // [2, 3, 4, 5]
15
+ * ```
16
+ * @example
17
+ * ```javascript
18
+ * bbn.fn.map(
19
+ * [{
20
+ * name: "tools",
21
+ * items: [
22
+ * {
23
+ * name: "hammers"
24
+ * }, {
25
+ * name: "screwdrivers",
26
+ * items: [
27
+ * {name: "flat screwdrivers"},
28
+ * {name: "slotted screwdrivers"},
29
+ * {name: "Hex screwdrivers"},
30
+ * ]
31
+ * }
32
+ * ]
33
+ * }, {
34
+ * name: "Kitchenware"
35
+ * }],
36
+ * d => {
37
+ * d.warranty = d.name === "Hex screwdrivers" ? "10 years" : "1 year";
38
+ * return d;
39
+ * },
40
+ * "items"
41
+ * );
42
+ * // [
43
+ * // {
44
+ * // name: "tools",
45
+ * // warranty: "1 year",
46
+ * // items: [
47
+ * // {
48
+ * // name: "hammers",
49
+ * // warranty: "1 year",
50
+ * // }, {
51
+ * // name: "screwdrivers",
52
+ * // warranty: "1 year",
53
+ * // items: [
54
+ * // {name: "flat screwdrivers", warranty: "1 year"},
55
+ * // {name: "slotted screwdrivers", warranty: "1 year"},
56
+ * // {name: "Hex screwdrivers", warranty: "10 year"},
57
+ * // ]
58
+ * // }
59
+ * // ]
60
+ * // }, {
61
+ * // name: "Kitchenware",
62
+ * // warranty: "1 year"
63
+ * // }
64
+ * // ]
65
+ * ```
66
+ * @memberof bbn.fn
67
+ * @param {Array} arr
68
+ * @param {Function} fn
69
+ * @param {Boolean} deepProp
70
+ * @param {Number} level
71
+ * @returns {Array}
72
+ */
73
+ declare const map: (arr: any, fn: any, deepProp: any, level?: number) => any;
74
+ export { map };
@@ -0,0 +1,83 @@
1
+ import { isArray } from "../type/isArray";
2
+ /**
3
+ * Returns a new array generated by the execution of a function for each item of the given array.
4
+ *
5
+ * The deepProp argument is the name of property which should contain a nested array on which
6
+ * the function should also be applied recursively.
7
+ *
8
+ * @method map
9
+ * @global
10
+ * @example
11
+ * ```javascript
12
+ * bbn.fn.map([1, 2, 3, 4], a => {
13
+ * return a + 1;
14
+ * });
15
+ * // [2, 3, 4, 5]
16
+ * ```
17
+ * @example
18
+ * ```javascript
19
+ * bbn.fn.map(
20
+ * [{
21
+ * name: "tools",
22
+ * items: [
23
+ * {
24
+ * name: "hammers"
25
+ * }, {
26
+ * name: "screwdrivers",
27
+ * items: [
28
+ * {name: "flat screwdrivers"},
29
+ * {name: "slotted screwdrivers"},
30
+ * {name: "Hex screwdrivers"},
31
+ * ]
32
+ * }
33
+ * ]
34
+ * }, {
35
+ * name: "Kitchenware"
36
+ * }],
37
+ * d => {
38
+ * d.warranty = d.name === "Hex screwdrivers" ? "10 years" : "1 year";
39
+ * return d;
40
+ * },
41
+ * "items"
42
+ * );
43
+ * // [
44
+ * // {
45
+ * // name: "tools",
46
+ * // warranty: "1 year",
47
+ * // items: [
48
+ * // {
49
+ * // name: "hammers",
50
+ * // warranty: "1 year",
51
+ * // }, {
52
+ * // name: "screwdrivers",
53
+ * // warranty: "1 year",
54
+ * // items: [
55
+ * // {name: "flat screwdrivers", warranty: "1 year"},
56
+ * // {name: "slotted screwdrivers", warranty: "1 year"},
57
+ * // {name: "Hex screwdrivers", warranty: "10 year"},
58
+ * // ]
59
+ * // }
60
+ * // ]
61
+ * // }, {
62
+ * // name: "Kitchenware",
63
+ * // warranty: "1 year"
64
+ * // }
65
+ * // ]
66
+ * ```
67
+ * @memberof bbn.fn
68
+ * @param {Array} arr
69
+ * @param {Function} fn
70
+ * @param {Boolean} deepProp
71
+ * @param {Number} level
72
+ * @returns {Array}
73
+ */
74
+ const map = function (arr, fn, deepProp, level = 0) {
75
+ return arr.map((a, i) => {
76
+ a = fn(a, i, level);
77
+ if (deepProp && a[deepProp] && isArray(a[deepProp])) {
78
+ a[deepProp] = map(a[deepProp], fn, deepProp, level + 1);
79
+ }
80
+ return a;
81
+ });
82
+ };
83
+ export { map };
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Moves an element to a different position within the given array.
3
+ *
4
+ * The same array is returned, with its elements reordered according to the executed movement.
5
+ *
6
+ * @method move
7
+ * @global
8
+ * @todo Finish doc
9
+ * @example
10
+ * ```javascript
11
+ * bbbn.fn.move([
12
+ * {movie: "Brazil", year: 1985},
13
+ * {movie: "Donnie Darko", year: 2001},
14
+ * {movie: "Out of Africa", year: 1985}
15
+ * ], 1, 2);
16
+ * // [
17
+ * // {movie: "Brazil", year: 1985},
18
+ * // {movie: "Out of Africa", year: 1985},
19
+ * // {movie: "Donnie Darko", year: 2001}
20
+ * // ]
21
+ * ```
22
+ * @example
23
+ * ```javascript
24
+ * bbn.fn.move([1, 2, 3, 4], 3, 0);
25
+ * // [4, 1, 2, 3]
26
+ * ```
27
+ * @memberof bbn.fn
28
+ * @param {Array} arr The array
29
+ * @param {Number} fromIndex The index of the element to move
30
+ * @param {Number} toIndex The future index of the element
31
+ * @returns {Array} The same array, with elements repositionned.
32
+ */
33
+ declare const move: (arr: any[], fromIndex: number, toIndex: number) => any[];
34
+ export { move };
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Moves an element to a different position within the given array.
3
+ *
4
+ * The same array is returned, with its elements reordered according to the executed movement.
5
+ *
6
+ * @method move
7
+ * @global
8
+ * @todo Finish doc
9
+ * @example
10
+ * ```javascript
11
+ * bbbn.fn.move([
12
+ * {movie: "Brazil", year: 1985},
13
+ * {movie: "Donnie Darko", year: 2001},
14
+ * {movie: "Out of Africa", year: 1985}
15
+ * ], 1, 2);
16
+ * // [
17
+ * // {movie: "Brazil", year: 1985},
18
+ * // {movie: "Out of Africa", year: 1985},
19
+ * // {movie: "Donnie Darko", year: 2001}
20
+ * // ]
21
+ * ```
22
+ * @example
23
+ * ```javascript
24
+ * bbn.fn.move([1, 2, 3, 4], 3, 0);
25
+ * // [4, 1, 2, 3]
26
+ * ```
27
+ * @memberof bbn.fn
28
+ * @param {Array} arr The array
29
+ * @param {Number} fromIndex The index of the element to move
30
+ * @param {Number} toIndex The future index of the element
31
+ * @returns {Array} The same array, with elements repositionned.
32
+ */
33
+ const move = function (arr, fromIndex, toIndex) {
34
+ if (toIndex >= arr.length) {
35
+ let k = toIndex - arr.length;
36
+ while (k-- + 1) {
37
+ arr.push(undefined);
38
+ }
39
+ }
40
+ arr.splice(toIndex, 0, arr.splice(fromIndex, 1)[0]);
41
+ return arr;
42
+ };
43
+ export { move };
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Sorts an array of objects based on a set of properties.
3
+ *
4
+ * The resulting array is the same object, the order is based on _compareValues function
5
+ * applied for each given properties in orders argument.
6
+ *
7
+ * @method multiorder
8
+ * @global
9
+ * @example
10
+ * ```javascript
11
+ * let ar = [
12
+ * {movie: "Brazil", year: 1985},
13
+ * {movie: "Donnie Darko", year: 2001},
14
+ * {movie: "Out of Africa", year: 1985},
15
+ * {movie: "Ran", year: 1985},
16
+ * {movie: "Back to the future", year: 1985},
17
+ * {movie: "Barry Lindon", year: 1976}
18
+ * ];
19
+ * bbn.fn.multiorder(ar, [
20
+ * {field: "year", dir: "desc"},
21
+ * {field: "movie", dir: "asc"}
22
+ * ]);
23
+ * // [
24
+ * // {movie: "Donnie Darko", year: 2001},
25
+ * // {movie: "Back to the future", year: 1985},
26
+ * // {movie: "Brazil", year: 1985},
27
+ * // {movie: "Out of Africa", year: 1985},
28
+ * // {movie: "Ran", year: 1985},
29
+ * // {movie: "Barry Lindon", year: 1976}
30
+ * // ]
31
+ * bbn.fn.multiorder(ar, {year: "desc", movie: "asc"});
32
+ * // Same result with object shortcut
33
+ * ```
34
+ * @memberof bbn.fn
35
+ * @param {Array} arr The array to order
36
+ * @param {Array|Object} orders The properties and directions (asc, desc) to order by
37
+ * @returns {Array} The same array (arr), ordered differently
38
+ */
39
+ declare const multiorder: (arr: object[], orders: object | BbnOrderItem[]) => object[];
40
+ export { multiorder };
@@ -0,0 +1,60 @@
1
+ import { _compareValues } from './_compareValues';
2
+ /**
3
+ * Sorts an array of objects based on a set of properties.
4
+ *
5
+ * The resulting array is the same object, the order is based on _compareValues function
6
+ * applied for each given properties in orders argument.
7
+ *
8
+ * @method multiorder
9
+ * @global
10
+ * @example
11
+ * ```javascript
12
+ * let ar = [
13
+ * {movie: "Brazil", year: 1985},
14
+ * {movie: "Donnie Darko", year: 2001},
15
+ * {movie: "Out of Africa", year: 1985},
16
+ * {movie: "Ran", year: 1985},
17
+ * {movie: "Back to the future", year: 1985},
18
+ * {movie: "Barry Lindon", year: 1976}
19
+ * ];
20
+ * bbn.fn.multiorder(ar, [
21
+ * {field: "year", dir: "desc"},
22
+ * {field: "movie", dir: "asc"}
23
+ * ]);
24
+ * // [
25
+ * // {movie: "Donnie Darko", year: 2001},
26
+ * // {movie: "Back to the future", year: 1985},
27
+ * // {movie: "Brazil", year: 1985},
28
+ * // {movie: "Out of Africa", year: 1985},
29
+ * // {movie: "Ran", year: 1985},
30
+ * // {movie: "Barry Lindon", year: 1976}
31
+ * // ]
32
+ * bbn.fn.multiorder(ar, {year: "desc", movie: "asc"});
33
+ * // Same result with object shortcut
34
+ * ```
35
+ * @memberof bbn.fn
36
+ * @param {Array} arr The array to order
37
+ * @param {Array|Object} orders The properties and directions (asc, desc) to order by
38
+ * @returns {Array} The same array (arr), ordered differently
39
+ */
40
+ const multiorder = function (arr, orders) {
41
+ let currentOrders;
42
+ if (!Array.isArray(orders) && typeof orders === 'object') {
43
+ currentOrders = [];
44
+ for (var n in orders) {
45
+ currentOrders.push({ field: n, dir: orders[n] });
46
+ }
47
+ }
48
+ let r = arr.slice();
49
+ return r.sort((a, b) => {
50
+ let res;
51
+ for (let order of currentOrders) {
52
+ res = _compareValues(a, b, order.field, order.dir);
53
+ if (res !== 0) {
54
+ return res;
55
+ }
56
+ }
57
+ return 0;
58
+ });
59
+ };
60
+ export { multiorder };
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Returns the number of properties contained in the object.
3
+ *
4
+ * Only takes into account the own properties - not the inherited ones - and the non _private_ ones.
5
+ *
6
+ * @method numProperties
7
+ * @global
8
+ * @example
9
+ * ```javascript
10
+ * bbn.fn.numProperties({author: "Chuck Palahniuk", "title": "Fight club"});
11
+ * // 2
12
+ * ```
13
+ * @example
14
+ * ```javascript
15
+ * bbn.fn.numProperties({username: "chuck", "password": "soap", _bbn_timestamp: 1587323193751});
16
+ * // 2
17
+ * @example
18
+ * ```javascript
19
+ * let d = new Date();
20
+ * bbn.fn.numProperties(d);
21
+ * // 0
22
+ * d.myProp = 1;
23
+ * bbn.fn.numProperties(d);
24
+ * // 1
25
+ * ```
26
+ * @memberof bbn.fn
27
+ * @param {Object} obj The object to analyze
28
+ * @returns {Number} The number of properties
29
+ */
30
+ declare const numProperties: (obj: object) => number;
31
+ export { numProperties };
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Returns the number of properties contained in the object.
3
+ *
4
+ * Only takes into account the own properties - not the inherited ones - and the non _private_ ones.
5
+ *
6
+ * @method numProperties
7
+ * @global
8
+ * @example
9
+ * ```javascript
10
+ * bbn.fn.numProperties({author: "Chuck Palahniuk", "title": "Fight club"});
11
+ * // 2
12
+ * ```
13
+ * @example
14
+ * ```javascript
15
+ * bbn.fn.numProperties({username: "chuck", "password": "soap", _bbn_timestamp: 1587323193751});
16
+ * // 2
17
+ * @example
18
+ * ```javascript
19
+ * let d = new Date();
20
+ * bbn.fn.numProperties(d);
21
+ * // 0
22
+ * d.myProp = 1;
23
+ * bbn.fn.numProperties(d);
24
+ * // 1
25
+ * ```
26
+ * @memberof bbn.fn
27
+ * @param {Object} obj The object to analyze
28
+ * @returns {Number} The number of properties
29
+ */
30
+ const numProperties = function (obj) {
31
+ if (!obj || typeof obj !== 'object') {
32
+ return 0;
33
+ }
34
+ return Object.keys(obj).length;
35
+ };
36
+ export { numProperties };
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Sorts an array of objects based on the given property.
3
+ *
4
+ * The resulting array is the same object, the order is based on _compareValues function.
5
+ *
6
+ * @method order
7
+ * @global
8
+ * @example
9
+ * ```javascript
10
+ * bbn.fn.order([
11
+ * {movie: "Brazil", year: 1985},
12
+ * {movie: "Donnie Darko", year: 2001},
13
+ * {movie: "Barry Lindon", year: 1976}
14
+ * ], 'year', 'DESC')
15
+ * // [
16
+ * // {movie: "Donnie Darko", year: 2001},
17
+ * // {movie: "Brazil", year: 1985},
18
+ * // {movie: "Barry Lindon", year: 1976}
19
+ * // ]
20
+ * ```
21
+ * @memberof bbn.fn
22
+ * @param {Array} arr The array to order
23
+ * @param {String} prop The property on which the order is based
24
+ * @param {String} [dir=asc] The direction of the order (desc or asc by default)
25
+ * @returns {Array}
26
+ */
27
+ declare const order: (arr: any, prop: any, dir?: string) => any;
28
+ export { order };
@@ -0,0 +1,36 @@
1
+ import { _compareValues } from './_compareValues';
2
+ /**
3
+ * Sorts an array of objects based on the given property.
4
+ *
5
+ * The resulting array is the same object, the order is based on _compareValues function.
6
+ *
7
+ * @method order
8
+ * @global
9
+ * @example
10
+ * ```javascript
11
+ * bbn.fn.order([
12
+ * {movie: "Brazil", year: 1985},
13
+ * {movie: "Donnie Darko", year: 2001},
14
+ * {movie: "Barry Lindon", year: 1976}
15
+ * ], 'year', 'DESC')
16
+ * // [
17
+ * // {movie: "Donnie Darko", year: 2001},
18
+ * // {movie: "Brazil", year: 1985},
19
+ * // {movie: "Barry Lindon", year: 1976}
20
+ * // ]
21
+ * ```
22
+ * @memberof bbn.fn
23
+ * @param {Array} arr The array to order
24
+ * @param {String} prop The property on which the order is based
25
+ * @param {String} [dir=asc] The direction of the order (desc or asc by default)
26
+ * @returns {Array}
27
+ */
28
+ const order = function (arr, prop, dir = 'asc') {
29
+ if (arr) {
30
+ return arr.sort(function (a, b) {
31
+ return _compareValues(a, b, prop, dir);
32
+ });
33
+ }
34
+ return arr;
35
+ };
36
+ export { order };
@@ -0,0 +1,2 @@
1
+ declare const pickValue: (arr: any[]) => any;
2
+ export { pickValue };
@@ -0,0 +1,6 @@
1
+ const pickValue = function (arr) {
2
+ if (Array.isArray(arr) && arr.length) {
3
+ return arr[Math.floor(Math.random() * arr.length)];
4
+ }
5
+ };
6
+ export { pickValue };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Returns a new array, having removed all elements deemed empty from the given array.
3
+ *
4
+ * Removes all the elements which are empty, i.e. false, 0, null, '', NaN, or undefined.
5
+ *
6
+ * @method removeEmpty
7
+ * @global
8
+ * @example
9
+ * ```javascript
10
+ * bbn.fn.removeEmpty([{prop1: 10, prop2: 20}, '', {}, null, 1, undefined, 0, false, 25]);
11
+ * // [{prop1: 10, prop2: 20}, 1, 25]
12
+ * ```
13
+ * @memberof bbn.fn
14
+ * @param {Array} arr
15
+ * @returns {Array}
16
+ */
17
+ declare const removeEmpty: (arr: any[]) => any[];
18
+ export { removeEmpty };
@@ -0,0 +1,47 @@
1
+ import { isArray } from "../type/isArray";
2
+ import { isObject } from "../type/isObject";
3
+ import { numProperties } from "./numProperties";
4
+ /**
5
+ * Returns a new array, having removed all elements deemed empty from the given array.
6
+ *
7
+ * Removes all the elements which are empty, i.e. false, 0, null, '', NaN, or undefined.
8
+ *
9
+ * @method removeEmpty
10
+ * @global
11
+ * @example
12
+ * ```javascript
13
+ * bbn.fn.removeEmpty([{prop1: 10, prop2: 20}, '', {}, null, 1, undefined, 0, false, 25]);
14
+ * // [{prop1: 10, prop2: 20}, 1, 25]
15
+ * ```
16
+ * @memberof bbn.fn
17
+ * @param {Array} arr
18
+ * @returns {Array}
19
+ */
20
+ const removeEmpty = function (arr) {
21
+ var tmp = [];
22
+ if (isArray(arr)) {
23
+ for (let i = 0; i < arr.length; i++) {
24
+ let ok = false;
25
+ if (arr[i]) {
26
+ if (isArray(arr[i])) {
27
+ if (arr[i].length) {
28
+ ok = true;
29
+ }
30
+ }
31
+ else if (isObject(arr[i])) {
32
+ if (numProperties(arr[i])) {
33
+ ok = true;
34
+ }
35
+ }
36
+ else {
37
+ ok = true;
38
+ }
39
+ }
40
+ if (ok) {
41
+ tmp.push(arr[i]);
42
+ }
43
+ }
44
+ }
45
+ return tmp;
46
+ };
47
+ export { removeEmpty };
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Returns an object with the original objects' properties starting with an alphanumeric character.
3
+ *
4
+ * It is presumed that external libraries, bbn variables use prefixes such as _ or $ for
5
+ * naming private properties; this returns a new object purged from these properties.
6
+ *
7
+ * @method removePrivateProp
8
+ * @global
9
+ * @example
10
+ * ```javascript
11
+ * bbn.fn.removePrivateProp({
12
+ * _bbn_timestamp: 1587269593987,
13
+ * name: "Wonka",
14
+ * fname: "Willy"
15
+ * });
16
+ * // {name: "Wonka", fname: "Willy"}
17
+ * ```
18
+ * @memberof bbn.fn
19
+ * @param {Object} obj The original object
20
+ * @param {Boolean} deep If true the function will be reapplied on object properties
21
+ * @returns {Object} A new object without only the _public_ properties.
22
+ */
23
+ declare const removePrivateProp: (obj: object, deep?: boolean) => any;
24
+ export { removePrivateProp };