unetjs 2.0.5 → 2.0.6

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/cjs/unet.cjs CHANGED
@@ -1,4 +1,4 @@
1
- /* unet.js v2.0.5 2022-06-15T07:40:54.241Z */
1
+ /* unet.js v2.0.6 2022-06-15T08:30:00.284Z */
2
2
 
3
3
  'use strict';
4
4
 
@@ -1525,6 +1525,7 @@ class CachingAgentID extends AgentID {
1525
1525
  }
1526
1526
  this.greedy = greedy;
1527
1527
  this.cache = {};
1528
+ this.specialParams = ['name', 'version'];
1528
1529
  }
1529
1530
 
1530
1531
  /**
@@ -1552,7 +1553,9 @@ class CachingAgentID extends AgentID {
1552
1553
  */
1553
1554
  async get(params, index=-1, timeout=5000, maxage=5000) {
1554
1555
  if (this._isCached(params, index, maxage)) return this._getCache(params, index);
1555
- if (this.greedy && !(Array.isArray(params) && params.includes('name')) && params != 'name') {
1556
+ if (this.greedy &&
1557
+ !(Array.isArray(params) && [...new Set([...params, ...this.specialParams])].length!=0) &&
1558
+ !this.specialParams.includes(params)) {
1556
1559
  let rsp = await super.get(null, index, timeout);
1557
1560
  this._updateCache(null, rsp, index);
1558
1561
  if (!rsp) return Array.isArray(params) ? new Array(params.length).fill(null) : null;
package/dist/esm/unet.js CHANGED
@@ -1,4 +1,4 @@
1
- /* unet.js v2.0.5 2022-06-15T07:40:54.241Z */
1
+ /* unet.js v2.0.6 2022-06-15T08:30:00.284Z */
2
2
 
3
3
  /* fjage.js v1.10.1 */
4
4
 
@@ -1503,6 +1503,7 @@ class CachingAgentID extends AgentID {
1503
1503
  }
1504
1504
  this.greedy = greedy;
1505
1505
  this.cache = {};
1506
+ this.specialParams = ['name', 'version'];
1506
1507
  }
1507
1508
 
1508
1509
  /**
@@ -1530,7 +1531,9 @@ class CachingAgentID extends AgentID {
1530
1531
  */
1531
1532
  async get(params, index=-1, timeout=5000, maxage=5000) {
1532
1533
  if (this._isCached(params, index, maxage)) return this._getCache(params, index);
1533
- if (this.greedy && !(Array.isArray(params) && params.includes('name')) && params != 'name') {
1534
+ if (this.greedy &&
1535
+ !(Array.isArray(params) && [...new Set([...params, ...this.specialParams])].length!=0) &&
1536
+ !this.specialParams.includes(params)) {
1534
1537
  let rsp = await super.get(null, index, timeout);
1535
1538
  this._updateCache(null, rsp, index);
1536
1539
  if (!rsp) return Array.isArray(params) ? new Array(params.length).fill(null) : null;
package/dist/unetjs.js CHANGED
@@ -1507,6 +1507,7 @@
1507
1507
  }
1508
1508
  this.greedy = greedy;
1509
1509
  this.cache = {};
1510
+ this.specialParams = ['name', 'version'];
1510
1511
  }
1511
1512
 
1512
1513
  /**
@@ -1534,7 +1535,9 @@
1534
1535
  */
1535
1536
  async get(params, index=-1, timeout=5000, maxage=5000) {
1536
1537
  if (this._isCached(params, index, maxage)) return this._getCache(params, index);
1537
- if (this.greedy && !(Array.isArray(params) && params.includes('name')) && params != 'name') {
1538
+ if (this.greedy &&
1539
+ !(Array.isArray(params) && [...new Set([...params, ...this.specialParams])].length!=0) &&
1540
+ !this.specialParams.includes(params)) {
1538
1541
  let rsp = await super.get(null, index, timeout);
1539
1542
  this._updateCache(null, rsp, index);
1540
1543
  if (!rsp) return Array.isArray(params) ? new Array(params.length).fill(null) : null;