statebus 7.0.27 → 7.0.28

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/package.json +1 -1
  2. package/statebus.js +16 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "statebus",
3
- "version": "7.0.27",
3
+ "version": "7.0.28",
4
4
  "description": "Synchronize state.",
5
5
  "main": "statebus.js",
6
6
  "scripts": {
package/statebus.js CHANGED
@@ -1337,7 +1337,7 @@
1337
1337
 
1338
1338
 
1339
1339
  return new Proxy(o, {
1340
- get: function get(o, k) {
1340
+ get: function (o, k) {
1341
1341
  if (k === 'inspect' || k === 'valueOf')
1342
1342
  return undefined
1343
1343
  // if (custom_inspect && k === custom_inspect)
@@ -1349,11 +1349,11 @@
1349
1349
 
1350
1350
  // Compute the new path
1351
1351
  var new_path = path + '[' + JSON.stringify(k) + ']'
1352
- return item_proxy(base, new_path, o[escape_field_to_nelson(escape_field_to_bus(k))])
1352
+ return item_proxy(base, new_path, o[escape_field_to_bus(escape_field_to_nelson(k))])
1353
1353
  },
1354
- set: function set(o, k, v) {
1354
+ set: function (o, k, v) {
1355
1355
  var value = translate_fields(v, field => escape_field_to_bus(escape_field_to_nelson(field)))
1356
- o[escape_field_to_bus(k)] = value
1356
+ o[escape_field_to_bus(escape_field_to_nelson(k))] = value
1357
1357
  var new_path = path + '[' + JSON.stringify(k) + ']'
1358
1358
  bus.set(
1359
1359
  base,
@@ -1362,14 +1362,20 @@
1362
1362
  )
1363
1363
  return true
1364
1364
  },
1365
- has: function has(o, k) {
1365
+ has: function (o, k) {
1366
1366
  // if (custom_inspect && k === custom_inspect)
1367
1367
  // return true
1368
- return o.hasOwnProperty(escape_field_to_bus(k))
1368
+ return o.hasOwnProperty(escape_field_to_bus(escape_field_to_nelson(k)))
1369
+ },
1370
+ ownKeys: function () {
1371
+ return Object.keys(o).map(unescape_field_from_nelson).map(unescape_field_from_bus)
1372
+ },
1373
+ getOwnPropertyDescriptor: function (target, key) {
1374
+ return { enumerable: true, configurable: true, value: this.get(o, key) }
1369
1375
  },
1370
1376
  deleteProperty: function del (o, k) {
1371
1377
  var new_path = path + '[' + JSON.stringify(k) + ']'
1372
- delete o[escape_field_to_bus(k)]
1378
+ delete o[escape_field_to_bus(escape_field_to_nelson(k))]
1373
1379
  bus.set(
1374
1380
  base,
1375
1381
  // Forward the patch too
@@ -1429,9 +1435,10 @@
1429
1435
  if (!nodejs)
1430
1436
  window.devtoolsFormatters = [{
1431
1437
  header: function (x) {
1432
- if (x[symbols.is_proxy])
1438
+ if (x[symbols.is_proxy]) {
1433
1439
  return ['span', {style: 'background-color: #fffbe5; padding: 3px;'},
1434
- JSON.stringify(unescape_from_nelson(unescape_from_bus(x)))]
1440
+ JSON.stringify(x)]
1441
+ }
1435
1442
  // For function proxies:
1436
1443
  // JSON.stringify(x(), null, 2)]
1437
1444
  },