@bbn/bbn 1.0.117 → 1.0.119

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 (245) hide show
  1. package/dist/$.js +1 -1
  2. package/dist/_.js +11 -7
  3. package/dist/bundle-webpack.js +77 -0
  4. package/dist/bundle-webpack.js.map +1 -0
  5. package/dist/bundle.js +13374 -9875
  6. package/dist/bundle.js.map +1 -0
  7. package/dist/db.js +82 -81
  8. package/dist/env.js +1 -1
  9. package/dist/fn/ajax/_addLoader.js +6 -6
  10. package/dist/fn/ajax/_deleteLoader.js +16 -14
  11. package/dist/fn/ajax/abort.js +3 -3
  12. package/dist/fn/ajax/abortURL.js +4 -4
  13. package/dist/fn/ajax/ajax.js +36 -31
  14. package/dist/fn/ajax/callback.js +14 -10
  15. package/dist/fn/ajax/download.js +15 -13
  16. package/dist/fn/ajax/downloadContent.js +10 -9
  17. package/dist/fn/ajax/getLoader.js +3 -3
  18. package/dist/fn/ajax/getRequestId.js +5 -5
  19. package/dist/fn/ajax/link.js +20 -16
  20. package/dist/fn/ajax/post.js +10 -6
  21. package/dist/fn/ajax/postOut.js +7 -5
  22. package/dist/fn/ajax/setNavigationVars.js +11 -9
  23. package/dist/fn/ajax/treatAjaxArguments.js +8 -8
  24. package/dist/fn/ajax/upload.js +11 -8
  25. package/dist/fn/browser/copy.js +10 -8
  26. package/dist/fn/browser/eraseCookie.js +1 -1
  27. package/dist/fn/browser/error.js +4 -4
  28. package/dist/fn/browser/getBrowserName.js +2 -2
  29. package/dist/fn/browser/getBrowserVersion.js +2 -2
  30. package/dist/fn/browser/getCookie.js +6 -6
  31. package/dist/fn/browser/getDeviceType.js +2 -2
  32. package/dist/fn/browser/getEventData.js +33 -33
  33. package/dist/fn/browser/happy.js +6 -2
  34. package/dist/fn/browser/history.js +1 -1
  35. package/dist/fn/browser/info.js +6 -2
  36. package/dist/fn/browser/isActiveInterface.js +3 -2
  37. package/dist/fn/browser/isDesktopDevice.js +2 -2
  38. package/dist/fn/browser/isFocused.js +2 -1
  39. package/dist/fn/browser/isMobile.js +3 -3
  40. package/dist/fn/browser/isMobileDevice.js +2 -2
  41. package/dist/fn/browser/isTabletDevice.js +2 -2
  42. package/dist/fn/browser/log.js +13 -9
  43. package/dist/fn/browser/replaceSelection.js +6 -6
  44. package/dist/fn/browser/selectElementText.js +5 -4
  45. package/dist/fn/browser/setCookie.js +4 -4
  46. package/dist/fn/browser/toggleFullScreen.js +2 -2
  47. package/dist/fn/browser/warning.js +4 -4
  48. package/dist/fn/convert/arrayBuffer2String.js +1 -1
  49. package/dist/fn/convert/canvasToImage.js +2 -2
  50. package/dist/fn/convert/colorToHex.js +2 -2
  51. package/dist/fn/convert/fromXml.js +14 -8
  52. package/dist/fn/convert/hex2rgb.js +1 -1
  53. package/dist/fn/convert/imageToCanvas.js +2 -2
  54. package/dist/fn/convert/imgToBase64.js +4 -3
  55. package/dist/fn/convert/rgb2hex.js +1 -1
  56. package/dist/fn/convert/string2ArrayBuffer.js +1 -1
  57. package/dist/fn/convert/toCSV.js +13 -10
  58. package/dist/fn/datetime/calendar.js +11 -10
  59. package/dist/fn/datetime/chrono.js +9 -9
  60. package/dist/fn/datetime/date.js +5 -5
  61. package/dist/fn/datetime/dateSQL.d.ts +1 -1
  62. package/dist/fn/datetime/dateSQL.js +4 -4
  63. package/dist/fn/datetime/daysInMonth.js +3 -3
  64. package/dist/fn/datetime/fdate.js +7 -6
  65. package/dist/fn/datetime/fdatetime.js +6 -5
  66. package/dist/fn/datetime/formatDate.js +1 -1
  67. package/dist/fn/datetime/ftime.js +5 -5
  68. package/dist/fn/datetime/getDay.js +5 -5
  69. package/dist/fn/datetime/timestamp.js +3 -2
  70. package/dist/fn/default/defaultAjaxAbortFunction.js +3 -2
  71. package/dist/fn/default/defaultAjaxErrorFunction.js +4 -2
  72. package/dist/fn/default/defaultAlertFunction.js +2 -1
  73. package/dist/fn/default/defaultConfirmFunction.js +4 -3
  74. package/dist/fn/default/defaultEndLoadingFunction.js +3 -1
  75. package/dist/fn/default/defaultErrorFunction.js +2 -2
  76. package/dist/fn/default/defaultHistoryFunction.js +1 -1
  77. package/dist/fn/default/defaultLinkFunction.js +1 -1
  78. package/dist/fn/default/defaultPostLinkFunction.js +2 -1
  79. package/dist/fn/default/defaultPreLinkFunction.js +4 -2
  80. package/dist/fn/default/defaultResizeFunction.js +1 -1
  81. package/dist/fn/default/defaultStartLoadingFunction.js +3 -1
  82. package/dist/fn/form/addInputs.js +13 -11
  83. package/dist/fn/form/fieldValue.js +2 -2
  84. package/dist/fn/form/formdata.js +29 -29
  85. package/dist/fn/form/objectToFormData.js +13 -10
  86. package/dist/fn/form/submit.js +5 -5
  87. package/dist/fn/html/adjustHeight.js +4 -4
  88. package/dist/fn/html/adjustSize.js +7 -7
  89. package/dist/fn/html/adjustWidth.js +4 -4
  90. package/dist/fn/html/getAllTags.js +3 -3
  91. package/dist/fn/html/getAncestors.js +3 -2
  92. package/dist/fn/html/getAttributes.js +4 -4
  93. package/dist/fn/html/getHTMLOfSelection.js +6 -6
  94. package/dist/fn/html/getHtml.js +4 -3
  95. package/dist/fn/html/getPath.js +24 -17
  96. package/dist/fn/html/getText.js +1 -1
  97. package/dist/fn/html/html2text.js +2 -2
  98. package/dist/fn/html/isInside.js +9 -9
  99. package/dist/fn/html/makeReactive.js +35 -31
  100. package/dist/fn/html/selector.js +1 -1
  101. package/dist/fn/init.js +28 -28
  102. package/dist/fn/loop/each.js +6 -6
  103. package/dist/fn/loop/fori.js +7 -5
  104. package/dist/fn/loop/forir.js +7 -5
  105. package/dist/fn/loop/iterate.js +7 -4
  106. package/dist/fn/loop/riterate.js +3 -2
  107. package/dist/fn/misc/analyzeFunction.js +30 -30
  108. package/dist/fn/misc/getTimeoff.js +1 -1
  109. package/dist/fn/misc/money.js +6 -6
  110. package/dist/fn/misc/percent.js +1 -1
  111. package/dist/fn/misc/randomInt.js +1 -1
  112. package/dist/fn/misc/roundDecimal.js +1 -1
  113. package/dist/fn/misc/translate.js +4 -4
  114. package/dist/fn/object/_compareValues.js +7 -6
  115. package/dist/fn/object/arrayFromProp.js +5 -5
  116. package/dist/fn/object/autoExtend.js +2 -2
  117. package/dist/fn/object/checkProps.js +3 -2
  118. package/dist/fn/object/checkPropsDetails.js +13 -12
  119. package/dist/fn/object/checkPropsOrDie.js +4 -3
  120. package/dist/fn/object/circularReplacer.js +6 -6
  121. package/dist/fn/object/clone.js +6 -6
  122. package/dist/fn/object/compare.js +6 -6
  123. package/dist/fn/object/compareConditions.js +11 -11
  124. package/dist/fn/object/count.js +4 -2
  125. package/dist/fn/object/createObject.js +17 -4
  126. package/dist/fn/object/deepPath.js +10 -9
  127. package/dist/fn/object/deleteProp.js +2 -2
  128. package/dist/fn/object/diffObj.js +19 -17
  129. package/dist/fn/object/extend.js +17 -13
  130. package/dist/fn/object/extendOut.js +10 -5
  131. package/dist/fn/object/filter.d.ts +1 -1
  132. package/dist/fn/object/filter.js +12 -10
  133. package/dist/fn/object/filterToConditions.js +10 -9
  134. package/dist/fn/object/findAll.js +8 -7
  135. package/dist/fn/object/getField.js +6 -3
  136. package/dist/fn/object/getFieldValues.js +6 -6
  137. package/dist/fn/object/getProp.js +2 -2
  138. package/dist/fn/object/getProperty.js +2 -2
  139. package/dist/fn/object/getRow.js +4 -2
  140. package/dist/fn/object/map.js +4 -3
  141. package/dist/fn/object/move.js +2 -2
  142. package/dist/fn/object/multiorder.js +8 -7
  143. package/dist/fn/object/numProperties.js +1 -1
  144. package/dist/fn/object/order.js +3 -2
  145. package/dist/fn/object/pickValue.js +1 -1
  146. package/dist/fn/object/removeEmpty.js +6 -6
  147. package/dist/fn/object/removePrivateProp.js +4 -3
  148. package/dist/fn/object/search.d.ts +1 -1
  149. package/dist/fn/object/search.js +15 -12
  150. package/dist/fn/object/setProp.js +3 -1
  151. package/dist/fn/object/setProperty.js +10 -10
  152. package/dist/fn/object/shortenObj.js +8 -7
  153. package/dist/fn/object/shuffle.js +4 -3
  154. package/dist/fn/object/sum.js +6 -6
  155. package/dist/fn/object/unique.js +1 -1
  156. package/dist/fn/string/baseName.js +6 -6
  157. package/dist/fn/string/br2nl.js +2 -2
  158. package/dist/fn/string/camelToCss.js +1 -1
  159. package/dist/fn/string/camelize.js +1 -1
  160. package/dist/fn/string/correctCase.js +2 -2
  161. package/dist/fn/string/crc32.js +8 -8
  162. package/dist/fn/string/dirName.js +4 -4
  163. package/dist/fn/string/escapeDquotes.js +2 -2
  164. package/dist/fn/string/escapeRegExp.js +1 -1
  165. package/dist/fn/string/escapeSquotes.js +2 -2
  166. package/dist/fn/string/escapeTicks.js +2 -2
  167. package/dist/fn/string/escapeUrl.js +11 -11
  168. package/dist/fn/string/fileExt.js +3 -3
  169. package/dist/fn/string/format.js +6 -6
  170. package/dist/fn/string/formatBytes.js +3 -2
  171. package/dist/fn/string/formatSize.js +3 -3
  172. package/dist/fn/string/hash.js +9 -9
  173. package/dist/fn/string/md5.js +1 -1
  174. package/dist/fn/string/nl2br.js +2 -2
  175. package/dist/fn/string/printf.js +1 -1
  176. package/dist/fn/string/quotes2html.js +2 -2
  177. package/dist/fn/string/randomString.js +7 -7
  178. package/dist/fn/string/removeAccents.js +3 -3
  179. package/dist/fn/string/removeExtraSpaces.js +1 -1
  180. package/dist/fn/string/removeHtmlComments.js +2 -2
  181. package/dist/fn/string/removeTrailingChars.js +2 -2
  182. package/dist/fn/string/repeat.js +1 -1
  183. package/dist/fn/string/replaceAll.js +4 -3
  184. package/dist/fn/string/sanitize.js +9 -8
  185. package/dist/fn/string/shorten.js +3 -3
  186. package/dist/fn/string/simpleHash.js +5 -5
  187. package/dist/fn/string/simpleHash1.js +4 -4
  188. package/dist/fn/string/simpleHash2.js +4 -4
  189. package/dist/fn/string/substr.js +4 -4
  190. package/dist/fn/string/trim.js +3 -2
  191. package/dist/fn/string/uniqString.js +17 -10
  192. package/dist/fn/style/addColors.js +17 -17
  193. package/dist/fn/style/addStyle.js +4 -4
  194. package/dist/fn/style/animateCss.js +4 -4
  195. package/dist/fn/style/center.js +2 -2
  196. package/dist/fn/style/cssExists.js +8 -8
  197. package/dist/fn/style/getCssVar.js +1 -1
  198. package/dist/fn/style/getScrollBarSize.js +6 -6
  199. package/dist/fn/style/lightenDarkenHex.js +3 -3
  200. package/dist/fn/style/outerHeight.js +4 -4
  201. package/dist/fn/style/outerWidth.js +4 -4
  202. package/dist/fn/style/resize.js +17 -17
  203. package/dist/fn/style/setCssVar.js +1 -1
  204. package/dist/fn/type/checkType.js +16 -12
  205. package/dist/fn/type/isArray.js +7 -2
  206. package/dist/fn/type/isBlob.js +7 -2
  207. package/dist/fn/type/isBoolean.js +7 -2
  208. package/dist/fn/type/isCanvas.js +7 -2
  209. package/dist/fn/type/isColor.js +8 -3
  210. package/dist/fn/type/isComment.js +7 -2
  211. package/dist/fn/type/isCp.js +9 -4
  212. package/dist/fn/type/isDate.js +7 -2
  213. package/dist/fn/type/isDimension.js +8 -3
  214. package/dist/fn/type/isDom.js +7 -2
  215. package/dist/fn/type/isEmail.js +9 -4
  216. package/dist/fn/type/isEmpty.js +3 -3
  217. package/dist/fn/type/isEvent.js +7 -2
  218. package/dist/fn/type/isFunction.js +7 -2
  219. package/dist/fn/type/isHostname.js +9 -4
  220. package/dist/fn/type/isIP.js +8 -3
  221. package/dist/fn/type/isInt.js +7 -2
  222. package/dist/fn/type/isIterable.js +7 -2
  223. package/dist/fn/type/isNull.js +7 -2
  224. package/dist/fn/type/isNumber.js +7 -2
  225. package/dist/fn/type/isObject.js +7 -2
  226. package/dist/fn/type/isPercent.js +7 -2
  227. package/dist/fn/type/isPrimitive.js +7 -2
  228. package/dist/fn/type/isPromise.js +7 -2
  229. package/dist/fn/type/isPropSize.js +4 -4
  230. package/dist/fn/type/isSQLDate.js +7 -2
  231. package/dist/fn/type/isSame.js +9 -9
  232. package/dist/fn/type/isString.js +7 -2
  233. package/dist/fn/type/isSymbol.js +7 -2
  234. package/dist/fn/type/isURL.js +7 -2
  235. package/dist/fn/type/isValidDimension.js +5 -5
  236. package/dist/fn/type/isValidName.js +8 -3
  237. package/dist/fn/type/isValue.js +8 -3
  238. package/dist/fn/type/isVue.js +11 -4
  239. package/dist/fn.d.ts +1 -1
  240. package/dist/fn.js +456 -456
  241. package/dist/index.d.ts +5 -5
  242. package/dist/index.js +1241 -920
  243. package/dist/lng.js +1 -1
  244. package/dist/vars.js +1 -1
  245. package/package.json +8 -5
@@ -1,9 +1,10 @@
1
- import { isArray } from "../type/isArray.js";
2
- import { isObject } from "../type/isObject.js";
3
- import { each } from "../loop/each.js";
4
- import { substr } from "../string/substr.js";
5
- const checkPropsDetails = function (obj, props, checkEmpty = false) {
6
- let res = {
1
+ import { isArray } from '../type/isArray.js';
2
+ import { isObject } from '../type/isObject.js';
3
+ import { each } from '../loop/each.js';
4
+ import { substr } from '../string/substr.js';
5
+ var checkPropsDetails = function (obj, props, checkEmpty) {
6
+ if (checkEmpty === void 0) { checkEmpty = false; }
7
+ var res = {
7
8
  error: false,
8
9
  result: true,
9
10
  };
@@ -17,23 +18,23 @@ const checkPropsDetails = function (obj, props, checkEmpty = false) {
17
18
  res.error = bbn._("checkProps must receive an object as obj argument");
18
19
  }
19
20
  if (!res.error) {
20
- let check;
21
- each(props, (varName) => {
21
+ var check_1;
22
+ each(props, function (varName) {
22
23
  varName = varName.trim().split(":");
23
- let type = varName[1] || false;
24
+ var type = varName[1] || false;
24
25
  varName = varName[0];
25
26
  if (obj[varName] === undefined) {
26
27
  res.error = varName + " " + bbn._("is not defined");
27
28
  }
28
29
  else if (type) {
29
- check =
30
+ check_1 =
30
31
  "is" +
31
32
  substr(type, 0, 1).toUpperCase() +
32
33
  substr(type, 1).toLowerCase();
33
- if (bbn.fn[check] === undefined) {
34
+ if (bbn.fn[check_1] === undefined) {
34
35
  res.error = type + " " + bbn._("is not a valid type");
35
36
  }
36
- else if (!bbn.fn[check](obj[varName])) {
37
+ else if (!bbn.fn[check_1](obj[varName])) {
37
38
  res.error = varName + " " + bbn._("is not a") + " " + type;
38
39
  }
39
40
  }
@@ -1,6 +1,7 @@
1
- import { checkPropsDetails } from "./checkPropsDetails.js";
2
- const checkPropsOrDie = function (obj, props, checkEmpty = false) {
3
- let res = checkPropsDetails(obj, props, checkEmpty);
1
+ import { checkPropsDetails } from './checkPropsDetails.js';
2
+ var checkPropsOrDie = function (obj, props, checkEmpty) {
3
+ if (checkEmpty === void 0) { checkEmpty = false; }
4
+ var res = checkPropsDetails(obj, props, checkEmpty);
4
5
  if (res.error) {
5
6
  throw new Error(res.error);
6
7
  }
@@ -1,14 +1,14 @@
1
- import { isDom } from "../type/isDom.js";
2
- import { isCp } from "../type/isCp.js";
3
- import { log } from "../browser/log.js";
1
+ import { isDom } from '../type/isDom.js';
2
+ import { isCp } from '../type/isCp.js';
3
+ import { log } from '../browser/log.js';
4
4
  /**
5
5
  * Returns a function to give to JSON.stringify in order to avoid circular values.
6
6
  *
7
7
  * @returns Function
8
8
  */
9
- const circularReplacer = function () {
10
- const visited = new WeakSet();
11
- return (key, value) => {
9
+ var circularReplacer = function () {
10
+ var visited = new WeakSet();
11
+ return function (key, value) {
12
12
  if (typeof value === "object" && value !== null) {
13
13
  if (visited.has(value)) {
14
14
  return;
@@ -1,6 +1,6 @@
1
- import { isArray } from "../type/isArray.js";
2
- import { isObject } from "../type/isObject.js";
3
- import { extend } from "./extend.js";
1
+ import { isArray } from '../type/isArray.js';
2
+ import { isObject } from '../type/isObject.js';
3
+ import { extend } from './extend.js';
4
4
  /**
5
5
  * Creates and returns a perfect clone - but different - from the given object.
6
6
  *
@@ -18,14 +18,14 @@ import { extend } from "./extend.js";
18
18
  * @param {Object} obj The source object
19
19
  * @returns {Object} A new object
20
20
  */
21
- const clone = function (obj) {
21
+ var clone = function (obj) {
22
22
  if (isArray(obj)) {
23
- return obj.slice().map((a) => {
23
+ return obj.slice().map(function (a) {
24
24
  return typeof a === "object" ? clone(a) : a;
25
25
  });
26
26
  }
27
27
  if (isObject(obj)) {
28
- const o = Object.create(Object.getPrototypeOf(obj));
28
+ var o = Object.create(Object.getPrototypeOf(obj));
29
29
  return extend(true, o, obj);
30
30
  }
31
31
  return obj;
@@ -1,8 +1,8 @@
1
- import { isEmpty } from "../type/isEmpty.js";
2
- import { removeAccents } from "../string/removeAccents.js";
3
- import { isNull } from "../type/isNull.js";
4
- import { isObject } from "../type/isObject.js";
5
- import { isSame } from "../type/isSame.js";
1
+ import { isEmpty } from '../type/isEmpty.js';
2
+ import { removeAccents } from '../string/removeAccents.js';
3
+ import { isNull } from '../type/isNull.js';
4
+ import { isObject } from '../type/isObject.js';
5
+ import { isSame } from '../type/isSame.js';
6
6
  /**
7
7
  * Performs a comparison between two values based on the given operator and returns a boolean.
8
8
  *
@@ -54,7 +54,7 @@ import { isSame } from "../type/isSame.js";
54
54
  * @param {String} operator
55
55
  * @returns {Boolean} True if the values' comparison complies with the operator, false otherwise
56
56
  */
57
- const compare = function (v1, v2, operator) {
57
+ var compare = function (v1, v2, operator) {
58
58
  switch (operator) {
59
59
  case '===':
60
60
  case '=':
@@ -1,7 +1,7 @@
1
- import { isArray } from "../type/isArray.js";
2
- import { each } from "../loop/each.js";
3
- import { compare } from "./compare.js";
4
- import { getProperty } from "./getProperty.js";
1
+ import { isArray } from '../type/isArray.js';
2
+ import { each } from '../loop/each.js';
3
+ import { compare } from './compare.js';
4
+ import { getProperty } from './getProperty.js';
5
5
  /**
6
6
  * Checks whether the given data object complies or not with the given filter.
7
7
  *
@@ -46,23 +46,23 @@ import { getProperty } from "./getProperty.js";
46
46
  * @param {Object} filter
47
47
  * @returns {Boolean}
48
48
  */
49
- const compareConditions = function (data, filter) {
49
+ var compareConditions = function (data, filter) {
50
50
  if (!filter.conditions || !filter.logic || !isArray(filter.conditions)) {
51
51
  throw new Error("Error in compareConditions: the filter should an abject with conditions and logic properties and conditions should be an array of objects");
52
52
  }
53
- let ok = filter.logic === "AND" ? true : false;
54
- each(filter.conditions, (a) => {
55
- let comparator;
53
+ var ok = filter.logic === "AND" ? true : false;
54
+ each(filter.conditions, function (a) {
55
+ var comparator;
56
56
  if (a.conditions && isArray(a.conditions)) {
57
57
  comparator = compareConditions(data, a);
58
58
  }
59
59
  else {
60
60
  comparator = compare(getProperty(data, a.field), a.value, a.operator);
61
61
  if (comparator) {
62
- let bits = a.field.split(".");
63
- let prop = bits.pop();
62
+ var bits = a.field.split(".");
63
+ var prop = bits.pop();
64
64
  if (bits.length) {
65
- each(bits, (b) => (data = data[b]));
65
+ each(bits, function (b) { return (data = data[b]); });
66
66
  }
67
67
  // Case where both are undefined: value and prop which doesn't exist; they are not the same!
68
68
  if (getProperty(data, prop) === undefined && a.value !== undefined) {
@@ -1,4 +1,4 @@
1
- import { filter } from "./filter.js";
1
+ import { filter } from './filter.js';
2
2
  /**
3
3
  * Counts the number of objects matching the given filter in the given array.
4
4
  *
@@ -53,7 +53,9 @@ import { filter } from "./filter.js";
53
53
  * @param {String} operator The operator to use for comparison with the value as used in bbn.fn.compare
54
54
  * @returns {Number} The number of items
55
55
  */
56
- const count = function (arr, prop, val = null, operator = '=') {
56
+ var count = function (arr, prop, val, operator) {
57
+ if (val === void 0) { val = null; }
58
+ if (operator === void 0) { operator = '='; }
57
59
  return filter(arr, prop, val, operator).length || 0;
58
60
  };
59
61
  export { count };
@@ -1,8 +1,21 @@
1
- import { extend } from "./extend.js";
2
- const createObject = function (...args) {
3
- const obj = Object.create(null);
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
+ import { extend } from './extend.js';
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);
4
17
  if (args.length) {
5
- extend(obj, ...args);
18
+ extend.apply(void 0, __spreadArray([obj], args, false));
6
19
  }
7
20
  return obj;
8
21
  };
@@ -1,6 +1,6 @@
1
- import { search } from "./search.js";
2
- import { each } from "../loop/each.js";
3
- import { isArray } from "../type/isArray.js";
1
+ import { search } from './search.js';
2
+ import { each } from '../loop/each.js';
3
+ import { isArray } from '../type/isArray.js';
4
4
  /**
5
5
  * Retrieves all elements of a hierarchical array corresponding to the filter.
6
6
  *
@@ -56,18 +56,19 @@ import { isArray } from "../type/isArray.js";
56
56
  * @param {String} operator The operator to use for comparison with the value as used in bbn.fn.compare
57
57
  * @returns {Number} The number of items
58
58
  */
59
- const deepPath = function (arr, filter, deepProperty, res = []) {
60
- let idx;
61
- let start = 0;
59
+ var deepPath = function (arr, filter, deepProperty, res) {
60
+ if (res === void 0) { res = []; }
61
+ var idx;
62
+ var start = 0;
62
63
  if ((idx = search(arr, filter, start)) > -1) {
63
64
  res.push(idx);
64
65
  return res;
65
66
  }
66
- each(arr, (it, i) => {
67
+ each(arr, function (it, i) {
67
68
  if (isArray(it[deepProperty])) {
68
- let r = res.slice();
69
+ var r = res.slice();
69
70
  r.push(i);
70
- let tmp = deepPath(it[deepProperty], filter, deepProperty, r);
71
+ var tmp = deepPath(it[deepProperty], filter, deepProperty, r);
71
72
  if (tmp !== false) {
72
73
  return tmp;
73
74
  }
@@ -1,11 +1,11 @@
1
- import { checkType } from "../type/checkType.js";
1
+ import { checkType } from '../type/checkType.js';
2
2
  /**
3
3
  * Gets the given property from the given object
4
4
  * @param {Object} obj
5
5
  * @param {String} prop
6
6
  * @returns
7
7
  */
8
- const deleteProp = function (obj, prop) {
8
+ var deleteProp = function (obj, prop) {
9
9
  checkType(obj, "object", bbn._("The obj must be an object in setProp"));
10
10
  checkType(prop, "string", bbn._("The prop must be a string in setProp"));
11
11
  delete obj[prop];
@@ -1,10 +1,10 @@
1
- import { isDate } from "../type/isDate.js";
2
- import { createObject } from "./createObject.js";
3
- import { isFunction } from "../type/isFunction.js";
4
- import { isValue } from "../type/isValue.js";
5
- import { isDom } from "../type/isDom.js";
6
- import { numProperties } from "./numProperties.js";
7
- let diffObjProcessed = [];
1
+ import { isDate } from '../type/isDate.js';
2
+ import { createObject } from './createObject.js';
3
+ import { isFunction } from '../type/isFunction.js';
4
+ import { isValue } from '../type/isValue.js';
5
+ import { isDom } from '../type/isDom.js';
6
+ import { numProperties } from './numProperties.js';
7
+ var diffObjProcessed = [];
8
8
  /**
9
9
  * Returns an object describing the differences for transforming the first given object into the second.
10
10
  *
@@ -82,11 +82,13 @@ let diffObjProcessed = [];
82
82
  * @param {Boolean} notRoot
83
83
  * @returns {Object}
84
84
  */
85
- const diffObj = function (obj1, obj2, unchanged = false, notRoot = false) {
85
+ var diffObj = function (obj1, obj2, unchanged, notRoot) {
86
+ if (unchanged === void 0) { unchanged = false; }
87
+ if (notRoot === void 0) { notRoot = false; }
86
88
  if (!notRoot) {
87
89
  diffObjProcessed = [];
88
90
  }
89
- let VALUE_CREATED = 'created', VALUE_UPDATED = 'updated', VALUE_DELETED = 'deleted', VALUE_UNCHANGED = 'unchanged', _compareValues = function (value1, value2) {
91
+ var VALUE_CREATED = 'created', VALUE_UPDATED = 'updated', VALUE_DELETED = 'deleted', VALUE_UNCHANGED = 'unchanged', _compareValues = function (value1, value2) {
90
92
  if (value1 === value2) {
91
93
  return VALUE_UNCHANGED;
92
94
  }
@@ -104,12 +106,12 @@ const diffObj = function (obj1, obj2, unchanged = false, notRoot = false) {
104
106
  if (notRoot === undefined) {
105
107
  notRoot = false;
106
108
  }
107
- let diff = createObject();
109
+ var diff = createObject();
108
110
  if (!isFunction(obj1) && !isFunction(obj2)) {
109
111
  if (isValue(obj1) || isValue(obj2)) {
110
- let res = _compareValues(obj1, obj2);
112
+ var res = _compareValues(obj1, obj2);
111
113
  if (unchanged || res !== VALUE_UNCHANGED) {
112
- let ret = createObject();
114
+ var ret = createObject();
113
115
  Object.defineProperty(ret, 'type', {
114
116
  value: res,
115
117
  enumerable: false,
@@ -140,24 +142,24 @@ const diffObj = function (obj1, obj2, unchanged = false, notRoot = false) {
140
142
  return false;
141
143
  }
142
144
  diffObjProcessed.push(obj1, obj2);
143
- for (let key in obj1) {
145
+ for (var key in obj1) {
144
146
  if (isFunction(obj1[key])) {
145
147
  continue;
146
148
  }
147
- let value2 = undefined;
149
+ var value2 = undefined;
148
150
  if ('undefined' != typeof obj2[key]) {
149
151
  value2 = obj2[key];
150
152
  }
151
- let res = diffObj(obj1[key], value2, unchanged, true);
153
+ var res = diffObj(obj1[key], value2, unchanged, true);
152
154
  if (res) {
153
155
  diff[key] = res;
154
156
  }
155
157
  }
156
- for (let key in obj2) {
158
+ for (var key in obj2) {
157
159
  if (isFunction(obj2[key]) || 'undefined' != typeof obj1[key]) {
158
160
  continue;
159
161
  }
160
- let res = diffObj(undefined, obj2[key], unchanged, true);
162
+ var res = diffObj(undefined, obj2[key], unchanged, true);
161
163
  if (res) {
162
164
  diff[key] = res;
163
165
  }
@@ -1,7 +1,7 @@
1
- import { iterate } from "../loop/iterate.js";
2
- import { isArray } from "../type/isArray.js";
3
- import { each } from "../loop/each.js";
4
- import { isObject } from "../type/isObject.js";
1
+ import { iterate } from '../loop/iterate.js';
2
+ import { isArray } from '../type/isArray.js';
3
+ import { each } from '../loop/each.js';
4
+ import { isObject } from '../type/isObject.js';
5
5
  /**
6
6
  * Merges the contents of two or more objects together into the first object.
7
7
  *
@@ -87,10 +87,14 @@ import { isObject } from "../type/isObject.js";
87
87
  * @memberof bbn.fn
88
88
  * @returns {Object} The first object argument, merged with the other objects given
89
89
  */
90
- const extend = function (...originalArgs) {
91
- let deep = false;
92
- let args = [];
93
- for (let i = 0; i < originalArgs.length; i++) {
90
+ var extend = function () {
91
+ var originalArgs = [];
92
+ for (var _i = 0; _i < arguments.length; _i++) {
93
+ originalArgs[_i] = arguments[_i];
94
+ }
95
+ var deep = false;
96
+ var args = [];
97
+ for (var i = 0; i < originalArgs.length; i++) {
94
98
  if (originalArgs[i] === true) {
95
99
  deep = true;
96
100
  }
@@ -107,15 +111,15 @@ const extend = function (...originalArgs) {
107
111
  if (!args.length) {
108
112
  throw new Error("No argument given");
109
113
  }
110
- let out = args[0];
111
- for (let i = 1; i < args.length; i++) {
112
- iterate(args[i], (a, key) => {
114
+ var out = args[0];
115
+ for (var i = 1; i < args.length; i++) {
116
+ iterate(args[i], function (a, key) {
113
117
  if (deep) {
114
118
  if (isArray(a)) {
115
119
  out[key] = isArray(out[key]) ? out[key] : [];
116
- each(a, (b, i) => {
120
+ each(a, function (b, i) {
117
121
  if (b && typeof b === "object") {
118
- let tmp = out[key][i];
122
+ var tmp = out[key][i];
119
123
  if (isArray(b)) {
120
124
  if (!isArray(tmp)) {
121
125
  tmp = [];
@@ -1,4 +1,4 @@
1
- import { isObject } from "../type/isObject.js";
1
+ import { isObject } from '../type/isObject.js';
2
2
  /**
3
3
  * Returns a new object made of the properties from all the given objects.
4
4
  *
@@ -15,9 +15,14 @@ import { isObject } from "../type/isObject.js";
15
15
  * @memberof bbn.fn
16
16
  * @returns {Object}
17
17
  */
18
- const extendOut = function (...args) {
19
- let r = null;
20
- for (let a of args) {
18
+ var extendOut = function () {
19
+ var args = [];
20
+ for (var _i = 0; _i < arguments.length; _i++) {
21
+ args[_i] = arguments[_i];
22
+ }
23
+ var r = null;
24
+ for (var _a = 0, args_1 = args; _a < args_1.length; _a++) {
25
+ var a = args_1[_a];
21
26
  if (!isObject(a)) {
22
27
  throw new Error("Each argument for extendOut must be an object, " + typeof a + " given");
23
28
  }
@@ -25,7 +30,7 @@ const extendOut = function (...args) {
25
30
  r = a;
26
31
  }
27
32
  else {
28
- for (let n in a) {
33
+ for (var n in a) {
29
34
  if (isObject(r[n], a[n])) {
30
35
  extendOut(r[n], a[n]);
31
36
  }
@@ -1,4 +1,4 @@
1
- import { Filter } from "./filterToConditions.js";
1
+ import { Filter } from './filterToConditions.js';
2
2
  /**
3
3
  * Returns a new array with only the data matching the given filter.
4
4
  *
@@ -1,7 +1,7 @@
1
- import { isArray } from "../type/isArray.js";
2
- import { each } from "../loop/each.js";
3
- import { filterToConditions } from "./filterToConditions.js";
4
- import { compareConditions } from "./compareConditions.js";
1
+ import { isArray } from '../type/isArray.js';
2
+ import { each } from '../loop/each.js';
3
+ import { filterToConditions } from './filterToConditions.js';
4
+ import { compareConditions } from './compareConditions.js';
5
5
  /**
6
6
  * Returns a new array with only the data matching the given filter.
7
7
  *
@@ -49,14 +49,16 @@ import { compareConditions } from "./compareConditions.js";
49
49
  * @param {String} operator The operator to use for comparison with the value as used in bbn.fn.compare
50
50
  * @returns {Array} A new filtered array
51
51
  */
52
- const filter = function (arr, prop, val = null, operator = '=') {
52
+ var filter = function (arr, prop, val, operator) {
53
+ if (val === void 0) { val = null; }
54
+ if (operator === void 0) { operator = '='; }
53
55
  if (!isArray(arr)) {
54
56
  bbn.fn.log("NOT ARRAY", arr);
55
57
  throw new Error('Error in filter: The first argument must be an array');
56
58
  }
57
- let cfg = {};
58
- const res = [];
59
- const isFn = typeof (prop) === 'function';
59
+ var cfg = {};
60
+ var res = [];
61
+ var isFn = typeof (prop) === 'function';
60
62
  if (!prop || !arr.length) {
61
63
  return arr;
62
64
  }
@@ -72,7 +74,7 @@ const filter = function (arr, prop, val = null, operator = '=') {
72
74
  throw new Error('Search function error: The prop argument should be a string or an object');
73
75
  }
74
76
  if (typeof (prop) === 'function') {
75
- each(arr, (a, i) => {
77
+ each(arr, function (a, i) {
76
78
  if (prop(a, i)) {
77
79
  res.push(a);
78
80
  }
@@ -81,7 +83,7 @@ const filter = function (arr, prop, val = null, operator = '=') {
81
83
  else {
82
84
  cfg = filterToConditions(cfg, operator);
83
85
  if (cfg.conditions && cfg.logic) {
84
- each(arr, (a) => {
86
+ each(arr, function (a) {
85
87
  if (compareConditions(a, cfg)) {
86
88
  res.push(a);
87
89
  }
@@ -1,6 +1,6 @@
1
- import { isObject } from "../type/isObject.js";
2
- import { isArray } from "../type/isArray.js";
3
- import { iterate } from "../loop/iterate.js";
1
+ import { isObject } from '../type/isObject.js';
2
+ import { isArray } from '../type/isArray.js';
3
+ import { iterate } from '../loop/iterate.js';
4
4
  /**
5
5
  * Converts the given object 'filter' to a valid format of condition.
6
6
  *
@@ -38,18 +38,19 @@ import { iterate } from "../loop/iterate.js";
38
38
  * @param {String} operator
39
39
  * @returns {Object}
40
40
  */
41
- const filterToConditions = function (filter, operator = "=") {
41
+ var filterToConditions = function (filter, operator) {
42
+ if (operator === void 0) { operator = "="; }
42
43
  if (!isObject(filter)) {
43
44
  throw new Error("Error in filterToCondition: filter must be an object");
44
45
  }
45
46
  if (!filter.conditions || !isArray(filter.conditions)) {
46
- let tmp = [];
47
- iterate(filter, (a, n) => {
47
+ var tmp_1 = [];
48
+ iterate(filter, function (a, n) {
48
49
  if (isObject(a) && typeof a.conditions === "object") {
49
- tmp.push(filterToConditions(a));
50
+ tmp_1.push(filterToConditions(a));
50
51
  }
51
52
  else {
52
- tmp.push({
53
+ tmp_1.push({
53
54
  field: n,
54
55
  operator: operator,
55
56
  value: a,
@@ -57,7 +58,7 @@ const filterToConditions = function (filter, operator = "=") {
57
58
  }
58
59
  });
59
60
  filter = {
60
- conditions: tmp,
61
+ conditions: tmp_1,
61
62
  };
62
63
  }
63
64
  if (!filter.logic) {
@@ -1,6 +1,6 @@
1
- import { search } from "./search.js";
2
- import { each } from "../loop/each.js";
3
- import { isArray } from "../type/isArray.js";
1
+ import { search } from './search.js';
2
+ import { each } from '../loop/each.js';
3
+ import { isArray } from '../type/isArray.js';
4
4
  /**
5
5
  * Retrieves all elements of a hierarchical array corresponding to the filter.
6
6
  *
@@ -56,14 +56,15 @@ import { isArray } from "../type/isArray.js";
56
56
  * @param {String} operator The operator to use for comparison with the value as used in bbn.fn.compare
57
57
  * @returns {Number} The number of items
58
58
  */
59
- const findAll = function (arr, filter, deepProperty, res = []) {
60
- let idx;
61
- let start = 0;
59
+ var findAll = function (arr, filter, deepProperty, res) {
60
+ if (res === void 0) { res = []; }
61
+ var idx;
62
+ var start = 0;
62
63
  while ((idx = search(arr, filter, start)) > -1) {
63
64
  res.push(arr[idx]);
64
65
  start = idx + 1;
65
66
  }
66
- each(arr, (it) => {
67
+ each(arr, function (it) {
67
68
  if (isArray(it[deepProperty])) {
68
69
  findAll(it[deepProperty], filter, deepProperty, res);
69
70
  }
@@ -1,4 +1,4 @@
1
- import { getRow } from "./getRow.js";
1
+ import { getRow } from './getRow.js';
2
2
  /**
3
3
  * Returns the value of the given field (property) from the first object matching the given filter in an array of objects.
4
4
  *
@@ -27,8 +27,11 @@ import { getRow } from "./getRow.js";
27
27
  * @param {String} operator The operator to use for comparison with the value as used in bbn.fn.compare
28
28
  * @returns {*}
29
29
  */
30
- const getField = function (arr, field, prop = '', val = null, operator = '=') {
31
- let r;
30
+ var getField = function (arr, field, prop, val, operator) {
31
+ if (prop === void 0) { prop = ''; }
32
+ if (val === void 0) { val = null; }
33
+ if (operator === void 0) { operator = '='; }
34
+ var r;
32
35
  if (field && (r = getRow(arr, prop, val, operator))) {
33
36
  return r[field];
34
37
  }
@@ -1,6 +1,6 @@
1
- import { checkType } from "../type/checkType.js";
2
- import { filter } from "./filter.js";
3
- import { each } from "../loop/each.js";
1
+ import { checkType } from '../type/checkType.js';
2
+ import { filter } from './filter.js';
3
+ import { each } from '../loop/each.js';
4
4
  /**
5
5
  * Returns all the unique values of the given field (property) from the first object matching the given filter in an array.
6
6
  *
@@ -29,13 +29,13 @@ import { each } from "../loop/each.js";
29
29
  * @param {String} operator The operator to use for comparison with the value as used in bbn.fn.compare
30
30
  * @returns {*}
31
31
  */
32
- const getFieldValues = function (arr, field, prop, val, operator) {
32
+ var getFieldValues = function (arr, field, prop, val, operator) {
33
33
  checkType(field, 'string');
34
34
  if (prop) {
35
35
  arr = filter(arr, prop, val, operator);
36
36
  }
37
- let res = [];
38
- each(arr, (a) => (res.indexOf(a[field]) === -1 ? res.push(a[field]) : null));
37
+ var res = [];
38
+ each(arr, function (a) { return (res.indexOf(a[field]) === -1 ? res.push(a[field]) : null); });
39
39
  return res;
40
40
  };
41
41
  export { getFieldValues };
@@ -1,11 +1,11 @@
1
- import { checkType } from "../type/checkType.js";
1
+ import { checkType } from '../type/checkType.js';
2
2
  /**
3
3
  * Gets the given property from the given object
4
4
  * @param {Object} obj
5
5
  * @param {String} prop
6
6
  * @returns
7
7
  */
8
- const getProp = function (obj, prop) {
8
+ var getProp = function (obj, prop) {
9
9
  checkType(obj, "object", bbn._("The obj must be an object in setProp"));
10
10
  checkType(prop, "string", bbn._("The prop must be a string in setProp"));
11
11
  return obj[prop];
@@ -26,9 +26,9 @@
26
26
  * @param {String} prop
27
27
  * @returns {*} The property's value or undefined
28
28
  */
29
- const getProperty = function (obj, prop) {
29
+ var getProperty = function (obj, prop) {
30
30
  if (typeof obj === 'object' && typeof prop === 'string') {
31
- return prop.split('.').reduce((o, i) => {
31
+ return prop.split('.').reduce(function (o, i) {
32
32
  if (o) {
33
33
  return o[i];
34
34
  }