@bbn/bbn 1.0.35 → 1.0.36

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.js +827 -1109
  2. package/dist/fn/_addLoader.js +5 -5
  3. package/dist/fn/_compareValues.js +2 -3
  4. package/dist/fn/_deleteLoader.js +11 -13
  5. package/dist/fn/abort.js +2 -2
  6. package/dist/fn/abortURL.js +2 -2
  7. package/dist/fn/addColors.js +12 -12
  8. package/dist/fn/addInputs.js +10 -12
  9. package/dist/fn/addStyle.js +2 -2
  10. package/dist/fn/adjustHeight.js +2 -2
  11. package/dist/fn/adjustSize.js +6 -6
  12. package/dist/fn/adjustWidth.js +2 -2
  13. package/dist/fn/ajax.js +21 -21
  14. package/dist/fn/analyzeFunction.js +28 -28
  15. package/dist/fn/animateCss.js +5 -6
  16. package/dist/fn/arrayBuffer2String.js +1 -1
  17. package/dist/fn/arrayFromProp.js +3 -3
  18. package/dist/fn/autoExtend.js +1 -1
  19. package/dist/fn/baseName.js +4 -4
  20. package/dist/fn/br2nl.js +1 -1
  21. package/dist/fn/calendar.js +2 -2
  22. package/dist/fn/callback.js +7 -11
  23. package/dist/fn/camelToCss.js +1 -1
  24. package/dist/fn/camelize.js +1 -1
  25. package/dist/fn/canvasToImage.js +2 -2
  26. package/dist/fn/center.js +2 -2
  27. package/dist/fn/checkProps.js +1 -2
  28. package/dist/fn/checkPropsDetails.js +8 -9
  29. package/dist/fn/checkPropsOrDie.js +2 -3
  30. package/dist/fn/checkType.js +6 -11
  31. package/dist/fn/chrono.js +8 -8
  32. package/dist/fn/circularReplacer.js +3 -3
  33. package/dist/fn/clone.js +3 -3
  34. package/dist/fn/colorToHex.js +2 -2
  35. package/dist/fn/compare.js +1 -1
  36. package/dist/fn/compareConditions.js +7 -7
  37. package/dist/fn/copy.js +6 -8
  38. package/dist/fn/correctCase.js +2 -2
  39. package/dist/fn/count.js +1 -3
  40. package/dist/fn/crc32.js +8 -8
  41. package/dist/fn/createObject.js +3 -16
  42. package/dist/fn/cssExists.js +6 -6
  43. package/dist/fn/date.js +2 -2
  44. package/dist/fn/dateSQL.js +2 -2
  45. package/dist/fn/daysInMonth.js +2 -2
  46. package/dist/fn/deepPath.js +6 -7
  47. package/dist/fn/defaultAjaxAbortFunction.js +1 -2
  48. package/dist/fn/defaultAjaxErrorFunction.js +1 -1
  49. package/dist/fn/defaultAlertFunction.js +1 -1
  50. package/dist/fn/defaultConfirmFunction.js +2 -2
  51. package/dist/fn/defaultEndLoadingFunction.js +1 -1
  52. package/dist/fn/defaultErrorFunction.js +1 -1
  53. package/dist/fn/defaultHistoryFunction.js +1 -1
  54. package/dist/fn/defaultLinkFunction.js +1 -1
  55. package/dist/fn/defaultPostLinkFunction.js +1 -1
  56. package/dist/fn/defaultPreLinkFunction.js +1 -1
  57. package/dist/fn/defaultResizeFunction.js +1 -1
  58. package/dist/fn/defaultStartLoadingFunction.js +1 -2
  59. package/dist/fn/deleteProp.js +1 -1
  60. package/dist/fn/diffObj.js +11 -13
  61. package/dist/fn/dirName.js +2 -2
  62. package/dist/fn/download.js +6 -6
  63. package/dist/fn/downloadContent.js +5 -5
  64. package/dist/fn/each.js +3 -3
  65. package/dist/fn/eraseCookie.js +1 -1
  66. package/dist/fn/error.js +3 -3
  67. package/dist/fn/escapeDquotes.js +1 -1
  68. package/dist/fn/escapeRegExp.js +1 -1
  69. package/dist/fn/escapeSquotes.js +1 -1
  70. package/dist/fn/escapeTicks.js +1 -1
  71. package/dist/fn/escapeUrl.js +7 -7
  72. package/dist/fn/extend.js +9 -13
  73. package/dist/fn/extendOut.js +4 -9
  74. package/dist/fn/fdate.js +2 -2
  75. package/dist/fn/fdatetime.js +2 -2
  76. package/dist/fn/fieldValue.js +2 -2
  77. package/dist/fn/fileExt.js +2 -2
  78. package/dist/fn/filter.js +6 -8
  79. package/dist/fn/filterToConditions.js +6 -7
  80. package/dist/fn/findAll.js +4 -5
  81. package/dist/fn/fori.js +3 -5
  82. package/dist/fn/forir.js +3 -5
  83. package/dist/fn/format.js +5 -5
  84. package/dist/fn/formatBytes.js +2 -3
  85. package/dist/fn/formatDate.js +1 -1
  86. package/dist/fn/formatSize.js +1 -1
  87. package/dist/fn/formdata.js +25 -25
  88. package/dist/fn/fromXml.js +8 -14
  89. package/dist/fn/ftime.js +2 -2
  90. package/dist/fn/getAllTags.js +2 -2
  91. package/dist/fn/getAncestors.js +2 -2
  92. package/dist/fn/getAttributes.js +3 -3
  93. package/dist/fn/getBrowserName.js +2 -2
  94. package/dist/fn/getBrowserVersion.js +2 -2
  95. package/dist/fn/getCookie.js +6 -6
  96. package/dist/fn/getCssVar.js +1 -1
  97. package/dist/fn/getDay.js +4 -4
  98. package/dist/fn/getDeviceType.js +2 -2
  99. package/dist/fn/getEventData.js +31 -31
  100. package/dist/fn/getField.js +2 -5
  101. package/dist/fn/getFieldValues.js +3 -3
  102. package/dist/fn/getHTMLOfSelection.js +5 -5
  103. package/dist/fn/getHtml.js +2 -3
  104. package/dist/fn/getLoader.js +2 -2
  105. package/dist/fn/getPath.js +16 -23
  106. package/dist/fn/getProp.js +1 -1
  107. package/dist/fn/getProperty.js +2 -2
  108. package/dist/fn/getRequestId.js +3 -3
  109. package/dist/fn/getRow.js +1 -3
  110. package/dist/fn/getScrollBarSize.js +6 -6
  111. package/dist/fn/getText.js +1 -1
  112. package/dist/fn/getTimeoff.js +1 -1
  113. package/dist/fn/happy.js +1 -5
  114. package/dist/fn/hash.js +4 -4
  115. package/dist/fn/hex2rgb.js +1 -1
  116. package/dist/fn/history.js +1 -1
  117. package/dist/fn/html2text.js +2 -2
  118. package/dist/fn/imageToCanvas.js +2 -2
  119. package/dist/fn/imgToBase64.js +2 -3
  120. package/dist/fn/info.js +1 -5
  121. package/dist/fn/init.js +17 -17
  122. package/dist/fn/isActiveInterface.js +2 -3
  123. package/dist/fn/isArray.js +2 -7
  124. package/dist/fn/isBlob.js +2 -7
  125. package/dist/fn/isBoolean.js +2 -7
  126. package/dist/fn/isCanvas.js +2 -7
  127. package/dist/fn/isColor.js +2 -7
  128. package/dist/fn/isComment.js +2 -7
  129. package/dist/fn/isCp.js +3 -8
  130. package/dist/fn/isDate.js +2 -7
  131. package/dist/fn/isDesktopDevice.js +1 -1
  132. package/dist/fn/isDimension.js +2 -7
  133. package/dist/fn/isDom.js +2 -7
  134. package/dist/fn/isEmail.js +3 -8
  135. package/dist/fn/isEmpty.js +1 -1
  136. package/dist/fn/isEvent.js +2 -7
  137. package/dist/fn/isFocused.js +1 -1
  138. package/dist/fn/isFunction.js +2 -7
  139. package/dist/fn/isHostname.js +2 -7
  140. package/dist/fn/isIP.js +2 -7
  141. package/dist/fn/isInside.js +6 -6
  142. package/dist/fn/isInt.js +2 -7
  143. package/dist/fn/isIterable.js +1 -1
  144. package/dist/fn/isMobile.js +1 -1
  145. package/dist/fn/isMobileDevice.js +1 -1
  146. package/dist/fn/isNull.js +2 -7
  147. package/dist/fn/isNumber.js +2 -7
  148. package/dist/fn/isObject.js +2 -7
  149. package/dist/fn/isPercent.js +2 -7
  150. package/dist/fn/isPrimitive.js +2 -7
  151. package/dist/fn/isPromise.js +2 -7
  152. package/dist/fn/isPropSize.js +3 -3
  153. package/dist/fn/isSQLDate.js +2 -7
  154. package/dist/fn/isSame.js +7 -7
  155. package/dist/fn/isString.js +2 -7
  156. package/dist/fn/isSymbol.js +2 -7
  157. package/dist/fn/isTabletDevice.js +1 -1
  158. package/dist/fn/isURL.js +2 -7
  159. package/dist/fn/isValidDimension.js +3 -3
  160. package/dist/fn/isValidName.js +2 -7
  161. package/dist/fn/isValue.js +2 -7
  162. package/dist/fn/isVue.js +4 -11
  163. package/dist/fn/iterate.js +3 -5
  164. package/dist/fn/lightenDarkenHex.js +3 -3
  165. package/dist/fn/link.js +7 -11
  166. package/dist/fn/log.js +6 -10
  167. package/dist/fn/makeReactive.js +24 -28
  168. package/dist/fn/map.js +2 -3
  169. package/dist/fn/md5.js +1 -1
  170. package/dist/fn/money.js +5 -5
  171. package/dist/fn/move.js +2 -2
  172. package/dist/fn/multiorder.js +6 -7
  173. package/dist/fn/nl2br.js +1 -1
  174. package/dist/fn/numProperties.js +1 -1
  175. package/dist/fn/objectToFormData.js +5 -7
  176. package/dist/fn/order.js +1 -2
  177. package/dist/fn/outerHeight.js +3 -3
  178. package/dist/fn/outerWidth.js +3 -3
  179. package/dist/fn/percent.js +1 -1
  180. package/dist/fn/pickValue.js +1 -1
  181. package/dist/fn/post.js +3 -7
  182. package/dist/fn/postOut.js +2 -2
  183. package/dist/fn/printf.js +1 -1
  184. package/dist/fn/quotes2html.js +1 -1
  185. package/dist/fn/randomInt.js +1 -1
  186. package/dist/fn/randomString.js +6 -6
  187. package/dist/fn/removeAccents.js +1 -1
  188. package/dist/fn/removeEmpty.js +3 -3
  189. package/dist/fn/removeExtraSpaces.js +1 -1
  190. package/dist/fn/removeHtmlComments.js +1 -1
  191. package/dist/fn/removePrivateProp.js +2 -3
  192. package/dist/fn/removeTrailingChars.js +1 -1
  193. package/dist/fn/repeat.js +1 -1
  194. package/dist/fn/replaceAll.js +1 -2
  195. package/dist/fn/replaceSelection.js +6 -6
  196. package/dist/fn/resize.js +15 -15
  197. package/dist/fn/rgb2hex.js +1 -1
  198. package/dist/fn/riterate.js +1 -1
  199. package/dist/fn/roundDecimal.js +1 -1
  200. package/dist/fn/sanitize.js +6 -7
  201. package/dist/fn/search.js +6 -9
  202. package/dist/fn/selectElementText.js +4 -4
  203. package/dist/fn/selector.js +1 -1
  204. package/dist/fn/setCookie.js +4 -4
  205. package/dist/fn/setCssVar.js +1 -1
  206. package/dist/fn/setNavigationVars.js +5 -5
  207. package/dist/fn/setProp.js +1 -3
  208. package/dist/fn/setProperty.js +9 -9
  209. package/dist/fn/shorten.js +1 -1
  210. package/dist/fn/shortenObj.js +3 -4
  211. package/dist/fn/shuffle.js +3 -4
  212. package/dist/fn/simpleHash.js +3 -3
  213. package/dist/fn/simpleHash1.js +4 -4
  214. package/dist/fn/simpleHash2.js +4 -4
  215. package/dist/fn/stat.js +1 -1
  216. package/dist/fn/string2ArrayBuffer.js +1 -1
  217. package/dist/fn/submit.js +3 -3
  218. package/dist/fn/substr.js +1 -1
  219. package/dist/fn/sum.js +4 -4
  220. package/dist/fn/timestamp.js +1 -1
  221. package/dist/fn/toCSV.js +7 -10
  222. package/dist/fn/toggleFullScreen.js +1 -1
  223. package/dist/fn/translate.js +3 -3
  224. package/dist/fn/treatAjaxArguments.js +4 -4
  225. package/dist/fn/trim.js +1 -2
  226. package/dist/fn/uniqString.js +7 -14
  227. package/dist/fn/unique.js +1 -1
  228. package/dist/fn/upload.js +6 -6
  229. package/dist/fn/warning.js +3 -3
  230. package/dist/index.js +237 -241
  231. package/package.json +1 -1
@@ -1,7 +1,6 @@
1
1
  import { checkPropsDetails } from './checkPropsDetails';
2
- var checkPropsOrDie = function (obj, props, checkEmpty) {
3
- if (checkEmpty === void 0) { checkEmpty = false; }
4
- var res = checkPropsDetails(obj, props, checkEmpty);
2
+ const checkPropsOrDie = function (obj, props, checkEmpty = false) {
3
+ let res = checkPropsDetails(obj, props, checkEmpty);
5
4
  if (res.error) {
6
5
  throw new Error(res.error);
7
6
  }
@@ -5,18 +5,13 @@ import { isString } from './isString';
5
5
  import { correctCase } from './correctCase';
6
6
  import { error } from './error';
7
7
  import { log } from './log';
8
- var checkType = function (value, type, msg) {
9
- var logs = [];
10
- for (var _i = 3; _i < arguments.length; _i++) {
11
- logs[_i - 3] = arguments[_i];
12
- }
13
- var ok = false;
8
+ const checkType = function (value, type, msg, ...logs) {
9
+ let ok = false;
14
10
  if (!isArray(type)) {
15
11
  type = [type];
16
12
  }
17
- var typesList = [];
18
- each(type, function (t) {
19
- var _a;
13
+ const typesList = [];
14
+ each(type, (t) => {
20
15
  if (t === String) {
21
16
  t = 'string';
22
17
  }
@@ -36,14 +31,14 @@ var checkType = function (value, type, msg) {
36
31
  t = 'function';
37
32
  }
38
33
  if (isFunction(t)) {
39
- typesList.push(t.name || ((_a = t.constructor) === null || _a === void 0 ? void 0 : _a.name) || t.toString());
34
+ typesList.push(t.name || t.constructor?.name || t.toString());
40
35
  if (value instanceof t) {
41
36
  ok = true;
42
37
  return false;
43
38
  }
44
39
  }
45
40
  else if (!isString(t) || !isFunction(bbn.fn['is' + correctCase(t)])) {
46
- error("The type ".concat(t, " is not recognized"));
41
+ error(`The type ${t} is not recognized`);
47
42
  }
48
43
  else if (bbn.fn['is' + correctCase(t)](value)) {
49
44
  ok = true;
package/dist/fn/chrono.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { each } from './each';
2
- var _private = [];
3
- var startChrono = function (name) {
4
- var now = new Date().getTime();
5
- var h1 = 3600 * 1000;
2
+ const _private = [];
3
+ const startChrono = function (name) {
4
+ let now = new Date().getTime();
5
+ let h1 = 3600 * 1000;
6
6
  if (_private.length) {
7
- each(_private, function (t, n) {
7
+ each(_private, (t, n) => {
8
8
  if (now - t > h1) {
9
9
  delete _private[n];
10
10
  }
@@ -13,10 +13,10 @@ var startChrono = function (name) {
13
13
  }
14
14
  _private[name] = now;
15
15
  };
16
- var stopChrono = function (name) {
16
+ const stopChrono = function (name) {
17
17
  if (_private[name]) {
18
- var now = new Date().getTime();
19
- var diff = now - _private[name];
18
+ let now = new Date().getTime();
19
+ let diff = now - _private[name];
20
20
  return diff;
21
21
  }
22
22
  };
@@ -1,9 +1,9 @@
1
1
  import { isDom } from './isDom';
2
2
  import { isCp } from './isCp';
3
3
  import { log } from './log';
4
- var circularReplacer = function () {
5
- var visited = new WeakSet();
6
- return function (key, value) {
4
+ const circularReplacer = function () {
5
+ const visited = new WeakSet();
6
+ return (key, value) => {
7
7
  if (typeof value === 'object' && value !== null) {
8
8
  if (visited.has(value)) {
9
9
  return;
package/dist/fn/clone.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import { isArray } from './isArray';
2
2
  import { isObject } from './isObject';
3
3
  import { extend } from './extend';
4
- var clone = function (obj) {
4
+ const clone = function (obj) {
5
5
  if (isArray(obj)) {
6
- return obj.slice().map(function (a) {
6
+ return obj.slice().map((a) => {
7
7
  return typeof a === 'object' ? clone(a) : a;
8
8
  });
9
9
  }
10
10
  if (isObject(obj)) {
11
- var o = Object.create(Object.getPrototypeOf(obj));
11
+ const o = Object.create(Object.getPrototypeOf(obj));
12
12
  return extend(true, o, obj);
13
13
  }
14
14
  return obj;
@@ -1,5 +1,5 @@
1
- var colorToHex = function (color) {
2
- var canvas = document.createElement('canvas').getContext('2d');
1
+ const colorToHex = function (color) {
2
+ let canvas = document.createElement('canvas').getContext('2d');
3
3
  canvas.fillStyle = color;
4
4
  return canvas.fillStyle;
5
5
  };
@@ -3,7 +3,7 @@ import { removeAccents } from './removeAccents';
3
3
  import { isNull } from './isNull';
4
4
  import { isObject } from './isObject';
5
5
  import { isSame } from './isSame';
6
- var compare = function (v1, v2, operator) {
6
+ const compare = function (v1, v2, operator) {
7
7
  switch (operator) {
8
8
  case '===':
9
9
  case '=':
@@ -1,23 +1,23 @@
1
1
  import { isArray } from './isArray';
2
2
  import { each } from './each';
3
3
  import { getProperty } from './getProperty';
4
- var compareConditions = function (data, filter) {
4
+ const compareConditions = function (data, filter) {
5
5
  if (!filter.conditions || !filter.logic || !isArray(filter.conditions)) {
6
6
  throw new Error('Error in compareConditions: the filter should an abject with conditions and logic properties and conditions should be an array of objects');
7
7
  }
8
- var ok = filter.logic === 'AND' ? true : false;
9
- each(filter.conditions, function (a) {
10
- var compare;
8
+ let ok = filter.logic === 'AND' ? true : false;
9
+ each(filter.conditions, (a) => {
10
+ let compare;
11
11
  if (a.conditions && isArray(a.conditions)) {
12
12
  compare = compareConditions(data, a);
13
13
  }
14
14
  else {
15
15
  compare = compare(getProperty(data, a.field), a.value, a.operator);
16
16
  if (compare) {
17
- var bits = a.field.split('.');
18
- var prop = bits.pop();
17
+ let bits = a.field.split('.');
18
+ let prop = bits.pop();
19
19
  if (bits.length) {
20
- each(bits, function (b) { return (data = data[b]); });
20
+ each(bits, (b) => (data = data[b]));
21
21
  }
22
22
  // Case where both are undefined: value and prop which doesn't exist; they are not the same!
23
23
  if (getProperty(data, prop) === undefined && a.value !== undefined) {
package/dist/fn/copy.js CHANGED
@@ -1,19 +1,17 @@
1
1
  import { isObject } from './isObject';
2
2
  import { isFunction } from './isFunction';
3
- var copy = function (st) {
4
- return new Promise(function (resolve) {
5
- var _a;
3
+ const copy = function (st) {
4
+ return new Promise((resolve) => {
6
5
  if (st) {
7
6
  if (navigator && navigator.clipboard) {
8
7
  if (st instanceof Blob) {
9
- navigator.clipboard.write([new ClipboardItem((_a = {}, _a[st.type.toString()] = st, _a))]).then(function () {
8
+ navigator.clipboard.write([new ClipboardItem({ [st.type.toString()]: st })]).then(() => {
10
9
  resolve(true);
11
10
  });
12
11
  }
13
12
  else if (isObject(st) && isFunction(st.toBlob)) {
14
- st.toBlob(function (blob) {
15
- var _a;
16
- navigator.clipboard.write([new ClipboardItem((_a = {}, _a[blob.type.toString()] = blob, _a))]).then(function () {
13
+ st.toBlob((blob) => {
14
+ navigator.clipboard.write([new ClipboardItem({ [blob.type.toString()]: blob })]).then(() => {
17
15
  resolve(true);
18
16
  });
19
17
  });
@@ -24,7 +22,7 @@ var copy = function (st) {
24
22
  }
25
23
  return;
26
24
  }
27
- var input = document.createElement('textarea');
25
+ let input = document.createElement('textarea');
28
26
  input.style.opacity = '0';
29
27
  input.value = st;
30
28
  document.body.appendChild(input);
@@ -1,4 +1,4 @@
1
- var correctCase = function (str) {
2
- return str.replace(/[A-z]{1}/, function (c) { return c.toUpperCase(); });
1
+ const correctCase = function (str) {
2
+ return str.replace(/[A-z]{1}/, (c) => c.toUpperCase());
3
3
  };
4
4
  export { correctCase };
package/dist/fn/count.js CHANGED
@@ -1,7 +1,5 @@
1
1
  import { filter } from './filter';
2
- var count = function (arr, prop, val, operator) {
3
- if (val === void 0) { val = null; }
4
- if (operator === void 0) { operator = '='; }
2
+ const count = function (arr, prop, val = null, operator = '=') {
5
3
  return filter(arr, prop, val, operator).length || 0;
6
4
  };
7
5
  export { count };
package/dist/fn/crc32.js CHANGED
@@ -1,16 +1,16 @@
1
1
  // this is a test
2
- var crc32Table = [];
3
- for (var i = 0; i < 256; i++) {
4
- var c = i;
5
- for (var j = 0; j < 8; j++) {
2
+ const crc32Table = [];
3
+ for (let i = 0; i < 256; i++) {
4
+ let c = i;
5
+ for (let j = 0; j < 8; j++) {
6
6
  c = c & 1 ? 0xedb88320 ^ (c >>> 1) : c >>> 1;
7
7
  }
8
8
  crc32Table.push(c);
9
9
  }
10
- var crc32 = function (str) {
11
- var crc = 0 ^ -1;
12
- for (var i = 0; i < str.length; i++) {
13
- var charCode = str.charCodeAt(i);
10
+ const crc32 = function (str) {
11
+ let crc = 0 ^ -1;
12
+ for (let i = 0; i < str.length; i++) {
13
+ const charCode = str.charCodeAt(i);
14
14
  crc = (crc >>> 8) ^ crc32Table[(crc ^ charCode) & 0xff];
15
15
  }
16
16
  return (crc ^ -1) >>> 0; // Make sure the result is a 32-bit positive integer
@@ -1,21 +1,8 @@
1
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
3
- if (ar || !(i in from)) {
4
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
5
- ar[i] = from[i];
6
- }
7
- }
8
- return to.concat(ar || Array.prototype.slice.call(from));
9
- };
10
1
  import { extend } from './extend';
11
- var createObject = function () {
12
- var args = [];
13
- for (var _i = 0; _i < arguments.length; _i++) {
14
- args[_i] = arguments[_i];
15
- }
16
- var obj = Object.create(null);
2
+ const createObject = function (...args) {
3
+ const obj = Object.create(null);
17
4
  if (args.length) {
18
- extend.apply(void 0, __spreadArray([obj], args, false));
5
+ extend(obj, ...args);
19
6
  }
20
7
  return obj;
21
8
  };
@@ -1,10 +1,10 @@
1
1
  //import { log } from './log';
2
2
  import { escapeRegExp } from './escapeRegExp';
3
- var cssExists = function (f) {
4
- var ok;
5
- var rules;
6
- var css = document.styleSheets;
7
- for (var sx = 0; sx < css.length; sx++) {
3
+ const cssExists = function (f) {
4
+ let ok;
5
+ let rules;
6
+ let css = document.styleSheets;
7
+ for (let sx = 0; sx < css.length; sx++) {
8
8
  ok = 1;
9
9
  try {
10
10
  rules = css[sx].rules || css[sx].cssRules;
@@ -17,7 +17,7 @@ var cssExists = function (f) {
17
17
  }
18
18
  if (ok) {
19
19
  //log(rules);
20
- for (var cx = 0; cx < rules.length; cx++) {
20
+ for (let cx = 0; cx < rules.length; cx++) {
21
21
  //log(rules[cx].selectorText);
22
22
  if (new RegExp('(^|\\s)' + escapeRegExp(f) + '(\\{|\\s)', 'g').test(rules[cx].selectorText)) {
23
23
  return true;
package/dist/fn/date.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { isNumber } from './isNumber';
2
2
  import { substr } from './substr';
3
3
  import { isDate } from './isDate';
4
- var date = function (v) {
5
- var d = false, t = typeof v;
4
+ const date = function (v) {
5
+ let d = false, t = typeof v;
6
6
  if (v === undefined) {
7
7
  return new Date();
8
8
  }
@@ -1,6 +1,6 @@
1
1
  import { date } from './date';
2
- var dateSQL = function (v, dayOnly) {
3
- var value = date(v);
2
+ const dateSQL = function (v, dayOnly) {
3
+ let value = date(v);
4
4
  if (value) {
5
5
  return dayjs(value).format('YYYY-MM-DD' + (dayOnly ? '' : ' HH:mm:ss'));
6
6
  }
@@ -1,6 +1,6 @@
1
1
  import { date } from './date';
2
- var daysInMonth = function (v) {
3
- var d = date(v);
2
+ const daysInMonth = function (v) {
3
+ let d = date(v);
4
4
  if (d) {
5
5
  return dayjs(d).daysInMonth();
6
6
  }
@@ -1,19 +1,18 @@
1
1
  import { search } from './search';
2
2
  import { each } from './each';
3
3
  import { isArray } from './isArray';
4
- var deepPath = function (arr, filter, deepProperty, res) {
5
- if (res === void 0) { res = []; }
6
- var idx;
7
- var start = 0;
4
+ const deepPath = function (arr, filter, deepProperty, res = []) {
5
+ let idx;
6
+ let start = 0;
8
7
  if ((idx = search(arr, filter, start)) > -1) {
9
8
  res.push(idx);
10
9
  return res;
11
10
  }
12
- each(arr, function (it, i) {
11
+ each(arr, (it, i) => {
13
12
  if (isArray(it[deepProperty])) {
14
- var r = res.slice();
13
+ let r = res.slice();
15
14
  r.push(i);
16
- var tmp = deepPath(it[deepProperty], filter, deepProperty, r);
15
+ let tmp = deepPath(it[deepProperty], filter, deepProperty, r);
17
16
  if (tmp !== false) {
18
17
  return tmp;
19
18
  }
@@ -1,6 +1,5 @@
1
1
  import { log } from './log';
2
- var defaultAjaxAbortFunction = function (message, url) {
3
- if (url === void 0) { url = ''; }
2
+ const defaultAjaxAbortFunction = function (message, url = '') {
4
3
  log(message);
5
4
  };
6
5
  export { defaultAjaxAbortFunction };
@@ -1,4 +1,4 @@
1
- var defaultAjaxErrorFunction = function (jqXHR, textStatus, errorThrown) {
1
+ const defaultAjaxErrorFunction = function (jqXHR, textStatus, errorThrown) {
2
2
  return false;
3
3
  };
4
4
  export { defaultAjaxErrorFunction };
@@ -1,4 +1,4 @@
1
- var defaultAlertFunction = function (msg, title) {
1
+ const defaultAlertFunction = function (msg, title) {
2
2
  /** @todo */
3
3
  alert(msg);
4
4
  };
@@ -1,6 +1,6 @@
1
1
  import { isFunction } from './isFunction';
2
- var defaultConfirmFunction = function (text, yesFn, noFn) {
3
- var ok = 0;
2
+ const defaultConfirmFunction = function (text, yesFn, noFn) {
3
+ let ok = 0;
4
4
  if (confirm(text)) {
5
5
  if (isFunction(yesFn)) {
6
6
  yesFn();
@@ -1,4 +1,4 @@
1
- var defaultEndLoadingFunction = function (url, timestamp, data, res) {
1
+ const defaultEndLoadingFunction = function (url, timestamp, data, res) {
2
2
  return true;
3
3
  };
4
4
  export { defaultEndLoadingFunction };
@@ -1,5 +1,5 @@
1
1
  import { log } from './log';
2
- var defaultErrorFunction = function (message) {
2
+ const defaultErrorFunction = function (message) {
3
3
  log(message);
4
4
  };
5
5
  export { defaultErrorFunction };
@@ -1,4 +1,4 @@
1
- var defaultHistoryFunction = function (obj) {
1
+ const defaultHistoryFunction = function (obj) {
2
2
  return true;
3
3
  };
4
4
  export { defaultHistoryFunction };
@@ -1,4 +1,4 @@
1
- var defaultLinkFunction = function (responseObj, ele) {
1
+ const defaultLinkFunction = function (responseObj, ele) {
2
2
  return true;
3
3
  };
4
4
  export { defaultLinkFunction };
@@ -1,4 +1,4 @@
1
- var defaultPostLinkFunction = function (r, ele) {
1
+ const defaultPostLinkFunction = function (r, ele) {
2
2
  return true;
3
3
  };
4
4
  export { defaultPostLinkFunction };
@@ -1,4 +1,4 @@
1
- var defaultPreLinkFunction = function (url, force, ele) {
1
+ const defaultPreLinkFunction = function (url, force, ele) {
2
2
  return url;
3
3
  };
4
4
  export { defaultPreLinkFunction };
@@ -1,4 +1,4 @@
1
- var defaultResizeFunction = function () {
1
+ const defaultResizeFunction = function () {
2
2
  return true;
3
3
  };
4
4
  export { defaultResizeFunction };
@@ -1,5 +1,4 @@
1
- var defaultStartLoadingFunction = function (url, tst, data, requestId) {
2
- if (requestId === void 0) { requestId = null; }
1
+ const defaultStartLoadingFunction = function (url, tst, data, requestId = null) {
3
2
  return true;
4
3
  };
5
4
  export { defaultStartLoadingFunction };
@@ -1,5 +1,5 @@
1
1
  import { checkType } from './checkType';
2
- var deleteProp = function (obj, prop) {
2
+ const deleteProp = function (obj, prop) {
3
3
  checkType(obj, 'object', bbn._('The obj must be an object in setProp'));
4
4
  checkType(prop, 'string', bbn._('The prop must be a string in setProp'));
5
5
  delete obj[prop];
@@ -4,14 +4,12 @@ import { isFunction } from './isFunction';
4
4
  import { isValue } from './isValue';
5
5
  import { isDom } from './isDom';
6
6
  import { numProperties } from './numProperties';
7
- var diffObjProcessed = [];
8
- var diffObj = function (obj1, obj2, unchanged, notRoot) {
9
- if (unchanged === void 0) { unchanged = false; }
10
- if (notRoot === void 0) { notRoot = false; }
7
+ let diffObjProcessed = [];
8
+ const diffObj = function (obj1, obj2, unchanged = false, notRoot = false) {
11
9
  if (!notRoot) {
12
10
  diffObjProcessed = [];
13
11
  }
14
- var VALUE_CREATED = 'created', VALUE_UPDATED = 'updated', VALUE_DELETED = 'deleted', VALUE_UNCHANGED = 'unchanged', _compareValues = function (value1, value2) {
12
+ let VALUE_CREATED = 'created', VALUE_UPDATED = 'updated', VALUE_DELETED = 'deleted', VALUE_UNCHANGED = 'unchanged', _compareValues = function (value1, value2) {
15
13
  if (value1 === value2) {
16
14
  return VALUE_UNCHANGED;
17
15
  }
@@ -29,12 +27,12 @@ var diffObj = function (obj1, obj2, unchanged, notRoot) {
29
27
  if (notRoot === undefined) {
30
28
  notRoot = false;
31
29
  }
32
- var diff = createObject();
30
+ let diff = createObject();
33
31
  if (!isFunction(obj1) && !isFunction(obj2)) {
34
32
  if (isValue(obj1) || isValue(obj2)) {
35
- var res = _compareValues(obj1, obj2);
33
+ let res = _compareValues(obj1, obj2);
36
34
  if (unchanged || res !== VALUE_UNCHANGED) {
37
- var ret = createObject();
35
+ let ret = createObject();
38
36
  Object.defineProperty(ret, 'type', {
39
37
  value: res,
40
38
  enumerable: false,
@@ -65,24 +63,24 @@ var diffObj = function (obj1, obj2, unchanged, notRoot) {
65
63
  return false;
66
64
  }
67
65
  diffObjProcessed.push(obj1, obj2);
68
- for (var key in obj1) {
66
+ for (let key in obj1) {
69
67
  if (isFunction(obj1[key])) {
70
68
  continue;
71
69
  }
72
- var value2 = undefined;
70
+ let value2 = undefined;
73
71
  if ('undefined' != typeof obj2[key]) {
74
72
  value2 = obj2[key];
75
73
  }
76
- var res = diffObj(obj1[key], value2, unchanged, true);
74
+ let res = diffObj(obj1[key], value2, unchanged, true);
77
75
  if (res) {
78
76
  diff[key] = res;
79
77
  }
80
78
  }
81
- for (var key in obj2) {
79
+ for (let key in obj2) {
82
80
  if (isFunction(obj2[key]) || 'undefined' != typeof obj1[key]) {
83
81
  continue;
84
82
  }
85
- var res = diffObj(undefined, obj2[key], unchanged, true);
83
+ let res = diffObj(undefined, obj2[key], unchanged, true);
86
84
  if (res) {
87
85
  diff[key] = res;
88
86
  }
@@ -1,11 +1,11 @@
1
1
  import { isString } from './isString';
2
2
  import { substr } from './substr';
3
- var dirName = function (path) {
3
+ const dirName = function (path) {
4
4
  if (isString(path) && path) {
5
5
  while (substr(path, path.length - 1) === '/') {
6
6
  path = substr(path, 0, path.length - 1);
7
7
  }
8
- var pos = path.lastIndexOf('/');
8
+ let pos = path.lastIndexOf('/');
9
9
  if (pos > 0) {
10
10
  return substr(path, 0, pos);
11
11
  }
@@ -5,15 +5,15 @@ import { isBlob } from './isBlob';
5
5
  import { fileExt } from './fileExt';
6
6
  import { downloadContent } from './downloadContent';
7
7
  import { defaultAjaxErrorFunction } from './defaultAjaxErrorFunction';
8
- var download = function (url, filename, params) {
8
+ const download = function (url, filename, params) {
9
9
  // We can intervert the arguments
10
10
  if (filename && (typeof (filename) === 'object')) {
11
11
  params = filename;
12
12
  filename = null;
13
13
  }
14
- return ajax(url, 'blob', params || { _bbn_download: 1 }, function (d, headers) {
14
+ return ajax(url, 'blob', params || { _bbn_download: 1 }, (d, headers) => {
15
15
  if (!filename) {
16
- var cd = 'attachment; filename=';
16
+ let cd = 'attachment; filename=';
17
17
  if (headers && headers['content-disposition'] && headers['content-disposition'].indexOf(cd) === 0) {
18
18
  filename = substr(headers['content-disposition'], cd.length + 1, headers['content-disposition'].length - cd.length - 2);
19
19
  }
@@ -22,14 +22,14 @@ var download = function (url, filename, params) {
22
22
  }
23
23
  }
24
24
  if (isBlob(d)) {
25
- var extension = fileExt(filename);
26
- var htmlExtensions = ['php', 'html'];
25
+ let extension = fileExt(filename);
26
+ let htmlExtensions = ['php', 'html'];
27
27
  if ((typeof filename === 'string') && ((('type' in d) && (d.type !== 'text/html')) || htmlExtensions.includes(extension))) {
28
28
  downloadContent(filename, d);
29
29
  return;
30
30
  }
31
31
  }
32
- }, function (e) {
32
+ }, e => {
33
33
  defaultAjaxErrorFunction(e);
34
34
  });
35
35
  };
@@ -2,11 +2,11 @@ import { isCanvas } from './isCanvas';
2
2
  import { isObject } from './isObject';
3
3
  import { isString } from './isString';
4
4
  import { log } from './log';
5
- var downloadContent = function (filename, content, type) {
5
+ const downloadContent = function (filename, content, type) {
6
6
  if (isCanvas(content)) {
7
- content.toBlob(function (blob) {
7
+ content.toBlob((blob) => {
8
8
  // blob ready, download it
9
- var a = document.createElement('a');
9
+ let a = document.createElement('a');
10
10
  a.download = filename;
11
11
  a.href = window.URL.createObjectURL(blob);
12
12
  a.className = 'bbn-no';
@@ -22,9 +22,9 @@ var downloadContent = function (filename, content, type) {
22
22
  else if (type.indexOf('/') === -1) {
23
23
  type = 'text/' + type;
24
24
  }
25
- var a = window.document.createElement('a');
25
+ let a = window.document.createElement('a');
26
26
  a.className = 'bbn-no';
27
- var src = null;
27
+ let src = null;
28
28
  if (isString(content)) {
29
29
  src = new Blob([content], { type: type });
30
30
  }
package/dist/fn/each.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { isNumber } from './isNumber';
2
2
  import { isIterable } from './isIterable';
3
3
  import { iterate } from './iterate';
4
- var each = function (arr, fn) {
4
+ const each = function (arr, fn) {
5
5
  if (isNumber(arr) && arr > 0) {
6
- for (var i = 0; i < arr; i++) {
6
+ for (let i = 0; i < arr; i++) {
7
7
  if (fn(i, i) === false) {
8
8
  return;
9
9
  }
@@ -11,7 +11,7 @@ var each = function (arr, fn) {
11
11
  return;
12
12
  }
13
13
  if (isIterable(arr)) {
14
- for (var i = 0; i < arr.length; i++) {
14
+ for (let i = 0; i < arr.length; i++) {
15
15
  if (fn(arr[i], i) === false) {
16
16
  return;
17
17
  }
@@ -1,4 +1,4 @@
1
- var eraseCookie = function (name) {
1
+ const eraseCookie = function (name) {
2
2
  document.cookie = name + '=; Max-Age=-99999999;';
3
3
  };
4
4
  export { eraseCookie };
package/dist/fn/error.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { log } from './log';
2
- var error = function (errorMsg) {
2
+ const error = function (errorMsg) {
3
3
  if (arguments.length > 1) {
4
- var args = [];
5
- for (var i = 1; i < arguments.length; i++) {
4
+ const args = [];
5
+ for (let i = 1; i < arguments.length; i++) {
6
6
  args.push(arguments[i]);
7
7
  }
8
8
  args.unshift({