unetjs 2.0.4 → 2.0.7
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 +8 -3
- package/dist/esm/unet.js +8 -3
- package/dist/unetjs.js +7 -2
- package/dist/unetjs.js.map +1 -1
- package/dist/unetjs.min.js +1 -1
- package/dist/unetjs.min.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/unet.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* unet.js v2.0.
|
|
1
|
+
/* unet.js v2.0.7 2022-07-15T01:00:23.960Z */
|
|
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
|
/**
|
|
@@ -1539,6 +1540,7 @@ class CachingAgentID extends AgentID {
|
|
|
1539
1540
|
async set(params, values, index=-1, timeout=5000) {
|
|
1540
1541
|
let s = await super.set(params, values, index, timeout);
|
|
1541
1542
|
this._updateCache(params, s, index);
|
|
1543
|
+
return s;
|
|
1542
1544
|
}
|
|
1543
1545
|
|
|
1544
1546
|
/**
|
|
@@ -1552,11 +1554,14 @@ class CachingAgentID extends AgentID {
|
|
|
1552
1554
|
*/
|
|
1553
1555
|
async get(params, index=-1, timeout=5000, maxage=5000) {
|
|
1554
1556
|
if (this._isCached(params, index, maxage)) return this._getCache(params, index);
|
|
1555
|
-
if (this.greedy &&
|
|
1557
|
+
if (this.greedy &&
|
|
1558
|
+
!(Array.isArray(params) && [...new Set([...params, ...this.specialParams])].length!=0) &&
|
|
1559
|
+
!this.specialParams.includes(params)) {
|
|
1556
1560
|
let rsp = await super.get(null, index, timeout);
|
|
1557
1561
|
this._updateCache(null, rsp, index);
|
|
1558
1562
|
if (!rsp) return Array.isArray(params) ? new Array(params.length).fill(null) : null;
|
|
1559
|
-
if (
|
|
1563
|
+
if (!params) return rsp;
|
|
1564
|
+
else if (Array.isArray(params)) {
|
|
1560
1565
|
return params.map(p => {
|
|
1561
1566
|
let f = Object.keys(rsp).find(rv => this._toNamed(rv) === p);
|
|
1562
1567
|
return f ? rsp[f] : null;
|
package/dist/esm/unet.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* unet.js v2.0.
|
|
1
|
+
/* unet.js v2.0.7 2022-07-15T01:00:23.960Z */
|
|
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
|
/**
|
|
@@ -1517,6 +1518,7 @@ class CachingAgentID extends AgentID {
|
|
|
1517
1518
|
async set(params, values, index=-1, timeout=5000) {
|
|
1518
1519
|
let s = await super.set(params, values, index, timeout);
|
|
1519
1520
|
this._updateCache(params, s, index);
|
|
1521
|
+
return s;
|
|
1520
1522
|
}
|
|
1521
1523
|
|
|
1522
1524
|
/**
|
|
@@ -1530,11 +1532,14 @@ class CachingAgentID extends AgentID {
|
|
|
1530
1532
|
*/
|
|
1531
1533
|
async get(params, index=-1, timeout=5000, maxage=5000) {
|
|
1532
1534
|
if (this._isCached(params, index, maxage)) return this._getCache(params, index);
|
|
1533
|
-
if (this.greedy &&
|
|
1535
|
+
if (this.greedy &&
|
|
1536
|
+
!(Array.isArray(params) && [...new Set([...params, ...this.specialParams])].length!=0) &&
|
|
1537
|
+
!this.specialParams.includes(params)) {
|
|
1534
1538
|
let rsp = await super.get(null, index, timeout);
|
|
1535
1539
|
this._updateCache(null, rsp, index);
|
|
1536
1540
|
if (!rsp) return Array.isArray(params) ? new Array(params.length).fill(null) : null;
|
|
1537
|
-
if (
|
|
1541
|
+
if (!params) return rsp;
|
|
1542
|
+
else if (Array.isArray(params)) {
|
|
1538
1543
|
return params.map(p => {
|
|
1539
1544
|
let f = Object.keys(rsp).find(rv => this._toNamed(rv) === p);
|
|
1540
1545
|
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
|
/**
|
|
@@ -1521,6 +1522,7 @@
|
|
|
1521
1522
|
async set(params, values, index=-1, timeout=5000) {
|
|
1522
1523
|
let s = await super.set(params, values, index, timeout);
|
|
1523
1524
|
this._updateCache(params, s, index);
|
|
1525
|
+
return s;
|
|
1524
1526
|
}
|
|
1525
1527
|
|
|
1526
1528
|
/**
|
|
@@ -1534,11 +1536,14 @@
|
|
|
1534
1536
|
*/
|
|
1535
1537
|
async get(params, index=-1, timeout=5000, maxage=5000) {
|
|
1536
1538
|
if (this._isCached(params, index, maxage)) return this._getCache(params, index);
|
|
1537
|
-
if (this.greedy &&
|
|
1539
|
+
if (this.greedy &&
|
|
1540
|
+
!(Array.isArray(params) && [...new Set([...params, ...this.specialParams])].length!=0) &&
|
|
1541
|
+
!this.specialParams.includes(params)) {
|
|
1538
1542
|
let rsp = await super.get(null, index, timeout);
|
|
1539
1543
|
this._updateCache(null, rsp, index);
|
|
1540
1544
|
if (!rsp) return Array.isArray(params) ? new Array(params.length).fill(null) : null;
|
|
1541
|
-
if (
|
|
1545
|
+
if (!params) return rsp;
|
|
1546
|
+
else if (Array.isArray(params)) {
|
|
1542
1547
|
return params.map(p => {
|
|
1543
1548
|
let f = Object.keys(rsp).find(rv => this._toNamed(rv) === p);
|
|
1544
1549
|
return f ? rsp[f] : null;
|