@onehat/data 1.8.13 → 1.8.16

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onehat/data",
3
- "version": "1.8.13",
3
+ "version": "1.8.16",
4
4
  "description": "JS data modeling package with adapters for many storage mediums.",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/Entity.js CHANGED
@@ -1297,6 +1297,10 @@ class Entity extends EventEmitter {
1297
1297
  if (this.isFrozen) {
1298
1298
  return;
1299
1299
  }
1300
+
1301
+ // Save destroyed properties
1302
+ this.destroyedProperties = this.displayValues;
1303
+
1300
1304
  this._id = this.id; // save id, so we can query it later--even on a destroyed entity
1301
1305
 
1302
1306
  // parent objects
@@ -1318,10 +1322,7 @@ class Entity extends EventEmitter {
1318
1322
  }
1319
1323
 
1320
1324
  get [Symbol.toStringTag]() {
1321
- if (this.isDestroyed) {
1322
- throw Error('this.toStringTag is no longer valid. Entity has been destroyed.');
1323
- }
1324
- return 'Entity {' + this.id + '} - ' + this.displayValue;
1325
+ return 'Entity {' + this.id + '} - ' + (this.isDestroyed ? 'destroyed' : this.displayValue);
1325
1326
  }
1326
1327
 
1327
1328
  get toJSON() {
@@ -1,7 +1,7 @@
1
1
  import moment from 'moment';
2
2
  import momentAlt from 'relative-time-parser'; // Notice this version of moment is imported from 'relative-time-parser', and may be out of sync with our general 'moment' package
3
3
  import accounting from 'accounting-js';
4
- import * as chrono from 'chrono-node';
4
+ // import * as chrono from 'chrono-node';
5
5
  import _ from 'lodash';
6
6
 
7
7
  class Parsers {
@@ -90,16 +90,16 @@ class Parsers {
90
90
  result = moment(value, format);
91
91
  } catch(err) {}
92
92
 
93
- if (!result || !result.isValid()) {
94
- // try using chrono
95
- const parsed = chrono.parse(value);
96
- if (parsed && parsed[0] && parsed[0].date) {
97
- const dateString = parsed[0].date();
98
- try {
99
- result = moment(dateString);
100
- } catch(err) {}
101
- }
102
- }
93
+ // if ((!result || !result.isValid() && chrono)) {
94
+ // // try using chrono
95
+ // const parsed = chrono.parse(value);
96
+ // if (parsed && parsed[0] && parsed[0].date) {
97
+ // const dateString = parsed[0].date();
98
+ // try {
99
+ // result = moment(dateString);
100
+ // } catch(err) {}
101
+ // }
102
+ // }
103
103
  return result;
104
104
  }
105
105