@whitesev/utils 1.6.0 → 1.6.1
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/index.amd.js +9 -9
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +9 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +9 -9
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +9 -9
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +9 -9
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +9 -9
- package/dist/index.umd.js.map +1 -1
- package/dist/src/Dictionary.d.ts +1 -1
- package/package.json +1 -1
- package/src/Dictionary.ts +9 -9
package/dist/index.esm.js
CHANGED
|
@@ -3276,14 +3276,14 @@ const TryCatch = function (...args) {
|
|
|
3276
3276
|
};
|
|
3277
3277
|
|
|
3278
3278
|
class UtilsDictionary {
|
|
3279
|
-
|
|
3279
|
+
items = {};
|
|
3280
3280
|
constructor() { }
|
|
3281
3281
|
/**
|
|
3282
3282
|
* 检查是否有某一个键
|
|
3283
3283
|
* @param key 键
|
|
3284
3284
|
*/
|
|
3285
3285
|
has(key) {
|
|
3286
|
-
return this
|
|
3286
|
+
return this.items.hasOwnProperty(key);
|
|
3287
3287
|
}
|
|
3288
3288
|
/**
|
|
3289
3289
|
* 检查已有的键中是否以xx开头
|
|
@@ -3307,7 +3307,7 @@ class UtilsDictionary {
|
|
|
3307
3307
|
let result = null;
|
|
3308
3308
|
for (const keyName of allKeys) {
|
|
3309
3309
|
if (keyName.startsWith(key)) {
|
|
3310
|
-
result = this
|
|
3310
|
+
result = this.items[keyName];
|
|
3311
3311
|
break;
|
|
3312
3312
|
}
|
|
3313
3313
|
}
|
|
@@ -3322,7 +3322,7 @@ class UtilsDictionary {
|
|
|
3322
3322
|
if (key === void 0) {
|
|
3323
3323
|
throw new Error("Utils.Dictionary().set 参数 key 不能为空");
|
|
3324
3324
|
}
|
|
3325
|
-
this
|
|
3325
|
+
this.items[key] = val;
|
|
3326
3326
|
}
|
|
3327
3327
|
/**
|
|
3328
3328
|
* 删除某一个键
|
|
@@ -3330,7 +3330,7 @@ class UtilsDictionary {
|
|
|
3330
3330
|
*/
|
|
3331
3331
|
delete(key) {
|
|
3332
3332
|
if (this.has(key)) {
|
|
3333
|
-
Reflect.deleteProperty(this
|
|
3333
|
+
Reflect.deleteProperty(this.items, key);
|
|
3334
3334
|
return true;
|
|
3335
3335
|
}
|
|
3336
3336
|
return false;
|
|
@@ -3358,8 +3358,8 @@ class UtilsDictionary {
|
|
|
3358
3358
|
* 清空字典
|
|
3359
3359
|
*/
|
|
3360
3360
|
clear() {
|
|
3361
|
-
this
|
|
3362
|
-
this
|
|
3361
|
+
this.items = void 0;
|
|
3362
|
+
this.items = {};
|
|
3363
3363
|
}
|
|
3364
3364
|
/**
|
|
3365
3365
|
* 获取字典的长度
|
|
@@ -3377,14 +3377,14 @@ class UtilsDictionary {
|
|
|
3377
3377
|
* 返回字典本身
|
|
3378
3378
|
*/
|
|
3379
3379
|
getItems() {
|
|
3380
|
-
return this
|
|
3380
|
+
return this.items;
|
|
3381
3381
|
}
|
|
3382
3382
|
/**
|
|
3383
3383
|
* 合并另一个字典
|
|
3384
3384
|
* @param data 需要合并的字典
|
|
3385
3385
|
*/
|
|
3386
3386
|
concat(data) {
|
|
3387
|
-
this
|
|
3387
|
+
this.items = utils.assign(this.items, data.getItems());
|
|
3388
3388
|
}
|
|
3389
3389
|
forEach(callbackfn) {
|
|
3390
3390
|
for (const key in this.getItems()) {
|