be-hive 0.0.157 → 0.0.159

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 (2) hide show
  1. package/be-hive.js +25 -17
  2. package/package.json +2 -2
package/be-hive.js CHANGED
@@ -82,25 +82,33 @@ export class BeHive extends Synthesizer {
82
82
  initialPropValues[prop] = newValue;
83
83
  break;
84
84
  case 'object':
85
- const { instanceOf, mapsTo } = prop;
85
+ const { instanceOf, mapsTo, valIfFalsy } = prop;
86
86
  let valToSet = newValue;
87
- switch (instanceOf) {
88
- case 'Object':
89
- try {
90
- valToSet = JSON.parse(newValue);
91
- }
92
- catch (e) {
93
- throw { err: 400, attr, newValue };
94
- }
95
- if (mapsTo === '.') {
96
- Object.assign(initialPropValues, valToSet);
97
- }
98
- else {
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':
99
107
  initialPropValues[mapsTo] = valToSet;
100
- }
101
- break;
102
- default:
103
- throw 'NI';
108
+ break;
109
+ default:
110
+ throw 'NI';
111
+ }
104
112
  }
105
113
  break;
106
114
  default:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "be-hive",
3
- "version": "0.0.157",
3
+ "version": "0.0.159",
4
4
  "keywords": [
5
5
  "web-components",
6
6
  "web-component",
@@ -28,7 +28,7 @@
28
28
  "update": "ncu -u && npm install"
29
29
  },
30
30
  "dependencies": {
31
- "be-enhanced": "0.0.87",
31
+ "be-enhanced": "0.0.88",
32
32
  "mount-observer": "0.0.25",
33
33
  "trans-render": "0.0.769"
34
34
  },