unetjs 2.0.3 → 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.3 2022-06-10T23:18:39.778Z */
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,10 +1553,14 @@ 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
- if (Array.isArray(params)) {
1561
+ if (!rsp) return Array.isArray(params) ? new Array(params.length).fill(null) : null;
1562
+ if (!params) return rsp;
1563
+ else if (Array.isArray(params)) {
1559
1564
  return params.map(p => {
1560
1565
  let f = Object.keys(rsp).find(rv => this._toNamed(rv) === p);
1561
1566
  return f ? rsp[f] : null;
package/dist/esm/unet.js CHANGED
@@ -1,4 +1,4 @@
1
- /* unet.js v2.0.3 2022-06-10T23:18:39.778Z */
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,10 +1531,14 @@ 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
- if (Array.isArray(params)) {
1539
+ if (!rsp) return Array.isArray(params) ? new Array(params.length).fill(null) : null;
1540
+ if (!params) return rsp;
1541
+ else if (Array.isArray(params)) {
1537
1542
  return params.map(p => {
1538
1543
  let f = Object.keys(rsp).find(rv => this._toNamed(rv) === p);
1539
1544
  return f ? rsp[f] : 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,10 +1535,14 @@
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
- if (Array.isArray(params)) {
1543
+ if (!rsp) return Array.isArray(params) ? new Array(params.length).fill(null) : null;
1544
+ if (!params) return rsp;
1545
+ else if (Array.isArray(params)) {
1541
1546
  return params.map(p => {
1542
1547
  let f = Object.keys(rsp).find(rv => this._toNamed(rv) === p);
1543
1548
  return f ? rsp[f] : null;