@whitesev/utils 1.5.9 → 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 +19 -11
- package/dist/index.amd.js.map +1 -1
- package/dist/index.cjs.js +19 -11
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +19 -11
- package/dist/index.esm.js.map +1 -1
- package/dist/index.iife.js +19 -11
- package/dist/index.iife.js.map +1 -1
- package/dist/index.system.js +19 -11
- package/dist/index.system.js.map +1 -1
- package/dist/index.umd.js +19 -11
- 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/src/Utils.ts +9 -1
package/dist/index.system.js
CHANGED
|
@@ -3281,14 +3281,14 @@ System.register('Utils', [], (function (exports) {
|
|
|
3281
3281
|
};
|
|
3282
3282
|
|
|
3283
3283
|
class UtilsDictionary {
|
|
3284
|
-
|
|
3284
|
+
items = {};
|
|
3285
3285
|
constructor() { }
|
|
3286
3286
|
/**
|
|
3287
3287
|
* 检查是否有某一个键
|
|
3288
3288
|
* @param key 键
|
|
3289
3289
|
*/
|
|
3290
3290
|
has(key) {
|
|
3291
|
-
return this
|
|
3291
|
+
return this.items.hasOwnProperty(key);
|
|
3292
3292
|
}
|
|
3293
3293
|
/**
|
|
3294
3294
|
* 检查已有的键中是否以xx开头
|
|
@@ -3312,7 +3312,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
3312
3312
|
let result = null;
|
|
3313
3313
|
for (const keyName of allKeys) {
|
|
3314
3314
|
if (keyName.startsWith(key)) {
|
|
3315
|
-
result = this
|
|
3315
|
+
result = this.items[keyName];
|
|
3316
3316
|
break;
|
|
3317
3317
|
}
|
|
3318
3318
|
}
|
|
@@ -3327,7 +3327,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
3327
3327
|
if (key === void 0) {
|
|
3328
3328
|
throw new Error("Utils.Dictionary().set 参数 key 不能为空");
|
|
3329
3329
|
}
|
|
3330
|
-
this
|
|
3330
|
+
this.items[key] = val;
|
|
3331
3331
|
}
|
|
3332
3332
|
/**
|
|
3333
3333
|
* 删除某一个键
|
|
@@ -3335,7 +3335,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
3335
3335
|
*/
|
|
3336
3336
|
delete(key) {
|
|
3337
3337
|
if (this.has(key)) {
|
|
3338
|
-
Reflect.deleteProperty(this
|
|
3338
|
+
Reflect.deleteProperty(this.items, key);
|
|
3339
3339
|
return true;
|
|
3340
3340
|
}
|
|
3341
3341
|
return false;
|
|
@@ -3363,8 +3363,8 @@ System.register('Utils', [], (function (exports) {
|
|
|
3363
3363
|
* 清空字典
|
|
3364
3364
|
*/
|
|
3365
3365
|
clear() {
|
|
3366
|
-
this
|
|
3367
|
-
this
|
|
3366
|
+
this.items = void 0;
|
|
3367
|
+
this.items = {};
|
|
3368
3368
|
}
|
|
3369
3369
|
/**
|
|
3370
3370
|
* 获取字典的长度
|
|
@@ -3382,14 +3382,14 @@ System.register('Utils', [], (function (exports) {
|
|
|
3382
3382
|
* 返回字典本身
|
|
3383
3383
|
*/
|
|
3384
3384
|
getItems() {
|
|
3385
|
-
return this
|
|
3385
|
+
return this.items;
|
|
3386
3386
|
}
|
|
3387
3387
|
/**
|
|
3388
3388
|
* 合并另一个字典
|
|
3389
3389
|
* @param data 需要合并的字典
|
|
3390
3390
|
*/
|
|
3391
3391
|
concat(data) {
|
|
3392
|
-
this
|
|
3392
|
+
this.items = utils.assign(this.items, data.getItems());
|
|
3393
3393
|
}
|
|
3394
3394
|
forEach(callbackfn) {
|
|
3395
3395
|
for (const key in this.getItems()) {
|
|
@@ -3466,13 +3466,20 @@ System.register('Utils', [], (function (exports) {
|
|
|
3466
3466
|
return source;
|
|
3467
3467
|
}
|
|
3468
3468
|
}
|
|
3469
|
+
if (source == null) {
|
|
3470
|
+
return target;
|
|
3471
|
+
}
|
|
3472
|
+
if (target == null) {
|
|
3473
|
+
target = {};
|
|
3474
|
+
}
|
|
3469
3475
|
if (isAdd) {
|
|
3470
3476
|
for (const sourceKeyName in source) {
|
|
3471
3477
|
const targetKeyName = sourceKeyName;
|
|
3472
3478
|
let targetValue = target[targetKeyName];
|
|
3473
3479
|
let sourceValue = source[sourceKeyName];
|
|
3474
|
-
if (
|
|
3475
|
-
|
|
3480
|
+
if (typeof sourceValue === "object" &&
|
|
3481
|
+
sourceValue != null &&
|
|
3482
|
+
sourceKeyName in target &&
|
|
3476
3483
|
!UtilsContext.isDOM(sourceValue)) {
|
|
3477
3484
|
/* 源端的值是object类型,且不是元素节点 */
|
|
3478
3485
|
target[sourceKeyName] = UtilsContext.assign(targetValue, sourceValue, isAdd);
|
|
@@ -3487,6 +3494,7 @@ System.register('Utils', [], (function (exports) {
|
|
|
3487
3494
|
let targetValue = target[targetKeyName];
|
|
3488
3495
|
let sourceValue = source[targetKeyName];
|
|
3489
3496
|
if (typeof sourceValue === "object" &&
|
|
3497
|
+
sourceValue != null &&
|
|
3490
3498
|
!UtilsContext.isDOM(sourceValue) &&
|
|
3491
3499
|
Object.keys(sourceValue).length) {
|
|
3492
3500
|
/* 源端的值是object类型,且不是元素节点 */
|