be-hive 0.0.159 → 0.0.161

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/be-hive.js CHANGED
@@ -82,34 +82,8 @@ export class BeHive extends Synthesizer {
82
82
  initialPropValues[prop] = newValue;
83
83
  break;
84
84
  case 'object':
85
- const { instanceOf, mapsTo, valIfFalsy } = prop;
86
- let valToSet = newValue;
87
- if (valIfFalsy !== undefined && !newValue) {
88
- initialPropValues[mapsTo] = valIfFalsy;
89
- }
90
- else {
91
- switch (instanceOf) {
92
- case 'Object':
93
- try {
94
- valToSet = JSON.parse(newValue);
95
- }
96
- catch (e) {
97
- throw { err: 400, attr, newValue };
98
- }
99
- if (mapsTo === '.') {
100
- Object.assign(initialPropValues, valToSet);
101
- }
102
- else {
103
- initialPropValues[mapsTo] = valToSet;
104
- }
105
- break;
106
- case 'String':
107
- initialPropValues[mapsTo] = valToSet;
108
- break;
109
- default:
110
- throw 'NI';
111
- }
112
- }
85
+ const { prsObj } = await import('./prsObj.js');
86
+ await prsObj(prop, newValue, initialPropValues, attr);
113
87
  break;
114
88
  default:
115
89
  throw 'NI';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "be-hive",
3
- "version": "0.0.159",
3
+ "version": "0.0.161",
4
4
  "keywords": [
5
5
  "web-components",
6
6
  "web-component",
@@ -28,9 +28,9 @@
28
28
  "update": "ncu -u && npm install"
29
29
  },
30
30
  "dependencies": {
31
- "be-enhanced": "0.0.88",
31
+ "be-enhanced": "0.0.90",
32
32
  "mount-observer": "0.0.25",
33
- "trans-render": "0.0.769"
33
+ "trans-render": "0.0.770"
34
34
  },
35
35
  "devDependencies": {
36
36
  "may-it-serve": "0.0.6"
package/prsObj.js ADDED
@@ -0,0 +1,43 @@
1
+ export async function prsObj(prop, newValue, initialPropValues, attr) {
2
+ const { instanceOf, mapsTo, valIfFalsy } = prop;
3
+ let valToSet = newValue;
4
+ if (valIfFalsy !== undefined && !newValue) {
5
+ initialPropValues[mapsTo] = valIfFalsy;
6
+ }
7
+ else {
8
+ switch (instanceOf) {
9
+ case 'Object':
10
+ try {
11
+ valToSet = JSON.parse(newValue);
12
+ }
13
+ catch (e) {
14
+ throw { err: 400, attr, newValue };
15
+ }
16
+ if (mapsTo === '.') {
17
+ Object.assign(initialPropValues, valToSet);
18
+ }
19
+ else {
20
+ initialPropValues[mapsTo] = valToSet;
21
+ }
22
+ break;
23
+ case 'String':
24
+ initialPropValues[mapsTo] = valToSet;
25
+ break;
26
+ case 'Object$tring':
27
+ const { Object$tring } = await import('trans-render/Object$tring.js');
28
+ const parsedObj = new Object$tring(newValue);
29
+ const { strValMapsTo, objValMapsTo, arrValMapsTo } = prop;
30
+ if (parsedObj.strVal && strValMapsTo !== undefined) {
31
+ initialPropValues[strValMapsTo] = parsedObj.strVal;
32
+ }
33
+ if (parsedObj.objVal && objValMapsTo !== undefined) {
34
+ initialPropValues[objValMapsTo] = parsedObj.objVal;
35
+ }
36
+ else if (parsedObj.arrVal && arrValMapsTo !== undefined) {
37
+ initialPropValues[arrValMapsTo] = parsedObj.arrVal;
38
+ }
39
+ default:
40
+ throw 'NI';
41
+ }
42
+ }
43
+ }
package/types.d.ts CHANGED
@@ -1,7 +0,0 @@
1
- // import {RootCnfg} from 'mount-observer/types';
2
- // import {IEnhancement, MountBeHive} from 'trans-render/be/types';
3
-
4
- // export type RegistryEventName = 'load';
5
- // export interface RegistryEvent<TBranches = any>{
6
- // mountBeHive: MountBeHive<TBranches>
7
- // }