@bbn/bbn 1.0.269 → 1.0.271

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.
@@ -0,0 +1,6 @@
1
+ /**
2
+ *
3
+ * @param {String} varName
4
+ * @returns {String}
5
+ */
6
+ export default function firstVarElement(varName: any): any;
@@ -0,0 +1,19 @@
1
+ /**
2
+ *
3
+ * @param {String} varName
4
+ * @returns {String}
5
+ */
6
+ export default function firstVarElement(varName) {
7
+ var firstBracket = varName.indexOf('[');
8
+ var firstDot = varName.indexOf('.');
9
+ if (firstBracket === -1 && firstDot === -1) {
10
+ return varName;
11
+ }
12
+ if (firstBracket === -1) {
13
+ return varName.substring(0, firstDot);
14
+ }
15
+ if (firstDot === -1) {
16
+ return varName.substring(0, firstBracket);
17
+ }
18
+ return varName.substring(0, Math.min(firstBracket, firstDot));
19
+ }
@@ -22,6 +22,9 @@ export default function treatForHash(value, fn, depth, level, visited) {
22
22
  else if (value === null) {
23
23
  value = "__BBN_NULL__";
24
24
  }
25
+ else if (value === null) {
26
+ value = "__BBN_NULL__";
27
+ }
25
28
  else if (typeof value === 'function') {
26
29
  value = "__BBN_FUNCTION__" + value.toString();
27
30
  }
@@ -69,7 +72,7 @@ export default function treatForHash(value, fn, depth, level, visited) {
69
72
  }
70
73
  else if (typeof value === 'object') {
71
74
  if (visited.has(value) || (depth && (depth < level))) {
72
- value = "__BBN_OBJECT__" + value.constructor.toString();
75
+ value = "__BBN_OBJECT__" + (value.constructor ? value.constructor.toString() : '');
73
76
  }
74
77
  else {
75
78
  visited.add(value);
package/dist/fn.d.ts CHANGED
@@ -75,6 +75,7 @@ import fieldValue from './fn/form/fieldValue.js';
75
75
  import fileExt from './fn/string/fileExt.js';
76
76
  import filter from './fn/object/filter.js';
77
77
  import filterToConditions from './fn/object/filterToConditions.js';
78
+ import firstVarElement from './fn/string/firstVarElement.js';
78
79
  import findAll from './fn/object/findAll.js';
79
80
  import fori from './fn/loop/fori.js';
80
81
  import forir from './fn/loop/forir.js';
@@ -311,6 +312,7 @@ declare const _default: {
311
312
  filter: typeof filter;
312
313
  filterToConditions: typeof filterToConditions;
313
314
  findAll: typeof findAll;
315
+ firstVarElement: typeof firstVarElement;
314
316
  fori: typeof fori;
315
317
  forir: typeof forir;
316
318
  format: typeof format;
package/dist/fn.js CHANGED
@@ -75,6 +75,7 @@ import fieldValue from './fn/form/fieldValue.js';
75
75
  import fileExt from './fn/string/fileExt.js';
76
76
  import filter from './fn/object/filter.js';
77
77
  import filterToConditions from './fn/object/filterToConditions.js';
78
+ import firstVarElement from './fn/string/firstVarElement.js';
78
79
  import findAll from './fn/object/findAll.js';
79
80
  import fori from './fn/loop/fori.js';
80
81
  import forir from './fn/loop/forir.js';
@@ -311,6 +312,7 @@ export default {
311
312
  filter: filter,
312
313
  filterToConditions: filterToConditions,
313
314
  findAll: findAll,
315
+ firstVarElement: firstVarElement,
314
316
  fori: fori,
315
317
  forir: forir,
316
318
  format: format,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbn/bbn",
3
- "version": "1.0.269",
3
+ "version": "1.0.271",
4
4
  "description": "Javascript toolkit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",