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