@bbn/bbn 1.0.268 → 1.0.270
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.
- package/dist/bbn.js +1 -1
- package/dist/bbn.js.map +1 -1
- package/dist/fn/misc/analyzeFunction.js +1 -1
- package/dist/fn/string/firstVarElement.d.ts +6 -0
- package/dist/fn/string/firstVarElement.js +19 -0
- package/dist/fn.d.ts +2 -0
- package/dist/fn.js +2 -0
- package/package.json +1 -1
|
@@ -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
|
+
}
|
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,
|