@yelon/util 12.0.13 → 12.0.17
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +21 -21
- package/README.md +2 -2
- package/array/array-type.service.d.ts +68 -68
- package/array/array.service.d.ts +75 -75
- package/array/index.d.ts +2 -2
- package/array/yelon-util-array.d.ts +4 -4
- package/array/yelon-util-array.metadata.json +1 -1
- package/browser/browser.d.ts +4 -4
- package/browser/cookie.service.d.ts +64 -64
- package/browser/copy.d.ts +6 -6
- package/browser/index.d.ts +5 -5
- package/browser/is-empty.d.ts +6 -6
- package/browser/scroll.service.d.ts +34 -34
- package/browser/style.d.ts +21 -21
- package/bundles/browser.umd.js +275 -275
- package/bundles/yelon-util-array.umd.js +606 -606
- package/bundles/yelon-util-array.umd.js.map +1 -1
- package/bundles/yelon-util-config.umd.js +366 -366
- package/bundles/yelon-util-date-time.umd.js +216 -216
- package/bundles/yelon-util-decorator.umd.js +437 -437
- package/bundles/yelon-util-form.umd.js +116 -116
- package/bundles/yelon-util-format.umd.js +726 -726
- package/bundles/yelon-util-math.umd.js +83 -83
- package/bundles/yelon-util-other.umd.js +652 -656
- package/bundles/yelon-util-other.umd.js.map +1 -1
- package/bundles/yelon-util-pipes-currency.umd.js +83 -83
- package/bundles/yelon-util-pipes-filter.umd.js +353 -353
- package/bundles/yelon-util-pipes-format.umd.js +47 -47
- package/bundles/yelon-util-pipes.umd.js +7 -7
- package/bundles/yelon-util-token.umd.js +30 -30
- package/bundles/yelon-util.umd.js +7 -7
- package/config/abc/date-picker.type.d.ts +52 -52
- package/config/abc/error-collect.type.d.ts +10 -10
- package/config/abc/image.type.d.ts +15 -15
- package/config/abc/index.d.ts +16 -16
- package/config/abc/loading.type.d.ts +31 -31
- package/config/abc/lodop.type.d.ts +33 -33
- package/config/abc/media.type.d.ts +11 -11
- package/config/abc/onboarding.type.d.ts +4 -4
- package/config/abc/page-header.type.d.ts +39 -39
- package/config/abc/pdf.type.d.ts +35 -35
- package/config/abc/qr.type.d.ts +25 -25
- package/config/abc/se.type.d.ts +32 -32
- package/config/abc/sg.type.d.ts +10 -10
- package/config/abc/st.type.d.ts +427 -431
- package/config/abc/sv.type.d.ts +14 -14
- package/config/abc/xlsx.type.d.ts +12 -12
- package/config/abc/zip.type.d.ts +10 -10
- package/config/acl/acl.type.d.ts +32 -32
- package/config/auth/auth.type.d.ts +55 -55
- package/config/bis/bis.type.d.ts +7 -7
- package/config/cache/cache.type.d.ts +40 -40
- package/config/chart/chart.type.d.ts +33 -33
- package/config/config.service.d.ts +10 -10
- package/config/config.types.d.ts +49 -49
- package/config/index.d.ts +14 -14
- package/config/mock/mock.type.d.ts +18 -18
- package/config/sf/sf.type.d.ts +127 -127
- package/config/stomp/stomp.type.d.ts +2 -2
- package/config/theme/http.type.d.ts +14 -14
- package/config/theme/i18n.type.d.ts +8 -8
- package/config/theme/index.d.ts +3 -3
- package/config/theme/responsive.type.d.ts +12 -12
- package/config/util/array.type.d.ts +22 -22
- package/config/util/currency.type.d.ts +39 -39
- package/config/yelon-util-config.d.ts +4 -4
- package/date-time/index.d.ts +2 -2
- package/date-time/picker.d.ts +68 -68
- package/date-time/time.d.ts +26 -26
- package/date-time/yelon-util-date-time.d.ts +4 -4
- package/decorator/convert.d.ts +24 -24
- package/decorator/index.d.ts +2 -2
- package/decorator/yelon-util-decorator.d.ts +4 -4
- package/decorator/zone-outside.d.ts +35 -35
- package/esm2015/array/array-type.service.js +1 -1
- package/esm2015/array/array.service.js +250 -250
- package/esm2015/array/index.js +2 -2
- package/esm2015/array/yelon-util-array.js +4 -4
- package/esm2015/browser/browser.js +4 -4
- package/esm2015/browser/cookie.service.js +103 -103
- package/esm2015/browser/copy.js +26 -26
- package/esm2015/browser/index.js +5 -5
- package/esm2015/browser/is-empty.js +18 -18
- package/esm2015/browser/scroll.service.js +88 -88
- package/esm2015/browser/style.js +37 -37
- package/esm2015/config/abc/date-picker.type.js +1 -1
- package/esm2015/config/abc/error-collect.type.js +1 -1
- package/esm2015/config/abc/image.type.js +1 -1
- package/esm2015/config/abc/index.js +16 -16
- package/esm2015/config/abc/loading.type.js +1 -1
- package/esm2015/config/abc/lodop.type.js +1 -1
- package/esm2015/config/abc/media.type.js +1 -1
- package/esm2015/config/abc/onboarding.type.js +1 -1
- package/esm2015/config/abc/page-header.type.js +1 -1
- package/esm2015/config/abc/pdf.type.js +1 -1
- package/esm2015/config/abc/qr.type.js +1 -1
- package/esm2015/config/abc/se.type.js +1 -1
- package/esm2015/config/abc/sg.type.js +1 -1
- package/esm2015/config/abc/st.type.js +2 -2
- package/esm2015/config/abc/sv.type.js +2 -2
- package/esm2015/config/abc/xlsx.type.js +1 -1
- package/esm2015/config/abc/zip.type.js +1 -1
- package/esm2015/config/acl/acl.type.js +1 -1
- package/esm2015/config/auth/auth.type.js +1 -1
- package/esm2015/config/bis/bis.type.js +1 -1
- package/esm2015/config/cache/cache.type.js +1 -1
- package/esm2015/config/chart/chart.type.js +1 -1
- package/esm2015/config/config.service.js +33 -33
- package/esm2015/config/config.types.js +8 -8
- package/esm2015/config/index.js +14 -14
- package/esm2015/config/mock/mock.type.js +1 -1
- package/esm2015/config/sf/sf.type.js +1 -1
- package/esm2015/config/stomp/stomp.type.js +1 -1
- package/esm2015/config/theme/http.type.js +1 -1
- package/esm2015/config/theme/i18n.type.js +1 -1
- package/esm2015/config/theme/index.js +3 -3
- package/esm2015/config/theme/responsive.type.js +1 -1
- package/esm2015/config/util/array.type.js +1 -1
- package/esm2015/config/util/currency.type.js +1 -1
- package/esm2015/config/yelon-util-config.js +4 -4
- package/esm2015/date-time/index.js +2 -2
- package/esm2015/date-time/picker.js +115 -115
- package/esm2015/date-time/time.js +83 -83
- package/esm2015/date-time/yelon-util-date-time.js +4 -4
- package/esm2015/decorator/convert.js +55 -55
- package/esm2015/decorator/index.js +2 -2
- package/esm2015/decorator/yelon-util-decorator.js +4 -4
- package/esm2015/decorator/zone-outside.js +54 -54
- package/esm2015/form/index.js +2 -2
- package/esm2015/form/match-control.js +29 -29
- package/esm2015/form/validators.js +80 -80
- package/esm2015/form/yelon-util-form.js +4 -4
- package/esm2015/format/currency.service.js +224 -224
- package/esm2015/format/currency.types.js +7 -7
- package/esm2015/format/index.js +4 -4
- package/esm2015/format/string.js +75 -75
- package/esm2015/format/validate.js +93 -93
- package/esm2015/format/yelon-util-format.js +4 -4
- package/esm2015/index.js +11 -11
- package/esm2015/math/in-range.js +24 -24
- package/esm2015/math/index.js +2 -2
- package/esm2015/math/round.js +52 -52
- package/esm2015/math/yelon-util-math.js +4 -4
- package/esm2015/other/assert.js +66 -66
- package/esm2015/other/deep.js +76 -76
- package/esm2015/other/index.js +4 -4
- package/esm2015/other/lazy.service.js +118 -118
- package/esm2015/other/logger.js +33 -36
- package/esm2015/other/yelon-util-other.js +4 -4
- package/esm2015/pipes/currency/cny.pipe.js +21 -21
- package/esm2015/pipes/currency/index.js +3 -3
- package/esm2015/pipes/currency/mega.pipe.js +25 -25
- package/esm2015/pipes/currency/module.js +13 -13
- package/esm2015/pipes/currency/price.pipe.js +25 -25
- package/esm2015/pipes/currency/yelon-util-pipes-currency.js +5 -5
- package/esm2015/pipes/filter/filter.pipe.js +14 -14
- package/esm2015/pipes/filter/index.js +2 -2
- package/esm2015/pipes/filter/module.js +11 -11
- package/esm2015/pipes/filter/yelon-util-pipes-filter.js +4 -4
- package/esm2015/pipes/format/index.js +2 -2
- package/esm2015/pipes/format/mask.pipe.js +29 -29
- package/esm2015/pipes/format/module.js +11 -11
- package/esm2015/pipes/format/yelon-util-pipes-format.js +4 -4
- package/esm2015/pipes/index.js +3 -3
- package/esm2015/pipes/yelon-util-pipes.js +4 -4
- package/esm2015/token/index.js +2 -2
- package/esm2015/token/page-visibility.js +15 -15
- package/esm2015/token/window.js +16 -16
- package/esm2015/token/yelon-util-token.js +4 -4
- package/esm2015/yelon-util.js +4 -4
- package/fesm2015/browser.js +257 -257
- package/fesm2015/yelon-util-array.js +246 -246
- package/fesm2015/yelon-util-array.js.map +1 -1
- package/fesm2015/yelon-util-config.js +36 -36
- package/fesm2015/yelon-util-date-time.js +196 -196
- package/fesm2015/yelon-util-decorator.js +107 -107
- package/fesm2015/yelon-util-form.js +108 -108
- package/fesm2015/yelon-util-format.js +390 -390
- package/fesm2015/yelon-util-math.js +75 -75
- package/fesm2015/yelon-util-other.js +281 -284
- package/fesm2015/yelon-util-other.js.map +1 -1
- package/fesm2015/yelon-util-pipes-currency.js +72 -72
- package/fesm2015/yelon-util-pipes-filter.js +22 -22
- package/fesm2015/yelon-util-pipes-format.js +36 -36
- package/fesm2015/yelon-util-pipes.js +2 -2
- package/fesm2015/yelon-util-token.js +25 -25
- package/fesm2015/yelon-util.js +2 -2
- package/form/index.d.ts +2 -2
- package/form/match-control.d.ts +15 -15
- package/form/validators.d.ts +62 -62
- package/form/yelon-util-form.d.ts +4 -4
- package/format/currency.service.d.ts +34 -34
- package/format/currency.types.d.ts +77 -77
- package/format/index.d.ts +4 -4
- package/format/string.d.ts +44 -44
- package/format/validate.d.ts +72 -72
- package/format/yelon-util-format.d.ts +4 -4
- package/index.d.ts +11 -11
- package/math/in-range.d.ts +14 -14
- package/math/index.d.ts +2 -2
- package/math/round.d.ts +33 -33
- package/math/yelon-util-math.d.ts +4 -4
- package/other/assert.d.ts +36 -36
- package/other/deep.d.ts +33 -33
- package/other/index.d.ts +4 -4
- package/other/lazy.service.d.ts +22 -22
- package/other/logger.d.ts +5 -6
- package/other/yelon-util-other.d.ts +4 -4
- package/other/yelon-util-other.metadata.json +1 -1
- package/package.json +1 -1
- package/pipes/currency/cny.pipe.d.ts +12 -12
- package/pipes/currency/index.d.ts +3 -3
- package/pipes/currency/mega.pipe.d.ts +13 -13
- package/pipes/currency/module.d.ts +2 -2
- package/pipes/currency/price.pipe.d.ts +16 -16
- package/pipes/currency/yelon-util-pipes-currency.d.ts +5 -5
- package/pipes/filter/filter.pipe.d.ts +10 -10
- package/pipes/filter/index.d.ts +2 -2
- package/pipes/filter/module.d.ts +2 -2
- package/pipes/filter/yelon-util-pipes-filter.d.ts +4 -4
- package/pipes/format/index.d.ts +2 -2
- package/pipes/format/mask.pipe.d.ts +24 -24
- package/pipes/format/module.d.ts +2 -2
- package/pipes/format/yelon-util-pipes-format.d.ts +4 -4
- package/pipes/index.d.ts +3 -3
- package/pipes/yelon-util-pipes.d.ts +4 -4
- package/token/index.d.ts +2 -2
- package/token/page-visibility.d.ts +8 -8
- package/token/window.d.ts +7 -7
- package/token/yelon-util-token.d.ts +4 -4
- package/yelon-util.d.ts +4 -4
package/esm2015/other/assert.js
CHANGED
@@ -1,67 +1,67 @@
|
|
1
|
-
import { isObservable } from 'rxjs';
|
2
|
-
function throwError(msg, actual, expected, comparison) {
|
3
|
-
if (ngDevMode) {
|
4
|
-
throw new Error(`ASSERTION ERROR: ${msg}${comparison == null ? '' : ` [Expected=> ${expected} ${comparison} ${actual} <=Actual]`}`);
|
5
|
-
}
|
6
|
-
}
|
7
|
-
/**
|
8
|
-
* Assert whether the expression and throw an error into console in dev mode
|
9
|
-
*
|
10
|
-
* 断言表达式是否符合预期,并在开发模式下会在控制台抛出一个错误
|
11
|
-
*/
|
12
|
-
export function assert(expression, msg) {
|
13
|
-
if (!expression) {
|
14
|
-
throwError(msg);
|
15
|
-
}
|
16
|
-
}
|
17
|
-
/**
|
18
|
-
* Assert whether empty (`null` or `undefined`)
|
19
|
-
*
|
20
|
-
* 断言是否空值(`null` 或 `undefined`)
|
21
|
-
*/
|
22
|
-
export function assertEmpty(actual, msg) {
|
23
|
-
if (actual == null) {
|
24
|
-
throwError(msg, typeof actual, 'NULL', '==');
|
25
|
-
}
|
26
|
-
}
|
27
|
-
/**
|
28
|
-
* Assert whether `number` type
|
29
|
-
*
|
30
|
-
* 断言是否 `number` 类型
|
31
|
-
*/
|
32
|
-
export function assertNumber(actual, msg) {
|
33
|
-
if (!(typeof actual === 'number')) {
|
34
|
-
throwError(msg, typeof actual, 'number', '===');
|
35
|
-
}
|
36
|
-
}
|
37
|
-
/**
|
38
|
-
* Assert whether `string` type
|
39
|
-
*
|
40
|
-
* 断言是否 `string` 类型
|
41
|
-
*/
|
42
|
-
export function assertString(actual, msg) {
|
43
|
-
if (!(typeof actual === 'string')) {
|
44
|
-
throwError(msg, actual === null ? 'null' : typeof actual, 'string', '===');
|
45
|
-
}
|
46
|
-
}
|
47
|
-
/**
|
48
|
-
* Assert whether `array` type
|
49
|
-
*
|
50
|
-
* 断言是否 `array` 类型
|
51
|
-
*/
|
52
|
-
export function assertArray(actual, msg) {
|
53
|
-
if (!Array.isArray(actual)) {
|
54
|
-
throwError(msg, actual === null ? 'null' : typeof actual, 'array', '===');
|
55
|
-
}
|
56
|
-
}
|
57
|
-
/**
|
58
|
-
* Assert whether `Observable` type
|
59
|
-
*
|
60
|
-
* 断言是否 `Observable` 类型
|
61
|
-
*/
|
62
|
-
export function assertObservable(obj, msg) {
|
63
|
-
if (!isObservable(obj)) {
|
64
|
-
throwError(msg, obj === null ? 'null' : typeof obj, 'Observable', '===');
|
65
|
-
}
|
66
|
-
}
|
1
|
+
import { isObservable } from 'rxjs';
|
2
|
+
function throwError(msg, actual, expected, comparison) {
|
3
|
+
if (ngDevMode) {
|
4
|
+
throw new Error(`ASSERTION ERROR: ${msg}${comparison == null ? '' : ` [Expected=> ${expected} ${comparison} ${actual} <=Actual]`}`);
|
5
|
+
}
|
6
|
+
}
|
7
|
+
/**
|
8
|
+
* Assert whether the expression and throw an error into console in dev mode
|
9
|
+
*
|
10
|
+
* 断言表达式是否符合预期,并在开发模式下会在控制台抛出一个错误
|
11
|
+
*/
|
12
|
+
export function assert(expression, msg) {
|
13
|
+
if (!expression) {
|
14
|
+
throwError(msg);
|
15
|
+
}
|
16
|
+
}
|
17
|
+
/**
|
18
|
+
* Assert whether empty (`null` or `undefined`)
|
19
|
+
*
|
20
|
+
* 断言是否空值(`null` 或 `undefined`)
|
21
|
+
*/
|
22
|
+
export function assertEmpty(actual, msg) {
|
23
|
+
if (actual == null) {
|
24
|
+
throwError(msg, typeof actual, 'NULL', '==');
|
25
|
+
}
|
26
|
+
}
|
27
|
+
/**
|
28
|
+
* Assert whether `number` type
|
29
|
+
*
|
30
|
+
* 断言是否 `number` 类型
|
31
|
+
*/
|
32
|
+
export function assertNumber(actual, msg) {
|
33
|
+
if (!(typeof actual === 'number')) {
|
34
|
+
throwError(msg, typeof actual, 'number', '===');
|
35
|
+
}
|
36
|
+
}
|
37
|
+
/**
|
38
|
+
* Assert whether `string` type
|
39
|
+
*
|
40
|
+
* 断言是否 `string` 类型
|
41
|
+
*/
|
42
|
+
export function assertString(actual, msg) {
|
43
|
+
if (!(typeof actual === 'string')) {
|
44
|
+
throwError(msg, actual === null ? 'null' : typeof actual, 'string', '===');
|
45
|
+
}
|
46
|
+
}
|
47
|
+
/**
|
48
|
+
* Assert whether `array` type
|
49
|
+
*
|
50
|
+
* 断言是否 `array` 类型
|
51
|
+
*/
|
52
|
+
export function assertArray(actual, msg) {
|
53
|
+
if (!Array.isArray(actual)) {
|
54
|
+
throwError(msg, actual === null ? 'null' : typeof actual, 'array', '===');
|
55
|
+
}
|
56
|
+
}
|
57
|
+
/**
|
58
|
+
* Assert whether `Observable` type
|
59
|
+
*
|
60
|
+
* 断言是否 `Observable` 类型
|
61
|
+
*/
|
62
|
+
export function assertObservable(obj, msg) {
|
63
|
+
if (!isObservable(obj)) {
|
64
|
+
throwError(msg, obj === null ? 'null' : typeof obj, 'Observable', '===');
|
65
|
+
}
|
66
|
+
}
|
67
67
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXNzZXJ0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvdXRpbC9vdGhlci9hc3NlcnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLE1BQU0sQ0FBQztBQU1wQyxTQUFTLFVBQVUsQ0FBQyxHQUE4QixFQUFFLE1BQWdCLEVBQUUsU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7XG4gIGlmICghQXJyYXkuaXNBcnJheShhY3R1YWwpKSB7XG4gICAgdGhyb3dFcnJvcihtc2csIGFjdHVhbCA9PT0gbnVsbCA/ICdudWxsJyA6IHR5cGVvZiBhY3R1YWwsICdhcnJheScsICc9PT0nKTtcbiAgfVxufVxuXG4vKipcbiAqIEFzc2VydCB3aGV0aGVyIGBPYnNlcnZhYmxlYCB0eXBlXG4gKlxuICog5pat6KiA5piv5ZCmIGBPYnNlcnZhYmxlYCDnsbvlnotcbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIGFzc2VydE9ic2VydmFibGUob2JqOiB1bmtub3duLCBtc2c/OiBzdHJpbmcpOiB2b2lkIHtcbiAgaWYgKCFpc09ic2VydmFibGUob2JqKSkge1xuICAgIHRocm93RXJyb3IobXNnLCBvYmogPT09IG51bGwgPyAnbnVsbCcgOiB0eXBlb2Ygb2JqLCAnT2JzZXJ2YWJsZScsICc9PT0nKTtcbiAgfVxufVxuIl19
|
package/esm2015/other/deep.js
CHANGED
@@ -1,76 +1,76 @@
|
|
1
|
-
import extend from 'extend';
|
2
|
-
/**
|
3
|
-
* Gets the value at `path` of `object`, like `_.get` in lodash.
|
4
|
-
*
|
5
|
-
* 类似 `_.get`,根据 `path` 获取安全值
|
6
|
-
*/
|
7
|
-
export function deepGet(obj, path, defaultValue) {
|
8
|
-
if (!obj || path == null || path.length === 0)
|
9
|
-
return defaultValue;
|
10
|
-
if (!Array.isArray(path)) {
|
11
|
-
path = ~path.indexOf('.') ? path.split('.') : [path];
|
12
|
-
}
|
13
|
-
if (path.length === 1) {
|
14
|
-
const checkObj = obj[path[0]];
|
15
|
-
return typeof checkObj === 'undefined' ? defaultValue : checkObj;
|
16
|
-
}
|
17
|
-
const res = path.reduce((o, k) => (o || {})[k], obj);
|
18
|
-
return typeof res === 'undefined' ? defaultValue : res;
|
19
|
-
}
|
20
|
-
/**
|
21
|
-
* Base on [extend](https://github.com/justmoon/node-extend) deep copy.
|
22
|
-
*
|
23
|
-
* 基于 [extend](https://github.com/justmoon/node-extend) 的深度拷贝
|
24
|
-
*/
|
25
|
-
export function deepCopy(obj) {
|
26
|
-
const result = extend(true, {}, { _: obj });
|
27
|
-
return result._;
|
28
|
-
}
|
29
|
-
/**
|
30
|
-
* Deep merge object.
|
31
|
-
*
|
32
|
-
* 深度合并对象
|
33
|
-
*
|
34
|
-
* @param original 原始对象
|
35
|
-
* @param arrayProcessMethod 数组处理方式
|
36
|
-
* - `true` 表示替换新值,不管新值为哪种类型
|
37
|
-
* - `false` 表示会合并整个数组(将旧数据与新数据合并成新数组)
|
38
|
-
* @param objects 要合并的对象
|
39
|
-
*/
|
40
|
-
export function deepMergeKey(original, arrayProcessMethod, ...objects) {
|
41
|
-
if (Array.isArray(original) || typeof original !== 'object')
|
42
|
-
return original;
|
43
|
-
const isObject = (v) => typeof v === 'object';
|
44
|
-
const merge = (target, obj) => {
|
45
|
-
Object.keys(obj)
|
46
|
-
.filter(key => key !== '__proto__' && Object.prototype.hasOwnProperty.call(obj, key))
|
47
|
-
.forEach(key => {
|
48
|
-
const fromValue = obj[key];
|
49
|
-
const toValue = target[key];
|
50
|
-
if (Array.isArray(toValue)) {
|
51
|
-
target[key] = arrayProcessMethod ? fromValue : [...toValue, ...fromValue];
|
52
|
-
}
|
53
|
-
else if (typeof fromValue === 'function') {
|
54
|
-
target[key] = fromValue;
|
55
|
-
}
|
56
|
-
else if (fromValue != null && isObject(fromValue) && toValue != null && isObject(toValue)) {
|
57
|
-
target[key] = merge(toValue, fromValue);
|
58
|
-
}
|
59
|
-
else {
|
60
|
-
target[key] = deepCopy(fromValue);
|
61
|
-
}
|
62
|
-
});
|
63
|
-
return target;
|
64
|
-
};
|
65
|
-
objects.filter(v => v != null && isObject(v)).forEach(v => merge(original, v));
|
66
|
-
return original;
|
67
|
-
}
|
68
|
-
/**
|
69
|
-
* Deep merge object.
|
70
|
-
*
|
71
|
-
* 深度合并对象
|
72
|
-
*/
|
73
|
-
export function deepMerge(original, ...objects) {
|
74
|
-
return deepMergeKey(original, false, ...objects);
|
75
|
-
}
|
76
|
-
//# sourceMappingURL=data:application/json;base64,
|
1
|
+
import extend from 'extend';
|
2
|
+
/**
|
3
|
+
* Gets the value at `path` of `object`, like `_.get` in lodash.
|
4
|
+
*
|
5
|
+
* 类似 `_.get`,根据 `path` 获取安全值
|
6
|
+
*/
|
7
|
+
export function deepGet(obj, path, defaultValue) {
|
8
|
+
if (!obj || path == null || path.length === 0)
|
9
|
+
return defaultValue;
|
10
|
+
if (!Array.isArray(path)) {
|
11
|
+
path = ~path.indexOf('.') ? path.split('.') : [path];
|
12
|
+
}
|
13
|
+
if (path.length === 1) {
|
14
|
+
const checkObj = obj[path[0]];
|
15
|
+
return typeof checkObj === 'undefined' ? defaultValue : checkObj;
|
16
|
+
}
|
17
|
+
const res = path.reduce((o, k) => (o || {})[k], obj);
|
18
|
+
return typeof res === 'undefined' ? defaultValue : res;
|
19
|
+
}
|
20
|
+
/**
|
21
|
+
* Base on [extend](https://github.com/justmoon/node-extend) deep copy.
|
22
|
+
*
|
23
|
+
* 基于 [extend](https://github.com/justmoon/node-extend) 的深度拷贝
|
24
|
+
*/
|
25
|
+
export function deepCopy(obj) {
|
26
|
+
const result = extend(true, {}, { _: obj });
|
27
|
+
return result._;
|
28
|
+
}
|
29
|
+
/**
|
30
|
+
* Deep merge object.
|
31
|
+
*
|
32
|
+
* 深度合并对象
|
33
|
+
*
|
34
|
+
* @param original 原始对象
|
35
|
+
* @param arrayProcessMethod 数组处理方式
|
36
|
+
* - `true` 表示替换新值,不管新值为哪种类型
|
37
|
+
* - `false` 表示会合并整个数组(将旧数据与新数据合并成新数组)
|
38
|
+
* @param objects 要合并的对象
|
39
|
+
*/
|
40
|
+
export function deepMergeKey(original, arrayProcessMethod, ...objects) {
|
41
|
+
if (Array.isArray(original) || typeof original !== 'object')
|
42
|
+
return original;
|
43
|
+
const isObject = (v) => typeof v === 'object';
|
44
|
+
const merge = (target, obj) => {
|
45
|
+
Object.keys(obj)
|
46
|
+
.filter(key => key !== '__proto__' && Object.prototype.hasOwnProperty.call(obj, key))
|
47
|
+
.forEach(key => {
|
48
|
+
const fromValue = obj[key];
|
49
|
+
const toValue = target[key];
|
50
|
+
if (Array.isArray(toValue)) {
|
51
|
+
target[key] = arrayProcessMethod ? fromValue : [...toValue, ...fromValue];
|
52
|
+
}
|
53
|
+
else if (typeof fromValue === 'function') {
|
54
|
+
target[key] = fromValue;
|
55
|
+
}
|
56
|
+
else if (fromValue != null && isObject(fromValue) && toValue != null && isObject(toValue)) {
|
57
|
+
target[key] = merge(toValue, fromValue);
|
58
|
+
}
|
59
|
+
else {
|
60
|
+
target[key] = deepCopy(fromValue);
|
61
|
+
}
|
62
|
+
});
|
63
|
+
return target;
|
64
|
+
};
|
65
|
+
objects.filter(v => v != null && isObject(v)).forEach(v => merge(original, v));
|
66
|
+
return original;
|
67
|
+
}
|
68
|
+
/**
|
69
|
+
* Deep merge object.
|
70
|
+
*
|
71
|
+
* 深度合并对象
|
72
|
+
*/
|
73
|
+
export function deepMerge(original, ...objects) {
|
74
|
+
return deepMergeKey(original, false, ...objects);
|
75
|
+
}
|
76
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVlcC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL3V0aWwvb3RoZXIvZGVlcC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLE1BQU0sTUFBTSxRQUFRLENBQUM7QUFJNUI7Ozs7R0FJRztBQUNILE1BQU0sVUFBVSxPQUFPLENBQUMsR0FBYyxFQUFFLElBQTBDLEVBQUUsWUFBc0I7SUFDeEcsSUFBSSxDQUFDLEdBQUcsSUFBSSxJQUFJLElBQUksSUFBSSxJQUFJLElBQUksQ0FBQyxNQUFNLEtBQUssQ0FBQztRQUFFLE9BQU8sWUFBWSxDQUFDO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JldHVybiBvcmlnaW5hbDtcbn1cblxuLyoqXG4gKiBEZWVwIG1lcmdlIG9iamVjdC5cbiAqXG4gKiDmt7HluqblkIjlubblr7nosaFcbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIGRlZXBNZXJnZShvcmlnaW5hbDogdW5rbm93biwgLi4ub2JqZWN0czogdW5rbm93bltdKTogTnpTYWZlQW55IHtcbiAgcmV0dXJuIGRlZXBNZXJnZUtleShvcmlnaW5hbCwgZmFsc2UsIC4uLm9iamVjdHMpO1xufVxuIl19
|
package/esm2015/other/index.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
export * from './deep';
|
2
|
-
export * from './logger';
|
3
|
-
export * from './lazy.service';
|
4
|
-
export * from './assert';
|
1
|
+
export * from './deep';
|
2
|
+
export * from './logger';
|
3
|
+
export * from './lazy.service';
|
4
|
+
export * from './assert';
|
5
5
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL290aGVyL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsUUFBUSxDQUFDO0FBQ3ZCLGNBQWMsVUFBVSxDQUFDO0FBQ3pCLGNBQWMsZ0JBQWdCLENBQUM7QUFDL0IsY0FBYyxVQUFVLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL2RlZXAnO1xuZXhwb3J0ICogZnJvbSAnLi9sb2dnZXInO1xuZXhwb3J0ICogZnJvbSAnLi9sYXp5LnNlcnZpY2UnO1xuZXhwb3J0ICogZnJvbSAnLi9hc3NlcnQnO1xuIl19
|
@@ -1,118 +1,118 @@
|
|
1
|
-
import { DOCUMENT } from '@angular/common';
|
2
|
-
import { Inject, Injectable } from '@angular/core';
|
3
|
-
import { BehaviorSubject } from 'rxjs';
|
4
|
-
import { filter, share } from 'rxjs/operators';
|
5
|
-
import * as i0 from "@angular/core";
|
6
|
-
import * as i1 from "@angular/common";
|
7
|
-
/**
|
8
|
-
* 延迟加载资源(js 或 css)服务
|
9
|
-
*/
|
10
|
-
export class LazyService {
|
11
|
-
constructor(doc) {
|
12
|
-
this.doc = doc;
|
13
|
-
this.list = {};
|
14
|
-
this.cached = {};
|
15
|
-
this._notify = new BehaviorSubject([]);
|
16
|
-
}
|
17
|
-
get change() {
|
18
|
-
return this._notify.asObservable().pipe(share(), filter(ls => ls.length !== 0));
|
19
|
-
}
|
20
|
-
clear() {
|
21
|
-
this.list = {};
|
22
|
-
this.cached = {};
|
23
|
-
}
|
24
|
-
load(paths) {
|
25
|
-
if (!Array.isArray(paths)) {
|
26
|
-
paths = [paths];
|
27
|
-
}
|
28
|
-
const promises = [];
|
29
|
-
paths.forEach(path => {
|
30
|
-
if (path.endsWith('.js')) {
|
31
|
-
promises.push(this.loadScript(path));
|
32
|
-
}
|
33
|
-
else {
|
34
|
-
promises.push(this.loadStyle(path));
|
35
|
-
}
|
36
|
-
});
|
37
|
-
return Promise.all(promises).then(res => {
|
38
|
-
this._notify.next(res);
|
39
|
-
return Promise.resolve(res);
|
40
|
-
});
|
41
|
-
}
|
42
|
-
loadScript(path, innerContent) {
|
43
|
-
return new Promise(resolve => {
|
44
|
-
if (this.list[path] === true) {
|
45
|
-
resolve(Object.assign(Object.assign({}, this.cached[path]), { status: 'loading' }));
|
46
|
-
return;
|
47
|
-
}
|
48
|
-
this.list[path] = true;
|
49
|
-
const onSuccess = (item) => {
|
50
|
-
this.cached[path] = item;
|
51
|
-
resolve(item);
|
52
|
-
this._notify.next([item]);
|
53
|
-
};
|
54
|
-
const node = this.doc.createElement('script');
|
55
|
-
node.type = 'text/javascript';
|
56
|
-
node.src = path;
|
57
|
-
node.charset = 'utf-8';
|
58
|
-
if (innerContent) {
|
59
|
-
node.innerHTML = innerContent;
|
60
|
-
}
|
61
|
-
if (node.readyState) {
|
62
|
-
// IE
|
63
|
-
node.onreadystatechange = () => {
|
64
|
-
if (node.readyState === 'loaded' || node.readyState === 'complete') {
|
65
|
-
node.onreadystatechange = null;
|
66
|
-
onSuccess({
|
67
|
-
path,
|
68
|
-
status: 'ok'
|
69
|
-
});
|
70
|
-
}
|
71
|
-
};
|
72
|
-
}
|
73
|
-
else {
|
74
|
-
node.onload = () => onSuccess({
|
75
|
-
path,
|
76
|
-
status: 'ok'
|
77
|
-
});
|
78
|
-
}
|
79
|
-
node.onerror = (error) => onSuccess({
|
80
|
-
path,
|
81
|
-
status: 'error',
|
82
|
-
error
|
83
|
-
});
|
84
|
-
this.doc.getElementsByTagName('head')[0].appendChild(node);
|
85
|
-
});
|
86
|
-
}
|
87
|
-
loadStyle(path, rel = 'stylesheet', innerContent) {
|
88
|
-
return new Promise(resolve => {
|
89
|
-
if (this.list[path] === true) {
|
90
|
-
resolve(this.cached[path]);
|
91
|
-
return;
|
92
|
-
}
|
93
|
-
this.list[path] = true;
|
94
|
-
const node = this.doc.createElement('link');
|
95
|
-
node.rel = rel;
|
96
|
-
node.type = 'text/css';
|
97
|
-
node.href = path;
|
98
|
-
if (innerContent) {
|
99
|
-
node.innerHTML = innerContent;
|
100
|
-
}
|
101
|
-
this.doc.getElementsByTagName('head')[0].appendChild(node);
|
102
|
-
const item = {
|
103
|
-
path,
|
104
|
-
status: 'ok'
|
105
|
-
};
|
106
|
-
this.cached[path] = item;
|
107
|
-
resolve(item);
|
108
|
-
});
|
109
|
-
}
|
110
|
-
}
|
111
|
-
LazyService.ɵprov = i0.ɵɵdefineInjectable({ factory: function LazyService_Factory() { return new LazyService(i0.ɵɵinject(i1.DOCUMENT)); }, token: LazyService, providedIn: "root" });
|
112
|
-
LazyService.decorators = [
|
113
|
-
{ type: Injectable, args: [{ providedIn: 'root' },] }
|
114
|
-
];
|
115
|
-
LazyService.ctorParameters = () => [
|
116
|
-
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
|
117
|
-
];
|
118
|
-
//# sourceMappingURL=data:application/json;base64,
|
1
|
+
import { DOCUMENT } from '@angular/common';
|
2
|
+
import { Inject, Injectable } from '@angular/core';
|
3
|
+
import { BehaviorSubject } from 'rxjs';
|
4
|
+
import { filter, share } from 'rxjs/operators';
|
5
|
+
import * as i0 from "@angular/core";
|
6
|
+
import * as i1 from "@angular/common";
|
7
|
+
/**
|
8
|
+
* 延迟加载资源(js 或 css)服务
|
9
|
+
*/
|
10
|
+
export class LazyService {
|
11
|
+
constructor(doc) {
|
12
|
+
this.doc = doc;
|
13
|
+
this.list = {};
|
14
|
+
this.cached = {};
|
15
|
+
this._notify = new BehaviorSubject([]);
|
16
|
+
}
|
17
|
+
get change() {
|
18
|
+
return this._notify.asObservable().pipe(share(), filter(ls => ls.length !== 0));
|
19
|
+
}
|
20
|
+
clear() {
|
21
|
+
this.list = {};
|
22
|
+
this.cached = {};
|
23
|
+
}
|
24
|
+
load(paths) {
|
25
|
+
if (!Array.isArray(paths)) {
|
26
|
+
paths = [paths];
|
27
|
+
}
|
28
|
+
const promises = [];
|
29
|
+
paths.forEach(path => {
|
30
|
+
if (path.endsWith('.js')) {
|
31
|
+
promises.push(this.loadScript(path));
|
32
|
+
}
|
33
|
+
else {
|
34
|
+
promises.push(this.loadStyle(path));
|
35
|
+
}
|
36
|
+
});
|
37
|
+
return Promise.all(promises).then(res => {
|
38
|
+
this._notify.next(res);
|
39
|
+
return Promise.resolve(res);
|
40
|
+
});
|
41
|
+
}
|
42
|
+
loadScript(path, innerContent) {
|
43
|
+
return new Promise(resolve => {
|
44
|
+
if (this.list[path] === true) {
|
45
|
+
resolve(Object.assign(Object.assign({}, this.cached[path]), { status: 'loading' }));
|
46
|
+
return;
|
47
|
+
}
|
48
|
+
this.list[path] = true;
|
49
|
+
const onSuccess = (item) => {
|
50
|
+
this.cached[path] = item;
|
51
|
+
resolve(item);
|
52
|
+
this._notify.next([item]);
|
53
|
+
};
|
54
|
+
const node = this.doc.createElement('script');
|
55
|
+
node.type = 'text/javascript';
|
56
|
+
node.src = path;
|
57
|
+
node.charset = 'utf-8';
|
58
|
+
if (innerContent) {
|
59
|
+
node.innerHTML = innerContent;
|
60
|
+
}
|
61
|
+
if (node.readyState) {
|
62
|
+
// IE
|
63
|
+
node.onreadystatechange = () => {
|
64
|
+
if (node.readyState === 'loaded' || node.readyState === 'complete') {
|
65
|
+
node.onreadystatechange = null;
|
66
|
+
onSuccess({
|
67
|
+
path,
|
68
|
+
status: 'ok'
|
69
|
+
});
|
70
|
+
}
|
71
|
+
};
|
72
|
+
}
|
73
|
+
else {
|
74
|
+
node.onload = () => onSuccess({
|
75
|
+
path,
|
76
|
+
status: 'ok'
|
77
|
+
});
|
78
|
+
}
|
79
|
+
node.onerror = (error) => onSuccess({
|
80
|
+
path,
|
81
|
+
status: 'error',
|
82
|
+
error
|
83
|
+
});
|
84
|
+
this.doc.getElementsByTagName('head')[0].appendChild(node);
|
85
|
+
});
|
86
|
+
}
|
87
|
+
loadStyle(path, rel = 'stylesheet', innerContent) {
|
88
|
+
return new Promise(resolve => {
|
89
|
+
if (this.list[path] === true) {
|
90
|
+
resolve(this.cached[path]);
|
91
|
+
return;
|
92
|
+
}
|
93
|
+
this.list[path] = true;
|
94
|
+
const node = this.doc.createElement('link');
|
95
|
+
node.rel = rel;
|
96
|
+
node.type = 'text/css';
|
97
|
+
node.href = path;
|
98
|
+
if (innerContent) {
|
99
|
+
node.innerHTML = innerContent;
|
100
|
+
}
|
101
|
+
this.doc.getElementsByTagName('head')[0].appendChild(node);
|
102
|
+
const item = {
|
103
|
+
path,
|
104
|
+
status: 'ok'
|
105
|
+
};
|
106
|
+
this.cached[path] = item;
|
107
|
+
resolve(item);
|
108
|
+
});
|
109
|
+
}
|
110
|
+
}
|
111
|
+
LazyService.ɵprov = i0.ɵɵdefineInjectable({ factory: function LazyService_Factory() { return new LazyService(i0.ɵɵinject(i1.DOCUMENT)); }, token: LazyService, providedIn: "root" });
|
112
|
+
LazyService.decorators = [
|
113
|
+
{ type: Injectable, args: [{ providedIn: 'root' },] }
|
114
|
+
];
|
115
|
+
LazyService.ctorParameters = () => [
|
116
|
+
{ type: undefined, decorators: [{ type: Inject, args: [DOCUMENT,] }] }
|
117
|
+
];
|
118
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGF6eS5zZXJ2aWNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvdXRpbC9vdGhlci9sYXp5LnNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLGlCQUFpQixDQUFDO0FBQzNDLE9BQU8sRUFBRSxNQUFNLEVBQUUsVUFBVSxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQ25ELE9BQU8sRUFBRSxlQUFlLEVBQWMsTUFBTSxNQUFNLENBQUM7QUFDbkQsT0FBTyxFQUFFLE1BQU0sRUFBRSxLQUFLLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQzs7O0FBVS9DOztHQUVHO0FBRUgsTUFBTSxPQUFPLFdBQVc7SUFLdEIsWUFBc0MsR0FBYztRQUFkLFFBQUcsR0FBSCxHQUFHLENBQVc7UUFKNUMsU0FBSSxHQUErQixFQUFFLENBQUM7UUFDdEMsV0FBTSxHQUFrQyxFQUFFLENBQUM7UUFDM0MsWUFBTyxHQUFrQyxJQUFJLGVBQWUsQ0FBZSxFQUFFLENBQUMsQ0FBQztJQUVoQyxDQUFDO0lBRXhELElBQUksTUFBTTtRQUNSLE9BQU8sSUFBSSxDQUFDLE9BQU8sQ0FBQyxZQUFZLEVBQUUsQ0FBQyxJQUFJLENBQ3JDLEtBQUssRUFBRSxFQUNQLE1BQU0sQ0FBQyxFQUFFLENBQUMsRUFBRSxDQUFDLEVBQUUsQ0FBQyxNQUFNLEtBQUssQ0FBQyxDQ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GlzLl9ub3RpZnkubmV4dChbaXRlbV0pO1xuICAgICAgfTtcblxuICAgICAgY29uc3Qgbm9kZSA9IHRoaXMuZG9jLmNyZWF0ZUVsZW1lbnQoJ3NjcmlwdCcpIGFzIE56U2FmZUFueTtcbiAgICAgIG5vZGUudHlwZSA9ICd0ZXh0L2phdmFzY3JpcHQnO1xuICAgICAgbm9kZS5zcmMgPSBwYXRoO1xuICAgICAgbm9kZS5jaGFyc2V0ID0gJ3V0Zi04JztcbiAgICAgIGlmIChpbm5lckNvbnRlbnQpIHtcbiAgICAgICAgbm9kZS5pbm5lckhUTUwgPSBpbm5lckNvbnRlbnQ7XG4gICAgICB9XG4gICAgICBpZiAobm9kZS5yZWFkeVN0YXRlKSB7XG4gICAgICAgIC8vIElFXG4gICAgICAgIG5vZGUub25yZWFkeXN0YXRlY2hhbmdlID0gKCkgPT4ge1xuICAgICAgICAgIGlmIChub2RlLnJlYWR5U3RhdGUgPT09ICdsb2FkZWQnIHx8IG5vZGUucmVhZHlTdGF0ZSA9PT0gJ2NvbXBsZXRlJykge1xuICAgICAgICAgICAgbm9kZS5vbnJlYWR5c3RhdGVjaGFuZ2UgPSBudWxsO1xuICAgICAgICAgICAgb25TdWNjZXNzKHtcbiAgICAgICAgICAgICAgcGF0aCxcbiAgICAgICAgICAgICAgc3RhdHVzOiAnb2snXG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICB9XG4gICAgICAgIH07XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBub2RlLm9ubG9hZCA9ICgpID0+XG4gICAgICAgICAgb25TdWNjZXNzKHtcbiAgICAgICAgICAgIHBhdGgsXG4gICAgICAgICAgICBzdGF0dXM6ICdvaydcbiAgICAgICAgICB9KTtcbiAgICAgIH1cbiAgICAgIG5vZGUub25lcnJvciA9IChlcnJvcjogTnpTYWZlQW55KSA9PlxuICAgICAgICBvblN1Y2Nlc3Moe1xuICAgICAgICAgIHBhdGgsXG4gICAgICAgICAgc3RhdHVzOiAnZXJyb3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