@bbn/bbn 1.0.25 → 1.0.26

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 (276) hide show
  1. package/dist/bundle.d.ts +224 -238
  2. package/dist/bundle.js +939 -906
  3. package/dist/fn/_addLoader.js +1 -1
  4. package/dist/fn/_deleteLoader.d.ts +1 -1
  5. package/dist/fn/_deleteLoader.js +2 -2
  6. package/dist/fn/abort.js +4 -4
  7. package/dist/fn/abortURL.js +2 -2
  8. package/dist/fn/addColors.d.ts +1 -1
  9. package/dist/fn/addColors.js +23 -6
  10. package/dist/fn/addInputs.d.ts +1 -2
  11. package/dist/fn/addInputs.js +4 -5
  12. package/dist/fn/adjustHeight.js +1 -1
  13. package/dist/fn/adjustSize.js +1 -1
  14. package/dist/fn/adjustWidth.js +1 -1
  15. package/dist/fn/ajax.d.ts +1 -1
  16. package/dist/fn/ajax.js +8 -7
  17. package/dist/fn/analyzeFunction.js +5 -5
  18. package/dist/fn/animateCss.js +8 -7
  19. package/dist/fn/baseName.d.ts +1 -1
  20. package/dist/fn/baseName.js +1 -1
  21. package/dist/fn/br2nl.d.ts +1 -1
  22. package/dist/fn/br2nl.js +1 -1
  23. package/dist/fn/calendar.js +1 -1
  24. package/dist/fn/callback.d.ts +1 -1
  25. package/dist/fn/callback.js +5 -5
  26. package/dist/fn/camelToCss.js +4 -2
  27. package/dist/fn/canvasToImage.js +1 -1
  28. package/dist/fn/center.js +3 -5
  29. package/dist/fn/checkProps.d.ts +1 -1
  30. package/dist/fn/checkProps.js +1 -1
  31. package/dist/fn/checkPropsDetails.d.ts +1 -4
  32. package/dist/fn/checkPropsDetails.js +10 -11
  33. package/dist/fn/checkPropsOrDie.d.ts +1 -1
  34. package/dist/fn/checkPropsOrDie.js +1 -1
  35. package/dist/fn/checkType.d.ts +1 -1
  36. package/dist/fn/checkType.js +3 -3
  37. package/dist/fn/chrono.d.ts +3 -0
  38. package/dist/fn/chrono.js +23 -0
  39. package/dist/fn/circularReplacer.js +2 -2
  40. package/dist/fn/clone.d.ts +0 -1
  41. package/dist/fn/clone.js +1 -1
  42. package/dist/fn/colorToHex.js +1 -1
  43. package/dist/fn/compare.js +44 -44
  44. package/dist/fn/compareConditions.d.ts +0 -1
  45. package/dist/fn/compareConditions.js +3 -3
  46. package/dist/fn/copy.js +9 -9
  47. package/dist/fn/correctCase.js +1 -1
  48. package/dist/fn/count.d.ts +1 -1
  49. package/dist/fn/count.js +2 -2
  50. package/dist/fn/crc32.js +11 -3
  51. package/dist/fn/createObject.d.ts +1 -1
  52. package/dist/fn/createObject.js +3 -3
  53. package/dist/fn/cssExists.js +7 -4
  54. package/dist/fn/date.js +5 -5
  55. package/dist/fn/dateSQL.js +4 -3
  56. package/dist/fn/deepPath.d.ts +1 -2
  57. package/dist/fn/defaultAjaxAbortFunction.d.ts +1 -1
  58. package/dist/fn/defaultAjaxAbortFunction.js +1 -1
  59. package/dist/fn/defaultAjaxErrorFunction.d.ts +1 -1
  60. package/dist/fn/defaultAjaxErrorFunction.js +0 -12
  61. package/dist/fn/defaultAlertFunction.d.ts +1 -1
  62. package/dist/fn/defaultAlertFunction.js +2 -3
  63. package/dist/fn/defaultConfirmFunction.d.ts +1 -1
  64. package/dist/fn/defaultEndLoadingFunction.d.ts +1 -1
  65. package/dist/fn/defaultEndLoadingFunction.js +1 -17
  66. package/dist/fn/defaultPostLinkFunction.d.ts +1 -1
  67. package/dist/fn/defaultPostLinkFunction.js +1 -1
  68. package/dist/fn/defaultPreLinkFunction.d.ts +1 -1
  69. package/dist/fn/defaultPreLinkFunction.js +2 -10
  70. package/dist/fn/defaultStartLoadingFunction.d.ts +1 -1
  71. package/dist/fn/defaultStartLoadingFunction.js +2 -13
  72. package/dist/fn/deleteProp.d.ts +1 -1
  73. package/dist/fn/deleteProp.js +3 -2
  74. package/dist/fn/diffObj.d.ts +1 -2
  75. package/dist/fn/diffObj.js +13 -14
  76. package/dist/fn/dirName.d.ts +1 -1
  77. package/dist/fn/download.d.ts +1 -1
  78. package/dist/fn/download.js +3 -5
  79. package/dist/fn/downloadContent.d.ts +1 -1
  80. package/dist/fn/each.js +1 -1
  81. package/dist/fn/error.js +2 -2
  82. package/dist/fn/escapeRegExp.js +1 -1
  83. package/dist/fn/escapeTicks.js +1 -1
  84. package/dist/fn/escapeUrl.js +1 -1
  85. package/dist/fn/extend.d.ts +1 -2
  86. package/dist/fn/extend.js +11 -11
  87. package/dist/fn/extendOut.d.ts +1 -2
  88. package/dist/fn/extendOut.js +3 -3
  89. package/dist/fn/fdate.d.ts +1 -1
  90. package/dist/fn/fdatetime.d.ts +1 -1
  91. package/dist/fn/fdatetime.js +1 -1
  92. package/dist/fn/fieldValue.js +2 -2
  93. package/dist/fn/fileExt.js +1 -1
  94. package/dist/fn/filter.d.ts +1 -2
  95. package/dist/fn/filter.js +13 -12
  96. package/dist/fn/filterToConditions.d.ts +11 -3
  97. package/dist/fn/filterToConditions.js +6 -6
  98. package/dist/fn/findAll.d.ts +0 -1
  99. package/dist/fn/findAll.js +1 -1
  100. package/dist/fn/fori.d.ts +1 -1
  101. package/dist/fn/fori.js +2 -2
  102. package/dist/fn/forir.d.ts +1 -1
  103. package/dist/fn/forir.js +2 -2
  104. package/dist/fn/formdata.d.ts +1 -1
  105. package/dist/fn/formdata.js +12 -13
  106. package/dist/fn/fromXml.js +6 -6
  107. package/dist/fn/ftime.js +1 -1
  108. package/dist/fn/getAllTags.d.ts +1 -1
  109. package/dist/fn/getAllTags.js +1 -1
  110. package/dist/fn/getAncestors.d.ts +1 -1
  111. package/dist/fn/getAncestors.js +7 -8
  112. package/dist/fn/getAttributes.js +2 -2
  113. package/dist/fn/getBrowserName.js +9 -9
  114. package/dist/fn/getBrowserVersion.js +2 -2
  115. package/dist/fn/getCookie.js +1 -1
  116. package/dist/fn/getDeviceType.js +3 -3
  117. package/dist/fn/getEventData.js +11 -8
  118. package/dist/fn/getField.d.ts +1 -1
  119. package/dist/fn/getField.js +4 -3
  120. package/dist/fn/getFieldValues.d.ts +1 -1
  121. package/dist/fn/getFieldValues.js +2 -2
  122. package/dist/fn/getHTMLOfSelection.d.ts +1 -1
  123. package/dist/fn/getHTMLOfSelection.js +9 -19
  124. package/dist/fn/getLoader.d.ts +1 -1
  125. package/dist/fn/getPath.d.ts +1 -1
  126. package/dist/fn/getPath.js +4 -4
  127. package/dist/fn/getProp.js +3 -2
  128. package/dist/fn/getProperty.js +1 -1
  129. package/dist/fn/getRow.d.ts +1 -1
  130. package/dist/fn/getRow.js +1 -1
  131. package/dist/fn/getScrollBarSize.js +9 -7
  132. package/dist/fn/getText.d.ts +1 -1
  133. package/dist/fn/getTimeoff.js +1 -1
  134. package/dist/fn/happy.js +1 -1
  135. package/dist/fn/hash.d.ts +1 -1
  136. package/dist/fn/hash.js +1 -1
  137. package/dist/fn/hex2rgb.js +7 -5
  138. package/dist/fn/html2text.d.ts +1 -1
  139. package/dist/fn/imageToCanvas.js +2 -2
  140. package/dist/fn/imgToBase64.d.ts +1 -1
  141. package/dist/fn/imgToBase64.js +3 -3
  142. package/dist/fn/info.js +1 -1
  143. package/dist/fn/init.js +29 -29
  144. package/dist/fn/isActiveInterface.js +2 -2
  145. package/dist/fn/isColor.d.ts +1 -1
  146. package/dist/fn/isColor.js +11 -4
  147. package/dist/fn/isCp.js +7 -7
  148. package/dist/fn/isDimension.d.ts +1 -1
  149. package/dist/fn/isDimension.js +11 -4
  150. package/dist/fn/isEmail.d.ts +1 -1
  151. package/dist/fn/isEmail.js +11 -4
  152. package/dist/fn/isEmpty.js +1 -1
  153. package/dist/fn/isFocused.d.ts +1 -1
  154. package/dist/fn/isFocused.js +1 -1
  155. package/dist/fn/isHostname.js +1 -1
  156. package/dist/fn/isIP.js +1 -1
  157. package/dist/fn/isInside.js +1 -1
  158. package/dist/fn/isIterable.js +1 -1
  159. package/dist/fn/isNumber.js +1 -1
  160. package/dist/fn/isPercent.js +1 -1
  161. package/dist/fn/isPrimitive.js +1 -1
  162. package/dist/fn/isPropSize.js +1 -1
  163. package/dist/fn/isSQLDate.js +1 -1
  164. package/dist/fn/isSame.d.ts +1 -2
  165. package/dist/fn/isSame.js +3 -3
  166. package/dist/fn/isURL.js +1 -1
  167. package/dist/fn/isValidDimension.js +2 -3
  168. package/dist/fn/isValue.js +1 -1
  169. package/dist/fn/isVue.d.ts +1 -1
  170. package/dist/fn/isVue.js +5 -5
  171. package/dist/fn/iterate.d.ts +1 -1
  172. package/dist/fn/iterate.js +3 -3
  173. package/dist/fn/lightenDarkenHex.js +2 -2
  174. package/dist/fn/link.d.ts +1 -2
  175. package/dist/fn/link.js +17 -19
  176. package/dist/fn/log.js +4 -4
  177. package/dist/fn/makeReactive.d.ts +0 -1
  178. package/dist/fn/makeReactive.js +35 -23
  179. package/dist/fn/map.d.ts +0 -1
  180. package/dist/fn/md5.js +30 -10
  181. package/dist/fn/money.d.ts +1 -1
  182. package/dist/fn/money.js +47 -34
  183. package/dist/fn/move.d.ts +1 -1
  184. package/dist/fn/move.js +1 -1
  185. package/dist/fn/multiorder.d.ts +1 -1
  186. package/dist/fn/multiorder.js +5 -5
  187. package/dist/fn/nl2br.d.ts +1 -1
  188. package/dist/fn/nl2br.js +1 -1
  189. package/dist/fn/numProperties.d.ts +1 -1
  190. package/dist/fn/numProperties.js +1 -1
  191. package/dist/fn/objectToFormData.d.ts +1 -1
  192. package/dist/fn/objectToFormData.js +3 -3
  193. package/dist/fn/outerHeight.d.ts +1 -1
  194. package/dist/fn/outerHeight.js +5 -4
  195. package/dist/fn/outerWidth.d.ts +1 -1
  196. package/dist/fn/outerWidth.js +1 -2
  197. package/dist/fn/pickValue.d.ts +1 -1
  198. package/dist/fn/post.d.ts +1 -1
  199. package/dist/fn/post.js +3 -3
  200. package/dist/fn/postOut.d.ts +1 -1
  201. package/dist/fn/postOut.js +2 -2
  202. package/dist/fn/printf.js +1 -3
  203. package/dist/fn/quotes2html.d.ts +1 -1
  204. package/dist/fn/quotes2html.js +3 -3
  205. package/dist/fn/randomInt.d.ts +1 -1
  206. package/dist/fn/randomString.d.ts +1 -1
  207. package/dist/fn/randomString.js +9 -8
  208. package/dist/fn/removeAccents.d.ts +1 -1
  209. package/dist/fn/removeAccents.js +1 -1
  210. package/dist/fn/removeEmpty.d.ts +1 -1
  211. package/dist/fn/removeExtraSpaces.d.ts +1 -1
  212. package/dist/fn/removeHtmlComments.d.ts +1 -1
  213. package/dist/fn/removePrivateProp.d.ts +1 -2
  214. package/dist/fn/removePrivateProp.js +6 -6
  215. package/dist/fn/removeTrailingChars.d.ts +1 -1
  216. package/dist/fn/repeat.d.ts +1 -1
  217. package/dist/fn/repeat.js +1 -6
  218. package/dist/fn/replaceAll.d.ts +1 -1
  219. package/dist/fn/replaceAll.js +1 -4
  220. package/dist/fn/replaceSelection.js +1 -1
  221. package/dist/fn/resize.js +9 -7
  222. package/dist/fn/rgb2hex.js +6 -4
  223. package/dist/fn/riterate.d.ts +1 -1
  224. package/dist/fn/roundDecimal.d.ts +1 -1
  225. package/dist/fn/roundDecimal.js +1 -1
  226. package/dist/fn/sanitize.js +3 -1
  227. package/dist/fn/search.d.ts +2 -1
  228. package/dist/fn/search.js +24 -21
  229. package/dist/fn/selectElementText.d.ts +1 -1
  230. package/dist/fn/selectElementText.js +1 -1
  231. package/dist/fn/selector.d.ts +1 -1
  232. package/dist/fn/selector.js +1 -1
  233. package/dist/fn/setCookie.js +4 -4
  234. package/dist/fn/setCssVar.js +2 -1
  235. package/dist/fn/setNavigationVars.d.ts +1 -1
  236. package/dist/fn/setNavigationVars.js +6 -5
  237. package/dist/fn/setProp.d.ts +1 -1
  238. package/dist/fn/setProp.js +1 -3
  239. package/dist/fn/setProperty.d.ts +1 -1
  240. package/dist/fn/setProperty.js +2 -2
  241. package/dist/fn/shorten.d.ts +1 -1
  242. package/dist/fn/shorten.js +3 -3
  243. package/dist/fn/shortenObj.d.ts +1 -2
  244. package/dist/fn/shortenObj.js +2 -2
  245. package/dist/fn/shuffle.d.ts +1 -1
  246. package/dist/fn/shuffle.js +1 -3
  247. package/dist/fn/simpleHash.d.ts +1 -1
  248. package/dist/fn/simpleHash1.d.ts +1 -1
  249. package/dist/fn/simpleHash1.js +1 -1
  250. package/dist/fn/simpleHash2.d.ts +1 -1
  251. package/dist/fn/stat.d.ts +1 -1
  252. package/dist/fn/stat.js +8 -8
  253. package/dist/fn/string2ArrayBuffer.d.ts +1 -1
  254. package/dist/fn/submit.d.ts +1 -1
  255. package/dist/fn/submit.js +6 -21
  256. package/dist/fn/substr.d.ts +1 -1
  257. package/dist/fn/substr.js +1 -1
  258. package/dist/fn/sum.d.ts +1 -1
  259. package/dist/fn/sum.js +2 -3
  260. package/dist/fn/timestamp.d.ts +1 -1
  261. package/dist/fn/timestamp.js +1 -1
  262. package/dist/fn/toCSV.d.ts +1 -1
  263. package/dist/fn/toCSV.js +1 -1
  264. package/dist/fn/toggleFullScreen.js +13 -13
  265. package/dist/fn/translate.d.ts +1 -1
  266. package/dist/fn/treatAjaxArguments.d.ts +1 -1
  267. package/dist/fn/treatAjaxArguments.js +16 -14
  268. package/dist/fn/uniqString.js +3 -3
  269. package/dist/fn/unique.d.ts +1 -1
  270. package/dist/fn/upload.d.ts +1 -1
  271. package/dist/fn/upload.js +6 -6
  272. package/dist/fn/warning.d.ts +1 -1
  273. package/dist/fn/warning.js +6 -6
  274. package/dist/index.d.ts +106 -108
  275. package/dist/index.js +5 -6
  276. package/package.json +3 -1
package/dist/fn/money.js CHANGED
@@ -1,53 +1,66 @@
1
1
  import { isNumber } from './isNumber';
2
2
  const money = function (val, kilo, currency, novalue, decimal, thousands, precision) {
3
3
  /*
4
- money(val, kilo){
5
- let decimal = ',',
6
- currency = '€',
7
- thousands = ' ';
8
- if ( (isNaN(val) || !val) ){
9
- return '-';
10
- }
11
- if ( isNaN(val) || !val ){
12
- return 0;
13
- }
14
- if ( kilo && val ){
15
- val = val / 1000;
16
- if ( currency ){
17
- currency = 'K' + currency;
4
+ money(val, kilo){
5
+ let decimal = ',',
6
+ currency = '€',
7
+ thousands = ' ';
8
+ if ( (isNaN(val) || !val) ){
9
+ return '-';
18
10
  }
19
- }
20
- return parseFloat(val).toFixed(0).replace(/./g, function(c, i, a) {
21
- if ( c === '.' ){
22
- return decimal;
11
+ if ( isNaN(val) || !val ){
12
+ return 0;
23
13
  }
24
- return i && ((a.length - i) % 3 === 0) ? thousands + c : c;
25
- }) + ( currency ? ' ' + currency : '');
26
- },
14
+ if ( kilo && val ){
15
+ val = val / 1000;
16
+ if ( currency ){
17
+ currency = 'K' + currency;
18
+ }
19
+ }
20
+ return parseFloat(val).toFixed(0).replace(/./g, function(c, i, a) {
21
+ if ( c === '.' ){
22
+ return decimal;
23
+ }
24
+ return i && ((a.length - i) % 3 === 0) ? thousands + c : c;
25
+ }) + ( currency ? ' ' + currency : '');
26
+ },
27
27
 
28
- */
28
+ */
29
29
  if (!decimal) {
30
- decimal = (decimal === undefined) && bbn.env.money && (bbn.env.money.decimal !== undefined) ? bbn.env.money.decimal : '.';
30
+ decimal =
31
+ decimal === undefined && bbn.env.money && bbn.env.money.decimal !== undefined ? bbn.env.money.decimal : '.';
31
32
  }
32
33
  if (!currency) {
33
- currency = (currency === undefined) && bbn.env.money && (bbn.env.money.currency !== undefined) ? bbn.env.money.currency : '';
34
+ currency =
35
+ currency === undefined && bbn.env.money && bbn.env.money.currency !== undefined
36
+ ? bbn.env.money.currency
37
+ : '';
34
38
  }
35
39
  if (!thousands) {
36
- thousands = (thousands === undefined) && bbn.env.money && (bbn.env.money.thousands !== undefined) ? bbn.env.money.thousands : ' ';
40
+ thousands =
41
+ thousands === undefined && bbn.env.money && bbn.env.money.thousands !== undefined
42
+ ? bbn.env.money.thousands
43
+ : ' ';
37
44
  }
38
45
  if (!precision) {
39
- precision = (precision === undefined) && bbn.env.money && (bbn.env.money.precision !== undefined) ? bbn.env.money.precision : false;
46
+ precision =
47
+ precision === undefined && bbn.env.money && bbn.env.money.precision !== undefined
48
+ ? bbn.env.money.precision
49
+ : 0;
40
50
  }
41
51
  if (!kilo) {
42
- kilo = (kilo === undefined) && bbn.env.money && (bbn.env.money.kilo !== undefined) ? bbn.env.money.kilo : false;
52
+ kilo = kilo === undefined && bbn.env.money && bbn.env.money.kilo !== undefined ? bbn.env.money.kilo : false;
43
53
  }
44
54
  if (!novalue) {
45
- novalue = (novalue === undefined) && bbn.env.money && (bbn.env.money.novalue !== undefined) ? bbn.env.money.novalue : false;
55
+ novalue =
56
+ novalue === undefined && bbn.env.money && bbn.env.money.novalue !== undefined
57
+ ? bbn.env.money.novalue
58
+ : false;
46
59
  }
47
60
  if (!isNumber(precision)) {
48
61
  precision = kilo ? 3 : 0;
49
62
  }
50
- if (val === 0) {
63
+ if ((val === 0) && (typeof precision === 'number') && (precision > 0)) {
51
64
  let res = val.toFixed(precision).replace('.', decimal);
52
65
  if (currency) {
53
66
  res += ' ' + (kilo ? 'K' + currency : currency);
@@ -58,7 +71,7 @@ const money = function (val, kilo, currency, novalue, decimal, thousands, precis
58
71
  return novalue;
59
72
  }
60
73
  if (isNaN(val) || !val) {
61
- return 0 + (currency ? (' ' + currency) : '');
74
+ return 0 + (currency ? ' ' + currency : '');
62
75
  }
63
76
  if (kilo && val) {
64
77
  val = val / 1000;
@@ -66,7 +79,7 @@ const money = function (val, kilo, currency, novalue, decimal, thousands, precis
66
79
  currency = 'K' + currency;
67
80
  }
68
81
  }
69
- let v = parseFloat(val).toFixed(precision);
82
+ let v = val.toFixed(precision);
70
83
  let decimalPosition = 0;
71
84
  let decimalIdx = 10000;
72
85
  if (v) {
@@ -78,11 +91,11 @@ const money = function (val, kilo, currency, novalue, decimal, thousands, precis
78
91
  decimalPosition = v.length - decimalIdx;
79
92
  }
80
93
  }
81
- return v.replace(/./g, function (c, i, a) {
94
+ return (v.replace(/./g, function (c, i, a) {
82
95
  if (c === '.') {
83
96
  return decimal;
84
97
  }
85
- return i && ((a.length - i - decimalPosition) % 3 === 0) && (i < decimalIdx) ? thousands + c : c;
86
- }) + (currency ? ' ' + currency : '');
98
+ return i && (a.length - i - decimalPosition) % 3 === 0 && i < decimalIdx ? thousands + c : c;
99
+ }) + (currency ? ' ' + currency : ''));
87
100
  };
88
101
  export { money };
package/dist/fn/move.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const move: (arr: any, fromIndex: any, toIndex: any) => any;
1
+ declare const move: (arr: any[], fromIndex: number, toIndex: number) => any[];
2
2
  export { move };
package/dist/fn/move.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const move = function (arr, fromIndex, toIndex) {
2
2
  if (toIndex >= arr.length) {
3
3
  let k = toIndex - arr.length;
4
- while ((k--) + 1) {
4
+ while (k-- + 1) {
5
5
  arr.push(undefined);
6
6
  }
7
7
  }
@@ -1,2 +1,2 @@
1
- declare const multiorder: (arr: any, orders: any) => any;
1
+ declare const multiorder: (arr: object[], orders: object | BbnOrderItem[]) => object[];
2
2
  export { multiorder };
@@ -1,16 +1,16 @@
1
1
  import { _compareValues } from './_compareValues';
2
2
  const multiorder = function (arr, orders) {
3
- if (!Array.isArray(orders) && (typeof orders === 'object')) {
4
- let tmp = [];
3
+ let currentOrders;
4
+ if (!Array.isArray(orders) && typeof orders === 'object') {
5
+ currentOrders = [];
5
6
  for (var n in orders) {
6
- tmp.push({ field: n, dir: orders[n] });
7
+ currentOrders.push({ field: n, dir: orders[n] });
7
8
  }
8
- orders = tmp;
9
9
  }
10
10
  let r = arr.slice();
11
11
  return r.sort((a, b) => {
12
12
  let res;
13
- for (let order of orders) {
13
+ for (let order of currentOrders) {
14
14
  res = _compareValues(a, b, order.field, order.dir);
15
15
  if (res !== 0) {
16
16
  return res;
@@ -1,2 +1,2 @@
1
- declare const nl2br: (st: any, keepNl: any) => any;
1
+ declare const nl2br: (st: any, keepNl: any) => string;
2
2
  export { nl2br };
package/dist/fn/nl2br.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { replaceAll } from './replaceAll';
2
2
  const nl2br = function (st, keepNl) {
3
- return replaceAll("\n", "<br>" + (keepNl ? "\n" : ""), st);
3
+ return replaceAll('\n', '<br>' + (keepNl ? '\n' : ''), st);
4
4
  };
5
5
  export { nl2br };
@@ -1,2 +1,2 @@
1
- declare const numProperties: (obj: any) => number;
1
+ declare const numProperties: (obj: object) => number;
2
2
  export { numProperties };
@@ -1,5 +1,5 @@
1
1
  const numProperties = function (obj) {
2
- if (!obj || (typeof obj !== 'object')) {
2
+ if (!obj || typeof obj !== 'object') {
3
3
  return 0;
4
4
  }
5
5
  return Object.keys(obj).length;
@@ -1,2 +1,2 @@
1
- declare const objectToFormData: (obj: any, key: any, ignoreList: any) => FormData;
1
+ declare const objectToFormData: (obj: object, key?: string, ignoreList?: string[]) => FormData;
2
2
  export { objectToFormData };
@@ -3,7 +3,7 @@ import { each } from './each';
3
3
  import { isObject } from './isObject';
4
4
  import { iterate } from './iterate';
5
5
  import { isNull } from './isNull';
6
- const objectToFormData = function (obj, key, ignoreList) {
6
+ const objectToFormData = function (obj, key = '', ignoreList) {
7
7
  let formData = new FormData();
8
8
  let appendFormData = (data, key = '') => {
9
9
  if (!ignoreList || (isArray(ignoreList) && !ignoreList.includes(key))) {
@@ -17,13 +17,13 @@ const objectToFormData = function (obj, key, ignoreList) {
17
17
  }
18
18
  else if (isObject(data) && Object.keys(data).length) {
19
19
  iterate(data, (v, i) => {
20
- if (Object.hasOwn(data, i)) {
20
+ if (i in data) {
21
21
  appendFormData(v, !key ? i : key + '[' + i + ']');
22
22
  }
23
23
  });
24
24
  }
25
25
  else {
26
- if (!isNull(data) && (data !== undefined)) {
26
+ if (!isNull(data) && data !== undefined) {
27
27
  formData.append(key, data);
28
28
  }
29
29
  }
@@ -1,2 +1,2 @@
1
- declare const outerHeight: (ele: any) => number;
1
+ declare const outerHeight: (ele: HTMLElement) => number | false;
2
2
  export { outerHeight };
@@ -1,9 +1,10 @@
1
1
  import { selector } from './selector';
2
2
  const outerHeight = function (ele) {
3
3
  ele = selector(ele);
4
- let styles = window.getComputedStyle(ele);
5
- let margin = parseFloat(styles['marginTop']) +
6
- parseFloat(styles['marginBottom']);
7
- return Math.ceil(ele.offsetHeight + margin);
4
+ if (ele && ('offsetHeight' in ele)) {
5
+ let styles = window.getComputedStyle(ele);
6
+ let margin = parseFloat(styles['marginTop']) + parseFloat(styles['marginBottom']);
7
+ return Math.ceil(ele.offsetHeight + margin);
8
+ }
8
9
  };
9
10
  export { outerHeight };
@@ -1,2 +1,2 @@
1
- declare const outerWidth: (ele: any) => number;
1
+ declare const outerWidth: (ele: HTMLElement) => number | false;
2
2
  export { outerWidth };
@@ -2,8 +2,7 @@ import { selector } from './selector';
2
2
  const outerWidth = function (ele) {
3
3
  ele = selector(ele);
4
4
  let styles = window.getComputedStyle(ele);
5
- let margin = parseFloat(styles['marginLeft']) +
6
- parseFloat(styles['marginRight']);
5
+ let margin = parseFloat(styles['marginLeft']) + parseFloat(styles['marginRight']);
7
6
  return Math.ceil(ele.offsetWidth + margin);
8
7
  };
9
8
  export { outerWidth };
@@ -1,2 +1,2 @@
1
- declare const pickValue: (arr: any) => any;
1
+ declare const pickValue: (arr: any[]) => any;
2
2
  export { pickValue };
package/dist/fn/post.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const post: () => any;
1
+ declare const post: (...args: any[]) => any;
2
2
  export { post };
package/dist/fn/post.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import { treatAjaxArguments } from './treatAjaxArguments';
2
2
  import { ajax } from './ajax';
3
3
  import { callback } from './callback';
4
- const post = function () {
5
- let cfg = treatAjaxArguments(arguments);
4
+ const post = function (...args) {
5
+ let cfg = treatAjaxArguments(args);
6
6
  if (cfg.url) {
7
7
  return ajax(cfg.url, cfg.datatype, cfg.obj, (res) => {
8
- callback(cfg.url, res, cfg.successFn, false, cfg.ele);
8
+ callback(cfg.url, res, cfg.successFn, null, cfg.ele);
9
9
  }, cfg.errorFn, cfg.abortFn);
10
10
  }
11
11
  };
@@ -1,2 +1,2 @@
1
- declare const postOut: (url: any, data: any, success: any, target: any) => void;
1
+ declare const postOut: (url: string, data: BbnBasicObject, success?: () => any, target?: string) => void;
2
2
  export { postOut };
@@ -1,7 +1,7 @@
1
1
  import { createObject } from './createObject';
2
2
  import { addInputs } from './addInputs';
3
3
  const postOut = function (url, data, success, target) {
4
- let form = document.getElementById("bbn-form_out");
4
+ let form = document.body.querySelector('form#bbn-form_out');
5
5
  if (!form) {
6
6
  form = document.createElement('form');
7
7
  form.classList.add('bbn-no');
@@ -13,7 +13,7 @@ const postOut = function (url, data, success, target) {
13
13
  }
14
14
  form.innerHTML = '';
15
15
  form.setAttribute('action', url);
16
- form.setAttribute('target', target || "_blank");
16
+ form.setAttribute('target', target || '_blank');
17
17
  if (!data) {
18
18
  data = {};
19
19
  }
package/dist/fn/printf.js CHANGED
@@ -1,9 +1,7 @@
1
1
  const printf = function (format) {
2
2
  var args = Array.prototype.slice.call(arguments, 1);
3
3
  return format.replace(/{(\d+)}/g, function (match, number) {
4
- return typeof args[number] != 'undefined'
5
- ? args[number]
6
- : match;
4
+ return typeof args[number] != 'undefined' ? args[number] : match;
7
5
  });
8
6
  };
9
7
  export { printf };
@@ -1,2 +1,2 @@
1
- declare const quotes2html: (st: any, type: any) => any;
1
+ declare const quotes2html: (st: string, type?: string) => string;
2
2
  export { quotes2html };
@@ -1,9 +1,9 @@
1
1
  import { replaceAll } from './replaceAll';
2
2
  const quotes2html = function (st, type) {
3
- if (!type || (type.toLowerCase().indexOf('s') === 0)) {
4
- st = replaceAll("'", "&#39;", st);
3
+ if (!type || type.toLowerCase().indexOf('s') === 0) {
4
+ st = replaceAll("'", '&#39;', st);
5
5
  }
6
- if (!type || (type.toLowerCase().indexOf('d') === 0)) {
6
+ if (!type || type.toLowerCase().indexOf('d') === 0) {
7
7
  st = replaceAll('"', '&quot;', st);
8
8
  }
9
9
  return st;
@@ -1,2 +1,2 @@
1
- declare const randomInt: (min: any, max: any) => number;
1
+ declare const randomInt: (min: number, max: number) => number;
2
2
  export { randomInt };
@@ -1,2 +1,2 @@
1
- declare const randomString: (min: any, max: any, types: any) => string;
1
+ declare const randomString: (min?: number, max?: string | number, types?: string) => string;
2
2
  export { randomString };
@@ -1,10 +1,11 @@
1
1
  import { randomInt } from './randomInt';
2
- import { isString } from './isString';
3
2
  const randomString = function (min, max, types) {
4
- let length, type, chars = {
3
+ let length;
4
+ let type;
5
+ let chars = {
5
6
  n: '0123456789',
6
7
  l: 'abcdefghijklmnopqrstuvwxyz',
7
- u: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
8
+ u: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
8
9
  };
9
10
  if (!types) {
10
11
  types = 'nlu';
@@ -12,16 +13,16 @@ const randomString = function (min, max, types) {
12
13
  if (!min) {
13
14
  length = randomInt(8, 14);
14
15
  }
15
- if (isString(max)) {
16
+ if (typeof max === 'string') {
16
17
  types = 'n';
17
- chars = {
18
- n: max
19
- };
18
+ delete chars.l;
19
+ delete chars.u;
20
+ chars.n = max;
20
21
  if (!length) {
21
22
  length = min;
22
23
  }
23
24
  }
24
- else if ((typeof (max) === 'number') && (min < max)) {
25
+ else if (typeof max === 'number' && min < max) {
25
26
  length = randomInt(min, max);
26
27
  }
27
28
  else if (min) {
@@ -1,2 +1,2 @@
1
- declare const removeAccents: (st: any) => any;
1
+ declare const removeAccents: (st: string) => string;
2
2
  export { removeAccents };
@@ -7,7 +7,7 @@ const removeAccents = function (st) {
7
7
  }
8
8
  else {
9
9
  log(st);
10
- throw new Error(bbn._("removeAccent expects a string"));
10
+ throw new Error(bbn._('removeAccent expects a string'));
11
11
  }
12
12
  }
13
13
  return st.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
@@ -1,2 +1,2 @@
1
- declare const removeEmpty: (arr: any) => any[];
1
+ declare const removeEmpty: (arr: any[]) => any[];
2
2
  export { removeEmpty };
@@ -1,2 +1,2 @@
1
- declare const removeExtraSpaces: (str: any) => any;
1
+ declare const removeExtraSpaces: (str: string) => string;
2
2
  export { removeExtraSpaces };
@@ -1,2 +1,2 @@
1
- declare const removeHtmlComments: (str: any) => any;
1
+ declare const removeHtmlComments: (str: string) => string;
2
2
  export { removeHtmlComments };
@@ -1,3 +1,2 @@
1
- import { removePrivateProp } from './removePrivateProp';
2
- declare const removePrivateProp: (obj: any, deep: any) => boolean;
1
+ declare const removePrivateProp: (obj: object, deep?: boolean) => any;
3
2
  export { removePrivateProp };
@@ -1,11 +1,11 @@
1
1
  import { substr } from './substr';
2
- const removePrivateProp = function (obj, deep) {
3
- var r = false;
4
- if (typeof (obj) === "object") {
2
+ const removePrivateProp = function (obj, deep = false) {
3
+ let r = null;
4
+ if (typeof obj === 'object') {
5
5
  r = {};
6
6
  for (var n in obj) {
7
- if (substr(n, 0, 1).match(/^[A-z0-9]$/) && Object.hasOwn(obj, n)) {
8
- if (deep && (typeof (obj[n]) === "object")) {
7
+ if (substr(n, 0, 1).match(/^[A-z0-9]$/) && (n in obj)) {
8
+ if (deep && typeof obj[n] === 'object') {
9
9
  r[n] = removePrivateProp(obj[n], true);
10
10
  }
11
11
  else {
@@ -14,6 +14,6 @@ const removePrivateProp = function (obj, deep) {
14
14
  }
15
15
  }
16
16
  }
17
- return r;
17
+ return r || false;
18
18
  };
19
19
  export { removePrivateProp };
@@ -1,2 +1,2 @@
1
- declare const removeTrailingChars: (st: any, char: any) => any;
1
+ declare const removeTrailingChars: (st: string, char?: string) => string;
2
2
  export { removeTrailingChars };
@@ -1,2 +1,2 @@
1
- declare const repeat: (st: any, num: any) => string;
1
+ declare const repeat: (st: string, num: number) => string;
2
2
  export { repeat };
package/dist/fn/repeat.js CHANGED
@@ -1,9 +1,4 @@
1
- import { iterate } from './iterate';
2
1
  const repeat = function (st, num) {
3
- let res = '';
4
- iterate(num, () => {
5
- res += st;
6
- });
7
- return res;
2
+ return st.repeat(num);
8
3
  };
9
4
  export { repeat };
@@ -1,2 +1,2 @@
1
- declare const replaceAll: (find: any, replace: any, str: any, flags?: string) => any;
1
+ declare const replaceAll: (find: string, replace: string, str: string, flags?: string) => string;
2
2
  export { replaceAll };
@@ -1,9 +1,6 @@
1
1
  import { isObject } from './isObject';
2
2
  import { escapeRegExp } from './escapeRegExp';
3
3
  const replaceAll = function (find, replace, str, flags = '') {
4
- if (str !== undefined) {
5
- return str.toString().replace(isObject(find) ? find : new RegExp(escapeRegExp(find), 'g' + flags), replace);
6
- }
7
- return false;
4
+ return str.toString().replace(isObject(find) ? find : new RegExp(escapeRegExp(find), 'g' + flags), replace);
8
5
  };
9
6
  export { replaceAll };
@@ -14,7 +14,7 @@ const replaceSelection = function (html, selectInserted) {
14
14
  }
15
15
  else {
16
16
  // In IE 9 we need to use innerHTML of a temporary element
17
- const div = document.createElement("div");
17
+ const div = document.createElement('div');
18
18
  let child;
19
19
  div.innerHTML = html;
20
20
  fragment = document.createDocumentFragment();
package/dist/fn/resize.js CHANGED
@@ -6,20 +6,22 @@ const resize = function () {
6
6
  let diffH = bbn.env.height !== window.innerHeight;
7
7
  if (diffW || diffH) {
8
8
  if (diffW) {
9
- bbn.env.width = window.innerWidth || window.document.documentElement.clientWidth || window.document.body.clientWidth;
10
- document.documentElement.style.setProperty('--vw', (bbn.env.width * 0.01) + 'px');
9
+ bbn.env.width =
10
+ window.innerWidth || window.document.documentElement.clientWidth || window.document.body.clientWidth;
11
+ document.documentElement.style.setProperty('--vw', bbn.env.width * 0.01 + 'px');
11
12
  }
12
13
  if (diffH) {
13
- bbn.env.height = window.innerHeight || window.document.documentElement.clientHeight || window.document.body.clientHeight;
14
- document.documentElement.style.setProperty('--vh', (bbn.env.height * 0.01) + 'px');
14
+ bbn.env.height =
15
+ window.innerHeight || window.document.documentElement.clientHeight || window.document.body.clientHeight;
16
+ document.documentElement.style.setProperty('--vh', bbn.env.height * 0.01 + 'px');
15
17
  }
16
- let smallWidth = getCssVar('mobile-limit') || 650;
17
- let newCls = 'bbn-screen-' + (bbn.env.width < parseInt(smallWidth) ? 'small' : 'regular');
18
+ let smallWidth = parseInt(getCssVar('mobile-limit')) || 650;
19
+ let newCls = 'bbn-screen-' + (bbn.env.width < smallWidth ? 'small' : 'regular');
18
20
  let classes = (document.body.className || '').split(' ');
19
21
  let done = false;
20
22
  each(classes, (cls, idx) => {
21
23
  let bits = cls.split('-');
22
- if ((bits.length === 3) && (cls.indexOf('bbn-screen-') === 0)) {
24
+ if (bits.length === 3 && cls.indexOf('bbn-screen-') === 0) {
23
25
  done = true;
24
26
  if (cls !== newCls) {
25
27
  classes.splice(idx, 1, newCls);
@@ -1,8 +1,10 @@
1
1
  const rgb2hex = function (rgb) {
2
2
  rgb = rgb.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);
3
- return (rgb && rgb.length === 4) ? "#" +
4
- ("0" + parseInt(rgb[1], 10).toString(16)).slice(-2) +
5
- ("0" + parseInt(rgb[2], 10).toString(16)).slice(-2) +
6
- ("0" + parseInt(rgb[3], 10).toString(16)).slice(-2) : '';
3
+ return rgb && rgb.length === 4
4
+ ? '#' +
5
+ ('0' + parseInt(rgb[1], 10).toString(16)).slice(-2) +
6
+ ('0' + parseInt(rgb[2], 10).toString(16)).slice(-2) +
7
+ ('0' + parseInt(rgb[3], 10).toString(16)).slice(-2)
8
+ : '';
7
9
  };
8
10
  export { rgb2hex };
@@ -1,2 +1,2 @@
1
- declare const riterate: (obj: any, fn: any, noPrivate: any) => any;
1
+ declare const riterate: (obj: object, fn: (a: any, b: string) => any, noPrivate?: boolean) => object;
2
2
  export { riterate };
@@ -1,2 +1,2 @@
1
- declare const roundDecimal: (value: any, decimals: any) => number;
1
+ declare const roundDecimal: (value: number, decimals: number) => number;
2
2
  export { roundDecimal };
@@ -1,4 +1,4 @@
1
1
  const roundDecimal = function (value, decimals) {
2
- return Number(Math.round(value + 'e' + decimals) + 'e-' + decimals);
2
+ return Math.round(Math.pow(Math.pow(value, decimals), -decimals));
3
3
  };
4
4
  export { roundDecimal };
@@ -11,7 +11,9 @@ const sanitize = function (str, separator = '_') {
11
11
  }
12
12
  exp += ']+';
13
13
  let re = new RegExp(exp, 'g');
14
- let res = removeAccents(str).replace(/[^a-z0-9]/gi, separator).replace(re, separator);
14
+ let res = removeAccents(str)
15
+ .replace(/[^a-z0-9]/gi, separator)
16
+ .replace(re, separator);
15
17
  return trim(res, separator);
16
18
  };
17
19
  export { sanitize };
@@ -1,2 +1,3 @@
1
- declare const search: (arr: any, prop: any, val: any, operator: any, startFrom: any) => any;
1
+ import { Filter } from './filterToConditions';
2
+ declare const search: (arr: any[], prop: Filter | string | object, val?: any, operator?: number | string, startFrom?: number) => number;
2
3
  export { search };