@bbn/bbn 1.0.28 → 1.0.29

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 (231) hide show
  1. package/dist/bundle.d.ts +6 -6
  2. package/dist/fn/_addLoader.js +3 -6
  3. package/dist/fn/_compareValues.js +11 -14
  4. package/dist/fn/_deleteLoader.js +7 -10
  5. package/dist/fn/abort.js +3 -6
  6. package/dist/fn/abortURL.js +4 -7
  7. package/dist/fn/addColors.js +5 -8
  8. package/dist/fn/addInputs.js +3 -6
  9. package/dist/fn/addStyle.js +5 -8
  10. package/dist/fn/adjustHeight.js +5 -8
  11. package/dist/fn/adjustSize.js +5 -8
  12. package/dist/fn/adjustWidth.js +5 -8
  13. package/dist/fn/ajax.js +31 -34
  14. package/dist/fn/analyzeFunction.js +3 -6
  15. package/dist/fn/animateCss.js +1 -4
  16. package/dist/fn/arrayBuffer2String.js +1 -4
  17. package/dist/fn/arrayFromProp.js +5 -8
  18. package/dist/fn/autoExtend.js +4 -7
  19. package/dist/fn/baseName.js +6 -9
  20. package/dist/fn/br2nl.js +3 -6
  21. package/dist/fn/calendar.js +14 -20
  22. package/dist/fn/callback.js +16 -19
  23. package/dist/fn/camelToCss.js +1 -4
  24. package/dist/fn/camelize.js +1 -4
  25. package/dist/fn/canvasToImage.js +1 -4
  26. package/dist/fn/center.js +1 -4
  27. package/dist/fn/checkProps.js +3 -6
  28. package/dist/fn/checkPropsDetails.js +9 -12
  29. package/dist/fn/checkPropsOrDie.js +3 -6
  30. package/dist/fn/checkType.js +16 -19
  31. package/dist/fn/chrono.js +3 -7
  32. package/dist/fn/circularReplacer.js +7 -10
  33. package/dist/fn/clone.js +7 -10
  34. package/dist/fn/colorToHex.js +1 -4
  35. package/dist/fn/compare.js +18 -21
  36. package/dist/fn/compareConditions.js +10 -13
  37. package/dist/fn/copy.js +4 -7
  38. package/dist/fn/correctCase.js +1 -4
  39. package/dist/fn/count.js +3 -6
  40. package/dist/fn/crc32.js +1 -4
  41. package/dist/fn/createObject.js +3 -6
  42. package/dist/fn/cssExists.js +3 -6
  43. package/dist/fn/date.js +8 -11
  44. package/dist/fn/dateSQL.js +5 -11
  45. package/dist/fn/daysInMonth.js +5 -11
  46. package/dist/fn/deepPath.js +7 -10
  47. package/dist/fn/defaultAjaxAbortFunction.js +3 -6
  48. package/dist/fn/defaultAjaxErrorFunction.js +1 -4
  49. package/dist/fn/defaultAlertFunction.js +1 -4
  50. package/dist/fn/defaultConfirmFunction.js +4 -7
  51. package/dist/fn/defaultEndLoadingFunction.js +1 -4
  52. package/dist/fn/defaultErrorFunction.js +3 -6
  53. package/dist/fn/defaultHistoryFunction.js +1 -4
  54. package/dist/fn/defaultLinkFunction.js +1 -4
  55. package/dist/fn/defaultPostLinkFunction.js +1 -4
  56. package/dist/fn/defaultPreLinkFunction.js +1 -4
  57. package/dist/fn/defaultResizeFunction.js +1 -4
  58. package/dist/fn/defaultStartLoadingFunction.js +1 -4
  59. package/dist/fn/deleteProp.js +4 -7
  60. package/dist/fn/diffObj.js +16 -19
  61. package/dist/fn/dirName.js +7 -10
  62. package/dist/fn/download.js +15 -18
  63. package/dist/fn/downloadContent.js +9 -12
  64. package/dist/fn/each.js +7 -10
  65. package/dist/fn/eraseCookie.js +1 -4
  66. package/dist/fn/error.js +3 -6
  67. package/dist/fn/escapeDquotes.js +3 -6
  68. package/dist/fn/escapeRegExp.js +1 -4
  69. package/dist/fn/escapeSquotes.js +3 -6
  70. package/dist/fn/escapeTicks.js +3 -6
  71. package/dist/fn/escapeUrl.js +8 -11
  72. package/dist/fn/extend.js +13 -16
  73. package/dist/fn/extendOut.js +4 -7
  74. package/dist/fn/fdate.js +12 -18
  75. package/dist/fn/fdatetime.js +10 -16
  76. package/dist/fn/fieldValue.js +1 -4
  77. package/dist/fn/fileExt.js +3 -6
  78. package/dist/fn/filter.js +12 -15
  79. package/dist/fn/filterToConditions.js +8 -11
  80. package/dist/fn/findAll.js +7 -10
  81. package/dist/fn/fori.js +6 -9
  82. package/dist/fn/forir.js +6 -9
  83. package/dist/fn/format.js +3 -6
  84. package/dist/fn/formatBytes.js +1 -4
  85. package/dist/fn/formatDate.js +3 -9
  86. package/dist/fn/formatSize.js +5 -8
  87. package/dist/fn/formdata.js +11 -14
  88. package/dist/fn/fromXml.js +1 -4
  89. package/dist/fn/ftime.js +12 -18
  90. package/dist/fn/getAllTags.js +3 -6
  91. package/dist/fn/getAncestors.js +1 -4
  92. package/dist/fn/getAttributes.js +3 -6
  93. package/dist/fn/getBrowserName.js +1 -4
  94. package/dist/fn/getBrowserVersion.js +1 -4
  95. package/dist/fn/getCookie.js +1 -4
  96. package/dist/fn/getCssVar.js +1 -4
  97. package/dist/fn/getDay.js +3 -6
  98. package/dist/fn/getDeviceType.js +1 -4
  99. package/dist/fn/getEventData.js +7 -10
  100. package/dist/fn/getField.js +3 -6
  101. package/dist/fn/getFieldValues.js +7 -10
  102. package/dist/fn/getHTMLOfSelection.js +4 -7
  103. package/dist/fn/getHtml.js +3 -6
  104. package/dist/fn/getLoader.js +3 -6
  105. package/dist/fn/getPath.js +3 -6
  106. package/dist/fn/getProp.js +4 -7
  107. package/dist/fn/getProperty.js +1 -4
  108. package/dist/fn/getRequestId.js +5 -8
  109. package/dist/fn/getRow.js +3 -6
  110. package/dist/fn/getScrollBarSize.js +1 -4
  111. package/dist/fn/getText.js +1 -4
  112. package/dist/fn/getTimeoff.js +1 -4
  113. package/dist/fn/happy.js +3 -6
  114. package/dist/fn/hash.js +11 -14
  115. package/dist/fn/hex2rgb.js +1 -4
  116. package/dist/fn/history.js +1 -4
  117. package/dist/fn/html2text.js +1 -4
  118. package/dist/fn/imageToCanvas.js +1 -4
  119. package/dist/fn/imgToBase64.js +3 -6
  120. package/dist/fn/info.js +3 -6
  121. package/dist/fn/init.js +32 -58
  122. package/dist/fn/isActiveInterface.js +1 -4
  123. package/dist/fn/isArray.js +1 -4
  124. package/dist/fn/isBlob.js +1 -4
  125. package/dist/fn/isBoolean.js +1 -4
  126. package/dist/fn/isCanvas.js +1 -4
  127. package/dist/fn/isColor.js +3 -6
  128. package/dist/fn/isComment.js +1 -4
  129. package/dist/fn/isCp.js +3 -6
  130. package/dist/fn/isDate.js +1 -4
  131. package/dist/fn/isDesktopDevice.js +1 -4
  132. package/dist/fn/isDimension.js +3 -6
  133. package/dist/fn/isDom.js +1 -4
  134. package/dist/fn/isEmail.js +3 -6
  135. package/dist/fn/isEmpty.js +5 -8
  136. package/dist/fn/isEvent.js +1 -4
  137. package/dist/fn/isFocused.js +1 -4
  138. package/dist/fn/isFunction.js +1 -4
  139. package/dist/fn/isHostname.js +5 -8
  140. package/dist/fn/isIP.js +3 -6
  141. package/dist/fn/isInside.js +7 -10
  142. package/dist/fn/isInt.js +1 -4
  143. package/dist/fn/isIterable.js +1 -4
  144. package/dist/fn/isMobile.js +4 -7
  145. package/dist/fn/isMobileDevice.js +1 -4
  146. package/dist/fn/isNull.js +1 -4
  147. package/dist/fn/isNumber.js +1 -4
  148. package/dist/fn/isObject.js +1 -4
  149. package/dist/fn/isPercent.js +1 -4
  150. package/dist/fn/isPrimitive.js +1 -4
  151. package/dist/fn/isPromise.js +1 -4
  152. package/dist/fn/isPropSize.js +3 -6
  153. package/dist/fn/isSQLDate.js +1 -4
  154. package/dist/fn/isSame.js +5 -8
  155. package/dist/fn/isString.js +1 -4
  156. package/dist/fn/isSymbol.js +1 -4
  157. package/dist/fn/isTabletDevice.js +1 -4
  158. package/dist/fn/isURL.js +1 -4
  159. package/dist/fn/isValidDimension.js +4 -7
  160. package/dist/fn/isValidName.js +3 -6
  161. package/dist/fn/isValue.js +3 -6
  162. package/dist/fn/isVue.js +1 -4
  163. package/dist/fn/iterate.js +5 -8
  164. package/dist/fn/lightenDarkenHex.js +1 -4
  165. package/dist/fn/link.js +19 -22
  166. package/dist/fn/log.js +3 -6
  167. package/dist/fn/makeReactive.js +28 -31
  168. package/dist/fn/map.js +3 -6
  169. package/dist/fn/md5.js +1 -4
  170. package/dist/fn/money.js +3 -6
  171. package/dist/fn/move.js +1 -4
  172. package/dist/fn/multiorder.js +3 -6
  173. package/dist/fn/nl2br.js +3 -6
  174. package/dist/fn/numProperties.js +1 -4
  175. package/dist/fn/objectToFormData.js +12 -15
  176. package/dist/fn/order.js +3 -6
  177. package/dist/fn/outerHeight.js +3 -6
  178. package/dist/fn/outerWidth.js +3 -6
  179. package/dist/fn/percent.js +1 -4
  180. package/dist/fn/pickValue.js +1 -4
  181. package/dist/fn/post.js +7 -10
  182. package/dist/fn/postOut.js +5 -8
  183. package/dist/fn/printf.js +1 -4
  184. package/dist/fn/quotes2html.js +4 -7
  185. package/dist/fn/randomInt.js +1 -4
  186. package/dist/fn/randomString.js +4 -7
  187. package/dist/fn/removeAccents.js +5 -8
  188. package/dist/fn/removeEmpty.js +8 -11
  189. package/dist/fn/removeExtraSpaces.js +1 -4
  190. package/dist/fn/removeHtmlComments.js +3 -6
  191. package/dist/fn/removePrivateProp.js +3 -6
  192. package/dist/fn/removeTrailingChars.js +6 -9
  193. package/dist/fn/repeat.js +1 -4
  194. package/dist/fn/replaceAll.js +4 -7
  195. package/dist/fn/replaceSelection.js +1 -4
  196. package/dist/fn/resize.js +7 -10
  197. package/dist/fn/rgb2hex.js +1 -4
  198. package/dist/fn/riterate.js +3 -6
  199. package/dist/fn/roundDecimal.js +1 -4
  200. package/dist/fn/sanitize.js +5 -8
  201. package/dist/fn/search.js +15 -18
  202. package/dist/fn/selectElementText.js +1 -4
  203. package/dist/fn/selector.js +1 -4
  204. package/dist/fn/setCookie.js +1 -4
  205. package/dist/fn/setCssVar.js +1 -4
  206. package/dist/fn/setNavigationVars.js +10 -13
  207. package/dist/fn/setProp.js +1 -4
  208. package/dist/fn/setProperty.js +3 -6
  209. package/dist/fn/shorten.js +5 -8
  210. package/dist/fn/shortenObj.js +9 -12
  211. package/dist/fn/shuffle.js +1 -4
  212. package/dist/fn/simpleHash.js +5 -8
  213. package/dist/fn/simpleHash1.js +1 -4
  214. package/dist/fn/simpleHash2.js +1 -4
  215. package/dist/fn/stat.js +1 -4
  216. package/dist/fn/string2ArrayBuffer.js +1 -4
  217. package/dist/fn/submit.js +6 -9
  218. package/dist/fn/substr.js +7 -10
  219. package/dist/fn/sum.js +4 -7
  220. package/dist/fn/timestamp.js +1 -4
  221. package/dist/fn/toCSV.js +8 -11
  222. package/dist/fn/toggleFullScreen.js +3 -6
  223. package/dist/fn/translate.js +3 -6
  224. package/dist/fn/treatAjaxArguments.js +10 -13
  225. package/dist/fn/trim.js +4 -7
  226. package/dist/fn/uniqString.js +7 -10
  227. package/dist/fn/unique.js +1 -4
  228. package/dist/fn/upload.js +7 -33
  229. package/dist/fn/warning.js +3 -6
  230. package/dist/index.js +459 -471
  231. package/package.json +1 -1
@@ -1,19 +1,16 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setNavigationVars = void 0;
4
- const substr_1 = require("./substr");
5
- const filter_1 = require("./filter");
6
- const extend_1 = require("./extend");
7
- const html2text_1 = require("./html2text");
1
+ import { substr } from './substr';
2
+ import { filter } from './filter';
3
+ import { extend } from './extend';
4
+ import { html2text } from './html2text';
8
5
  const setNavigationVars = function (url, title, data, repl) {
9
6
  // Current path becomes old path
10
7
  bbn.env.old_path = bbn.env.path;
11
8
  // URL includes the domain
12
- bbn.env.url = ['https:/', 'http://'].includes((0, substr_1.substr)(url, 0, 7)) ? url : bbn.env.root + url;
9
+ bbn.env.url = ['https:/', 'http://'].includes(substr(url, 0, 7)) ? url : bbn.env.root + url;
13
10
  // Path does not
14
- bbn.env.path = (0, substr_1.substr)(bbn.env.url, bbn.env.root.length);
11
+ bbn.env.path = substr(bbn.env.url, bbn.env.root.length);
15
12
  // Params will include each part of the URL
16
- bbn.env.params = (0, filter_1.filter)(bbn.env.path.split('/'), (v) => {
13
+ bbn.env.params = filter(bbn.env.path.split('/'), (v) => {
17
14
  return v !== '';
18
15
  });
19
16
  // Managing history
@@ -31,7 +28,7 @@ const setNavigationVars = function (url, title, data, repl) {
31
28
  // If same URL we replace
32
29
  if (state && state.url === bbn.env.path) {
33
30
  if (state.data) {
34
- (0, extend_1.extend)(obj.data, state.data);
31
+ extend(obj.data, state.data);
35
32
  }
36
33
  if (state.title && !title) {
37
34
  title = state.title;
@@ -44,7 +41,7 @@ const setNavigationVars = function (url, title, data, repl) {
44
41
  }
45
42
  // Otherwise we add the global title at the end
46
43
  else {
47
- title = (0, html2text_1.html2text)(title);
44
+ title = html2text(title);
48
45
  }
49
46
  // Replacing state
50
47
  if (repl) {
@@ -57,4 +54,4 @@ const setNavigationVars = function (url, title, data, repl) {
57
54
  }
58
55
  }
59
56
  };
60
- exports.setNavigationVars = setNavigationVars;
57
+ export { setNavigationVars };
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setProp = void 0;
4
1
  const setProp = function (obj, prop, value, writable = true, configurable = true) {
5
2
  Object.defineProperty(obj, prop, {
6
3
  value: value,
@@ -8,4 +5,4 @@ const setProp = function (obj, prop, value, writable = true, configurable = true
8
5
  configurable: configurable,
9
6
  });
10
7
  };
11
- exports.setProp = setProp;
8
+ export { setProp };
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setProperty = void 0;
4
- const each_1 = require("./each");
1
+ import { each } from './each';
5
2
  const setProperty = function (obj, prop, value, force) {
6
3
  if (typeof obj === 'object' && typeof prop === 'string') {
7
4
  let o = obj;
8
5
  const bits = prop.split('.');
9
- (0, each_1.each)(bits, (v, i) => {
6
+ each(bits, (v, i) => {
10
7
  if (!o) {
11
8
  if (!force) {
12
9
  throw new Error(bbn._('The object is invalid'));
@@ -22,4 +19,4 @@ const setProperty = function (obj, prop, value, force) {
22
19
  });
23
20
  }
24
21
  };
25
- exports.setProperty = setProperty;
22
+ export { setProperty };
@@ -1,20 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.shorten = void 0;
4
- const isString_1 = require("./isString");
5
- const substr_1 = require("./substr");
1
+ import { isString } from './isString';
2
+ import { substr } from './substr';
6
3
  const shorten = function (st, len, adj) {
7
4
  if (typeof st.toLowerCase() === 'string') {
8
5
  if (!len) {
9
6
  len = bbn.vars.shortenLen;
10
7
  }
11
- if (adj === undefined || !(0, isString_1.isString)(adj)) {
8
+ if (adj === undefined || !isString(adj)) {
12
9
  adj = '...';
13
10
  }
14
11
  if (st.length > len) {
15
- st = (0, substr_1.substr)(st, 0, len) + adj;
12
+ st = substr(st, 0, len) + adj;
16
13
  }
17
14
  }
18
15
  return st;
19
16
  };
20
- exports.shorten = shorten;
17
+ export { shorten };
@@ -1,15 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.shortenObj = void 0;
4
- const clone_1 = require("./clone");
5
- const each_1 = require("./each");
6
- const isString_1 = require("./isString");
7
- const shorten_1 = require("./shorten");
1
+ import { clone } from './clone';
2
+ import { each } from './each';
3
+ import { isString } from './isString';
4
+ import { shorten } from './shorten';
8
5
  const shortenObj = function (obj, max = 100) {
9
- let o = (0, clone_1.clone)(obj);
10
- (0, each_1.each)(o, (a, n) => {
11
- if ((0, isString_1.isString)(a) && a.length > max) {
12
- o[n] = (0, shorten_1.shorten)(a, max);
6
+ let o = clone(obj);
7
+ each(o, (a, n) => {
8
+ if (isString(a) && a.length > max) {
9
+ o[n] = shorten(a, max);
13
10
  }
14
11
  else if (a && typeof a === 'object') {
15
12
  o[n] = shortenObj(a);
@@ -17,4 +14,4 @@ const shortenObj = function (obj, max = 100) {
17
14
  });
18
15
  return o;
19
16
  };
20
- exports.shortenObj = shortenObj;
17
+ export { shortenObj };
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.shuffle = void 0;
4
1
  const shuffle = function (array) {
5
2
  let currentIndex = array.length, randomIndex;
6
3
  // While there remain elements to shuffle.
@@ -13,4 +10,4 @@ const shuffle = function (array) {
13
10
  }
14
11
  return array;
15
12
  };
16
- exports.shuffle = shuffle;
13
+ export { shuffle };
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.simpleHash = void 0;
4
- const simpleHash1_1 = require("./simpleHash1");
5
- const simpleHash2_1 = require("./simpleHash2");
1
+ import { simpleHash1 } from './simpleHash1';
2
+ import { simpleHash2 } from './simpleHash2';
6
3
  const simpleHash = function (str) {
7
- const part1 = (0, simpleHash1_1.simpleHash1)(str).toString(16).padStart(8, '0');
8
- const part2 = (0, simpleHash2_1.simpleHash2)(str).toString(16).padStart(8, '0');
4
+ const part1 = simpleHash1(str).toString(16).padStart(8, '0');
5
+ const part2 = simpleHash2(str).toString(16).padStart(8, '0');
9
6
  return part1 + part2;
10
7
  };
11
- exports.simpleHash = simpleHash;
8
+ export { simpleHash };
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.simpleHash1 = void 0;
4
1
  const simpleHash1 = function (str) {
5
2
  let hash = 0;
6
3
  for (let i = 0; i < str.length; i++) {
@@ -10,4 +7,4 @@ const simpleHash1 = function (str) {
10
7
  }
11
8
  return hash;
12
9
  };
13
- exports.simpleHash1 = simpleHash1;
10
+ export { simpleHash1 };
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.simpleHash2 = void 0;
4
1
  const simpleHash2 = function (str) {
5
2
  let hash = 0;
6
3
  for (let i = 0; i < str.length; i++) {
@@ -10,4 +7,4 @@ const simpleHash2 = function (str) {
10
7
  }
11
8
  return hash;
12
9
  };
13
- exports.simpleHash2 = simpleHash2;
10
+ export { simpleHash2 };
package/dist/fn/stat.js CHANGED
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stat = void 0;
4
1
  const stat = function (returnStat) {
5
2
  return;
6
3
  /*
@@ -49,4 +46,4 @@ const stat = function (returnStat) {
49
46
  }
50
47
  */
51
48
  };
52
- exports.stat = stat;
49
+ export { stat };
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.string2ArrayBuffer = void 0;
4
1
  const string2ArrayBuffer = function (str) {
5
2
  var buf = new ArrayBuffer(str.length * 2); // 2 bytes for each char
6
3
  var bufView = new Uint16Array(buf);
@@ -9,4 +6,4 @@ const string2ArrayBuffer = function (str) {
9
6
  }
10
7
  return buf;
11
8
  };
12
- exports.string2ArrayBuffer = string2ArrayBuffer;
9
+ export { string2ArrayBuffer };
package/dist/fn/submit.js CHANGED
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.submit = void 0;
4
- const formdata_1 = require("./formdata");
5
- const post_1 = require("./post");
1
+ import { formdata } from './formdata';
2
+ import { post } from './post';
6
3
  const submit = function (form, e, fn) {
7
4
  let url = form.getAttribute('action') || bbn.env.path;
8
5
  let data;
@@ -16,7 +13,7 @@ const submit = function (form, e, fn) {
16
13
  if (e) {
17
14
  e.preventDefault();
18
15
  }
19
- data = (0, formdata_1.formdata)(form);
16
+ data = formdata(form);
20
17
  if (data) {
21
18
  //$form.attr("action", null);
22
19
  form.setAttribute('action', null);
@@ -25,12 +22,12 @@ const submit = function (form, e, fn) {
25
22
  fn = form.getAttribute('data-script') ? eval(form.getAttribute('data-script')) : null;
26
23
  }
27
24
  if (fn) {
28
- (0, post_1.post)(url, data, fn);
25
+ post(url, data, fn);
29
26
  }
30
27
  else {
31
- (0, post_1.post)(url, data);
28
+ post(url, data);
32
29
  }
33
30
  }
34
31
  }
35
32
  };
36
- exports.submit = submit;
33
+ export { submit };
package/dist/fn/substr.js CHANGED
@@ -1,20 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.substr = void 0;
4
- const isString_1 = require("./isString");
5
- const isInt_1 = require("./isInt");
6
- const log_1 = require("./log");
1
+ import { isString } from './isString';
2
+ import { isInt } from './isInt';
3
+ import { log } from './log';
7
4
  const substr = function (str, from, length) {
8
- if (!(0, isString_1.isString)(str) || !(0, isInt_1.isInt)(from)) {
9
- (0, log_1.log)(arguments);
5
+ if (!isString(str) || !isInt(from)) {
6
+ log(arguments);
10
7
  throw new Error(bbn._('The substr function should be applied to a string and at least a `from` argument should be given'));
11
8
  }
12
9
  if (from < 0) {
13
10
  from = str.length + from;
14
11
  }
15
- if (!(0, isInt_1.isInt)(length)) {
12
+ if (!isInt(length)) {
16
13
  return str.substring(from);
17
14
  }
18
15
  return str.substring(from, (length < 0 ? str.length : from) + length);
19
16
  };
20
- exports.substr = substr;
17
+ export { substr };
package/dist/fn/sum.js CHANGED
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sum = void 0;
4
- const each_1 = require("./each");
5
- const filter_1 = require("./filter");
1
+ import { each } from './each';
2
+ import { filter } from './filter';
6
3
  const sum = function (arr, numberProp, prop, val, operator) {
7
4
  let r = 0;
8
- (0, each_1.each)((0, filter_1.filter)(arr, prop, val, operator), (a) => {
5
+ each(filter(arr, prop, val, operator), (a) => {
9
6
  let tmp = typeof numberProp === 'function' ? numberProp(a) : a[numberProp];
10
7
  if (tmp) {
11
8
  r += parseFloat(tmp) || 0;
@@ -13,4 +10,4 @@ const sum = function (arr, numberProp, prop, val, operator) {
13
10
  });
14
11
  return r;
15
12
  };
16
- exports.sum = sum;
13
+ export { sum };
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.timestamp = void 0;
4
1
  const timestamp = function (seconds) {
5
2
  var r = new Date().getTime();
6
3
  return seconds ? Math.round(r / 1000) : r;
7
4
  };
8
- exports.timestamp = timestamp;
5
+ export { timestamp };
package/dist/fn/toCSV.js CHANGED
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toCSV = void 0;
4
- const each_1 = require("./each");
5
- const isArray_1 = require("./isArray");
6
- const replaceAll_1 = require("./replaceAll");
1
+ import { each } from './each';
2
+ import { isArray } from './isArray';
3
+ import { replaceAll } from './replaceAll';
7
4
  const toCSV = function (arr, valSep = ',', rowSep = '', valEsc = '"') {
8
5
  if (!valSep) {
9
6
  valSep = ',';
@@ -13,12 +10,12 @@ const toCSV = function (arr, valSep = ',', rowSep = '', valEsc = '"') {
13
10
  }
14
11
  let csvContent = '';
15
12
  let total = arr.length;
16
- (0, each_1.each)(arr, (a, i) => {
17
- let num = (0, isArray_1.isArray)(a) ? a.length : Object.values(a).length;
13
+ each(arr, (a, i) => {
14
+ let num = isArray(a) ? a.length : Object.values(a).length;
18
15
  let j = 0;
19
- (0, each_1.each)(a, (b) => {
16
+ each(a, (b) => {
20
17
  if (typeof b === 'string') {
21
- csvContent += valEsc + (0, replaceAll_1.replaceAll)(valEsc, '\\' + valEsc, b) + valEsc;
18
+ csvContent += valEsc + replaceAll(valEsc, '\\' + valEsc, b) + valEsc;
22
19
  }
23
20
  else if (b === 0) {
24
21
  csvContent += '0';
@@ -40,4 +37,4 @@ const toCSV = function (arr, valSep = ',', rowSep = '', valEsc = '"') {
40
37
  });
41
38
  return csvContent;
42
39
  };
43
- exports.toCSV = toCSV;
40
+ export { toCSV };
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toggleFullScreen = void 0;
4
- const resize_1 = require("./resize");
1
+ import { resize } from './resize';
5
2
  const toggleFullScreen = function () {
6
3
  if ('mozRequestFullScreen' in window.document.documentElement) {
7
4
  if (window.document['mozFullScreen']) {
@@ -36,7 +33,7 @@ const toggleFullScreen = function () {
36
33
  }
37
34
  }
38
35
  setTimeout(function () {
39
- (0, resize_1.resize)();
36
+ resize();
40
37
  }, 0);
41
38
  };
42
- exports.toggleFullScreen = toggleFullScreen;
39
+ export { toggleFullScreen };
@@ -1,11 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.translate = void 0;
4
- const iterate_1 = require("./iterate");
1
+ import { iterate } from './iterate';
5
2
  const translate = function (o, namespace) {
6
3
  let lng = namespace ? bbn.lng[namespace.indexOf('_') === 0 ? namespace : '_' + namespace] : bbn.lng;
7
- (0, iterate_1.iterate)(o, (v, k) => {
4
+ iterate(o, (v, k) => {
8
5
  lng[k] = v;
9
6
  });
10
7
  };
11
- exports.translate = translate;
8
+ export { translate };
@@ -1,22 +1,19 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.treatAjaxArguments = void 0;
4
- const isObject_1 = require("./isObject");
5
- const isFunction_1 = require("./isFunction");
6
- const substr_1 = require("./substr");
7
- const numProperties_1 = require("./numProperties");
1
+ import { isObject } from './isObject';
2
+ import { isFunction } from './isFunction';
3
+ import { substr } from './substr';
4
+ import { numProperties } from './numProperties';
8
5
  const treatAjaxArguments = function (args) {
9
6
  let cfg = {};
10
7
  let t;
11
8
  let i;
12
- if ((0, isObject_1.isObject)(args[0]) && args.length === 1) {
9
+ if (isObject(args[0]) && args.length === 1) {
13
10
  return args[0];
14
11
  }
15
12
  for (i = 0; i < args.length; i++) {
16
13
  t = typeof args[i];
17
14
  t = t.toLowerCase();
18
15
  /* Callbacks */
19
- if ((0, isFunction_1.isFunction)(args[i])) {
16
+ if (isFunction(args[i])) {
20
17
  if (cfg.errorFn && !cfg.abortFn) {
21
18
  cfg.abortFn = args[i];
22
19
  }
@@ -35,13 +32,13 @@ const treatAjaxArguments = function (args) {
35
32
  if (!cfg.url) {
36
33
  /* Hash */
37
34
  if (args[i].indexOf('#') === 0 || args[i].indexOf(bbn.env.root + '#') === 0) {
38
- cfg.url = (0, substr_1.substr)(args[i], bbn.env.root.length);
35
+ cfg.url = substr(args[i], bbn.env.root.length);
39
36
  }
40
37
  else {
41
38
  /* Link */
42
39
  cfg.url = args[i];
43
40
  if (cfg.url.indexOf(bbn.env.root) === 0) {
44
- cfg.url = (0, substr_1.substr)(cfg.url, bbn.env.root.length);
41
+ cfg.url = substr(cfg.url, bbn.env.root.length);
45
42
  }
46
43
  }
47
44
  }
@@ -65,7 +62,7 @@ const treatAjaxArguments = function (args) {
65
62
  }
66
63
  }
67
64
  }
68
- if (!cfg.url && (0, numProperties_1.numProperties)(cfg)) {
65
+ if (!cfg.url && numProperties(cfg)) {
69
66
  cfg.url = bbn.env.path;
70
67
  }
71
68
  if (cfg.obj === undefined) {
@@ -76,4 +73,4 @@ const treatAjaxArguments = function (args) {
76
73
  }
77
74
  return cfg;
78
75
  };
79
- exports.treatAjaxArguments = treatAjaxArguments;
76
+ export { treatAjaxArguments };
package/dist/fn/trim.js CHANGED
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.trim = void 0;
4
- const substr_1 = require("./substr");
1
+ import { substr } from './substr';
5
2
  const trim = function (str, hair = ' ') {
6
3
  if (hair === ' ') {
7
4
  return str.trim();
@@ -13,11 +10,11 @@ const trim = function (str, hair = ' ') {
13
10
  return '';
14
11
  }
15
12
  while (str.indexOf(hair) === 0) {
16
- str = (0, substr_1.substr)(str, hair.length);
13
+ str = substr(str, hair.length);
17
14
  }
18
15
  while (str.lastIndexOf(hair) === str.length - hair.length) {
19
- str = (0, substr_1.substr)(str, 0, str.length - hair.length);
16
+ str = substr(str, 0, str.length - hair.length);
20
17
  }
21
18
  return str;
22
19
  };
23
- exports.trim = trim;
20
+ export { trim };
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.uniqString = void 0;
4
- const isArray_1 = require("./isArray");
5
- const each_1 = require("./each");
6
- const md5_1 = require("./md5");
1
+ import { isArray } from './isArray';
2
+ import { each } from './each';
3
+ import { md5 } from './md5';
7
4
  const uniqString = function (...args) {
8
5
  var st = '';
9
6
  for (var i = 0; i < args.length; i++) {
@@ -11,14 +8,14 @@ const uniqString = function (...args) {
11
8
  st += '__bbn_empty__';
12
9
  }
13
10
  else if (typeof args[i] === 'object') {
14
- if ((0, isArray_1.isArray)(args[i])) {
11
+ if (isArray(args[i])) {
15
12
  st += JSON.stringify(args[i]);
16
13
  }
17
14
  else {
18
15
  // An object with the same properties, even in different order, should produce the same answer
19
16
  let tmp = {};
20
17
  let ks = Object.keys(args[i]).sort();
21
- (0, each_1.each)(ks, (k) => {
18
+ each(ks, (k) => {
22
19
  tmp[k] = args[i][k];
23
20
  });
24
21
  st += JSON.stringify(tmp);
@@ -31,6 +28,6 @@ const uniqString = function (...args) {
31
28
  st += args[i];
32
29
  }
33
30
  }
34
- return (0, md5_1.md5)(st);
31
+ return md5(st);
35
32
  };
36
- exports.uniqString = uniqString;
33
+ export { uniqString };
package/dist/fn/unique.js CHANGED
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.unique = void 0;
4
1
  const unique = function (arr) {
5
2
  return arr.filter(function (el, index, ar) {
6
3
  return index === ar.indexOf(el);
7
4
  });
8
5
  };
9
- exports.unique = unique;
6
+ export { unique };
package/dist/fn/upload.js CHANGED
@@ -1,35 +1,9 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.upload = void 0;
27
- const axios = __importStar(require("../../node_modules/axios/dist/axios"));
28
- const objectToFormData_1 = require("./objectToFormData");
29
- const log_1 = require("./log");
1
+ import * as axios from '../../node_modules/axios/dist/axios';
2
+ import { objectToFormData } from './objectToFormData';
3
+ import { log } from './log';
30
4
  const upload = function (url, file, success, failure, progress) {
31
5
  let fn = () => {
32
- return axios.post(url || bbn.env.path, (0, objectToFormData_1.objectToFormData)(file), {
6
+ return axios.post(url || bbn.env.path, objectToFormData(file), {
33
7
  headers: {
34
8
  'Content-Type': 'multipart/form-data',
35
9
  },
@@ -48,16 +22,16 @@ const upload = function (url, file, success, failure, progress) {
48
22
  return fn()
49
23
  .then((res) => {
50
24
  if (success) {
51
- (0, log_1.log)('SUCCESS', res);
25
+ log('SUCCESS', res);
52
26
  success(res);
53
27
  }
54
28
  })
55
29
  .catch((err) => {
56
30
  if (failure) {
57
- (0, log_1.log)('ERROR', err);
31
+ log('ERROR', err);
58
32
  failure(err);
59
33
  }
60
34
  });
61
35
  }
62
36
  };
63
- exports.upload = upload;
37
+ export { upload };
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.warning = void 0;
4
- const log_1 = require("./log");
1
+ import { log } from './log';
5
2
  const warning = function (message) {
6
3
  const args = ['BBN: ' + message];
7
4
  const obj = {
@@ -10,6 +7,6 @@ const warning = function (message) {
10
7
  _bbn_console_style: 'color: #E64141; background: #F7E195; font-size: 14px',
11
8
  };
12
9
  args.unshift(obj);
13
- log_1.log.apply(this, args);
10
+ log.apply(this, args);
14
11
  };
15
- exports.warning = warning;
12
+ export { warning };