@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.umd.js
CHANGED
|
@@ -3282,14 +3282,14 @@
|
|
|
3282
3282
|
};
|
|
3283
3283
|
|
|
3284
3284
|
class UtilsDictionary {
|
|
3285
|
-
|
|
3285
|
+
items = {};
|
|
3286
3286
|
constructor() { }
|
|
3287
3287
|
/**
|
|
3288
3288
|
* 检查是否有某一个键
|
|
3289
3289
|
* @param key 键
|
|
3290
3290
|
*/
|
|
3291
3291
|
has(key) {
|
|
3292
|
-
return this
|
|
3292
|
+
return this.items.hasOwnProperty(key);
|
|
3293
3293
|
}
|
|
3294
3294
|
/**
|
|
3295
3295
|
* 检查已有的键中是否以xx开头
|
|
@@ -3313,7 +3313,7 @@
|
|
|
3313
3313
|
let result = null;
|
|
3314
3314
|
for (const keyName of allKeys) {
|
|
3315
3315
|
if (keyName.startsWith(key)) {
|
|
3316
|
-
result = this
|
|
3316
|
+
result = this.items[keyName];
|
|
3317
3317
|
break;
|
|
3318
3318
|
}
|
|
3319
3319
|
}
|
|
@@ -3328,7 +3328,7 @@
|
|
|
3328
3328
|
if (key === void 0) {
|
|
3329
3329
|
throw new Error("Utils.Dictionary().set 参数 key 不能为空");
|
|
3330
3330
|
}
|
|
3331
|
-
this
|
|
3331
|
+
this.items[key] = val;
|
|
3332
3332
|
}
|
|
3333
3333
|
/**
|
|
3334
3334
|
* 删除某一个键
|
|
@@ -3336,7 +3336,7 @@
|
|
|
3336
3336
|
*/
|
|
3337
3337
|
delete(key) {
|
|
3338
3338
|
if (this.has(key)) {
|
|
3339
|
-
Reflect.deleteProperty(this
|
|
3339
|
+
Reflect.deleteProperty(this.items, key);
|
|
3340
3340
|
return true;
|
|
3341
3341
|
}
|
|
3342
3342
|
return false;
|
|
@@ -3364,8 +3364,8 @@
|
|
|
3364
3364
|
* 清空字典
|
|
3365
3365
|
*/
|
|
3366
3366
|
clear() {
|
|
3367
|
-
this
|
|
3368
|
-
this
|
|
3367
|
+
this.items = void 0;
|
|
3368
|
+
this.items = {};
|
|
3369
3369
|
}
|
|
3370
3370
|
/**
|
|
3371
3371
|
* 获取字典的长度
|
|
@@ -3383,14 +3383,14 @@
|
|
|
3383
3383
|
* 返回字典本身
|
|
3384
3384
|
*/
|
|
3385
3385
|
getItems() {
|
|
3386
|
-
return this
|
|
3386
|
+
return this.items;
|
|
3387
3387
|
}
|
|
3388
3388
|
/**
|
|
3389
3389
|
* 合并另一个字典
|
|
3390
3390
|
* @param data 需要合并的字典
|
|
3391
3391
|
*/
|
|
3392
3392
|
concat(data) {
|
|
3393
|
-
this
|
|
3393
|
+
this.items = utils.assign(this.items, data.getItems());
|
|
3394
3394
|
}
|
|
3395
3395
|
forEach(callbackfn) {
|
|
3396
3396
|
for (const key in this.getItems()) {
|