@yelon/util 15.2.4 → 16.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +21 -21
- package/README.md +22 -22
- package/analysis/global-event.subject.d.ts +7 -7
- package/analysis/index.d.ts +1 -1
- package/array/array-type.service.d.ts +68 -68
- package/array/array.service.d.ts +78 -78
- package/array/index.d.ts +2 -2
- package/browser/cookie.service.d.ts +67 -67
- 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 +37 -37
- package/browser/style.d.ts +21 -21
- package/config/abc/date-picker.type.d.ts +52 -52
- package/config/abc/error-collect.type.d.ts +10 -10
- package/config/abc/exception.type.d.ts +9 -9
- package/config/abc/image.type.d.ts +15 -15
- package/config/abc/index.d.ts +17 -17
- 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 +465 -465
- 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 +13 -13
- package/config/config.types.d.ts +48 -48
- package/config/index.d.ts +14 -14
- package/config/mock/mock.type.d.ts +18 -18
- package/config/sf/sf.type.d.ts +133 -133
- package/config/socket/socket.type.d.ts +4 -4
- package/config/theme/http.type.d.ts +14 -14
- package/config/theme/i18n.type.d.ts +14 -14
- 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/date-time/index.d.ts +2 -2
- package/date-time/picker.d.ts +68 -68
- package/date-time/time.d.ts +29 -29
- package/decorator/convert.d.ts +24 -24
- package/decorator/index.d.ts +2 -2
- package/decorator/zone-outside.d.ts +35 -35
- package/{esm2020 → esm2022}/analysis/analysis.mjs +4 -4
- package/esm2022/analysis/global-event.subject.mjs +18 -0
- package/{esm2020 → esm2022}/analysis/index.mjs +2 -2
- package/{esm2020 → esm2022}/array/array-type.service.mjs +1 -1
- package/{esm2020 → esm2022}/array/array.mjs +4 -4
- package/esm2022/array/array.service.mjs +278 -0
- package/{esm2020 → esm2022}/array/index.mjs +2 -2
- package/{esm2020 → esm2022}/browser/browser.mjs +4 -4
- package/esm2022/browser/cookie.service.mjs +104 -0
- package/{esm2020 → esm2022}/browser/copy.mjs +27 -27
- package/{esm2020 → esm2022}/browser/index.mjs +5 -5
- package/{esm2020 → esm2022}/browser/is-empty.mjs +18 -18
- package/esm2022/browser/scroll.service.mjs +89 -0
- package/{esm2020 → esm2022}/browser/style.mjs +37 -37
- package/{esm2020 → esm2022}/config/abc/date-picker.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/abc/error-collect.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/abc/exception.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/abc/image.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/abc/index.mjs +17 -17
- package/{esm2020 → esm2022}/config/abc/loading.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/abc/lodop.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/abc/media.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/abc/onboarding.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/abc/page-header.type.mjs +1 -1
- package/esm2022/config/abc/pdf.type.mjs +2 -0
- package/{esm2020 → esm2022}/config/abc/qr.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/abc/se.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/abc/sg.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/abc/st.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/abc/sv.type.mjs +2 -2
- package/{esm2020 → esm2022}/config/abc/xlsx.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/abc/zip.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/acl/acl.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/auth/auth.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/bis/bis.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/cache/cache.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/chart/chart.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/config.mjs +4 -4
- package/esm2022/config/config.service.mjs +38 -0
- package/{esm2020 → esm2022}/config/config.types.mjs +8 -8
- package/{esm2020 → esm2022}/config/index.mjs +14 -14
- package/{esm2020 → esm2022}/config/mock/mock.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/sf/sf.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/socket/socket.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/theme/http.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/theme/i18n.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/theme/index.mjs +3 -3
- package/{esm2020 → esm2022}/config/theme/responsive.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/util/array.type.mjs +1 -1
- package/{esm2020 → esm2022}/config/util/currency.type.mjs +1 -1
- package/{esm2020 → esm2022}/date-time/date-time.mjs +4 -4
- package/{esm2020 → esm2022}/date-time/index.mjs +2 -2
- package/{esm2020 → esm2022}/date-time/picker.mjs +115 -115
- package/{esm2020 → esm2022}/date-time/time.mjs +88 -88
- package/{esm2020 → esm2022}/decorator/convert.mjs +57 -57
- package/{esm2020 → esm2022}/decorator/decorator.mjs +4 -4
- package/{esm2020 → esm2022}/decorator/index.mjs +2 -2
- package/{esm2020 → esm2022}/decorator/zone-outside.mjs +56 -56
- package/{esm2020 → esm2022}/form/form.mjs +4 -4
- package/{esm2020 → esm2022}/form/index.mjs +2 -2
- package/{esm2020 → esm2022}/form/match-control.mjs +29 -29
- package/{esm2020 → esm2022}/form/validators.mjs +80 -80
- package/esm2022/format/currency.service.mjs +239 -0
- package/{esm2020 → esm2022}/format/currency.types.mjs +7 -7
- package/{esm2020 → esm2022}/format/format.mjs +4 -4
- package/{esm2020 → esm2022}/format/index.mjs +4 -4
- package/{esm2020 → esm2022}/format/string.mjs +84 -84
- package/{esm2020 → esm2022}/format/validate.mjs +93 -93
- package/{esm2020 → esm2022}/index.mjs +12 -12
- package/{esm2020 → esm2022}/math/in-range.mjs +24 -24
- package/{esm2020 → esm2022}/math/index.mjs +2 -2
- package/{esm2020 → esm2022}/math/math.mjs +4 -4
- package/{esm2020 → esm2022}/math/round.mjs +52 -52
- package/{esm2020 → esm2022}/other/assert.mjs +66 -66
- package/{esm2020 → esm2022}/other/deep.mjs +77 -77
- package/{esm2020 → esm2022}/other/favicon.mjs +28 -28
- package/{esm2020 → esm2022}/other/index.mjs +7 -7
- package/esm2022/other/lazy.service.mjs +133 -0
- package/{esm2020 → esm2022}/other/logger.mjs +32 -32
- package/{esm2020 → esm2022}/other/other.mjs +4 -4
- package/esm2022/other/path-to-regexp.service.mjs +240 -0
- package/{esm2020 → esm2022}/other/resize.mjs +3 -3
- package/esm2022/pipes/currency/cny.pipe.mjs +24 -0
- package/{esm2020 → esm2022}/pipes/currency/index.mjs +4 -4
- package/esm2022/pipes/currency/mega.pipe.mjs +30 -0
- package/esm2022/pipes/currency/module.mjs +20 -0
- package/{esm2020 → esm2022}/pipes/currency/pipe-currency.mjs +4 -4
- package/esm2022/pipes/currency/price.pipe.mjs +28 -0
- package/esm2022/pipes/filter/filter.pipe.mjs +20 -0
- package/{esm2020 → esm2022}/pipes/filter/index.mjs +2 -2
- package/esm2022/pipes/filter/module.mjs +18 -0
- package/{esm2020 → esm2022}/pipes/filter/pipe-filter.mjs +4 -4
- package/{esm2020 → esm2022}/pipes/format/index.mjs +2 -2
- package/esm2022/pipes/format/mask.pipe.mjs +35 -0
- package/esm2022/pipes/format/module.mjs +18 -0
- package/{esm2020 → esm2022}/pipes/format/pipe-format.mjs +4 -4
- package/{esm2020 → esm2022}/pipes/index.mjs +3 -3
- package/{esm2020 → esm2022}/pipes/pipes.mjs +4 -4
- package/{esm2020 → esm2022}/token/index.mjs +2 -2
- package/{esm2020 → esm2022}/token/page-visibility.mjs +14 -14
- package/{esm2020 → esm2022}/token/token.mjs +4 -4
- package/{esm2020 → esm2022}/token/window.mjs +16 -16
- package/{esm2020 → esm2022}/yelon-util.mjs +4 -4
- package/{fesm2020 → fesm2022}/analysis.mjs +24 -24
- package/fesm2022/analysis.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/array.mjs +284 -284
- package/{fesm2015 → fesm2022}/array.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/browser.mjs +279 -279
- package/{fesm2020 → fesm2022}/browser.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/config.mjs +54 -54
- package/{fesm2020 → fesm2022}/config.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/date-time.mjs +211 -211
- package/{fesm2020 → fesm2022}/decorator.mjs +121 -121
- package/{fesm2020 → fesm2022}/form.mjs +118 -118
- package/{fesm2020 → fesm2022}/format.mjs +431 -431
- package/{fesm2020 → fesm2022}/format.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/math.mjs +85 -85
- package/{fesm2020 → fesm2022}/other.mjs +586 -586
- package/{fesm2020 → fesm2022}/other.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/pipe-currency.mjs +94 -94
- package/{fesm2020 → fesm2022}/pipe-currency.mjs.map +1 -1
- package/fesm2022/pipe-filter.mjs +40 -0
- package/{fesm2015 → fesm2022}/pipe-filter.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/pipe-format.mjs +55 -55
- package/{fesm2015 → fesm2022}/pipe-format.mjs.map +1 -1
- package/{fesm2015 → fesm2022}/pipes.mjs +8 -8
- package/{fesm2020 → fesm2022}/token.mjs +37 -37
- package/{fesm2015 → fesm2022}/yelon-util.mjs +17 -17
- package/form/index.d.ts +2 -2
- package/form/match-control.d.ts +15 -15
- package/form/validators.d.ts +62 -62
- package/format/currency.service.d.ts +37 -37
- 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/index.d.ts +12 -12
- package/math/in-range.d.ts +14 -14
- package/math/index.d.ts +2 -2
- package/math/round.d.ts +33 -33
- package/other/assert.d.ts +36 -36
- package/other/deep.d.ts +35 -35
- package/other/favicon.d.ts +2 -2
- package/other/index.d.ts +7 -7
- package/other/lazy.service.d.ts +48 -48
- package/other/logger.d.ts +5 -5
- package/other/path-to-regexp.service.d.ts +26 -26
- package/other/resize.d.ts +1 -1
- package/package.json +129 -165
- package/pipes/currency/cny.pipe.d.ts +15 -15
- package/pipes/currency/index.d.ts +4 -4
- package/pipes/currency/mega.pipe.d.ts +16 -16
- package/pipes/currency/module.d.ts +9 -9
- package/pipes/currency/price.pipe.d.ts +19 -19
- package/pipes/filter/filter.pipe.d.ts +13 -13
- package/pipes/filter/index.d.ts +2 -2
- package/pipes/filter/module.d.ts +7 -7
- package/pipes/format/index.d.ts +2 -2
- package/pipes/format/mask.pipe.d.ts +27 -27
- package/pipes/format/module.d.ts +7 -7
- package/pipes/index.d.ts +3 -3
- package/token/index.d.ts +2 -2
- package/token/page-visibility.d.ts +8 -8
- package/token/window.d.ts +7 -7
- package/esm2020/analysis/global-event.subject.mjs +0 -17
- package/esm2020/array/array.service.mjs +0 -277
- package/esm2020/browser/cookie.service.mjs +0 -103
- package/esm2020/browser/scroll.service.mjs +0 -88
- package/esm2020/config/abc/pdf.type.mjs +0 -2
- package/esm2020/config/config.service.mjs +0 -37
- package/esm2020/format/currency.service.mjs +0 -238
- package/esm2020/other/lazy.service.mjs +0 -132
- package/esm2020/other/path-to-regexp.service.mjs +0 -239
- package/esm2020/pipes/currency/cny.pipe.mjs +0 -23
- package/esm2020/pipes/currency/mega.pipe.mjs +0 -29
- package/esm2020/pipes/currency/module.mjs +0 -19
- package/esm2020/pipes/currency/price.pipe.mjs +0 -27
- package/esm2020/pipes/filter/filter.pipe.mjs +0 -19
- package/esm2020/pipes/filter/module.mjs +0 -17
- package/esm2020/pipes/format/mask.pipe.mjs +0 -34
- package/esm2020/pipes/format/module.mjs +0 -17
- package/fesm2015/analysis.mjs +0 -24
- package/fesm2015/analysis.mjs.map +0 -1
- package/fesm2015/array.mjs +0 -254
- package/fesm2015/browser.mjs +0 -283
- package/fesm2015/browser.mjs.map +0 -1
- package/fesm2015/config.mjs +0 -56
- package/fesm2015/config.mjs.map +0 -1
- package/fesm2015/date-time.mjs +0 -207
- package/fesm2015/date-time.mjs.map +0 -1
- package/fesm2015/decorator.mjs +0 -121
- package/fesm2015/decorator.mjs.map +0 -1
- package/fesm2015/form.mjs +0 -118
- package/fesm2015/format.mjs +0 -413
- package/fesm2015/format.mjs.map +0 -1
- package/fesm2015/math.mjs +0 -85
- package/fesm2015/other.mjs +0 -589
- package/fesm2015/other.mjs.map +0 -1
- package/fesm2015/pipe-currency.mjs +0 -96
- package/fesm2015/pipe-currency.mjs.map +0 -1
- package/fesm2015/pipe-filter.mjs +0 -40
- package/fesm2015/pipe-format.mjs +0 -55
- package/fesm2015/token.mjs +0 -37
- package/fesm2020/analysis.mjs.map +0 -1
- package/fesm2020/array.mjs.map +0 -1
- package/fesm2020/form.mjs.map +0 -1
- package/fesm2020/math.mjs.map +0 -1
- package/fesm2020/pipe-filter.mjs +0 -40
- package/fesm2020/pipe-filter.mjs.map +0 -1
- package/fesm2020/pipe-format.mjs.map +0 -1
- package/fesm2020/pipes.mjs +0 -8
- package/fesm2020/pipes.mjs.map +0 -1
- package/fesm2020/token.mjs.map +0 -1
- package/fesm2020/yelon-util.mjs +0 -17
- package/fesm2020/yelon-util.mjs.map +0 -1
- /package/{fesm2020 → fesm2022}/date-time.mjs.map +0 -0
- /package/{fesm2020 → fesm2022}/decorator.mjs.map +0 -0
- /package/{fesm2015 → fesm2022}/form.mjs.map +0 -0
- /package/{fesm2015 → fesm2022}/math.mjs.map +0 -0
- /package/{fesm2015 → fesm2022}/pipes.mjs.map +0 -0
- /package/{fesm2015 → fesm2022}/token.mjs.map +0 -0
- /package/{fesm2015 → fesm2022}/yelon-util.mjs.map +0 -0
@@ -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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXNzZXJ0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvdXRpbC9vdGhlci9hc3NlcnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLE1BQU0sQ0FBQztBQU1wQyxTQUFTLFVBQVUsQ0FBQyxHQUE4QixFQUFFLE1BQWdCLEVBQUUsUUFBa0IsRUFBRSxVQU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kuaXNBcnJheShhY3R1YWwpKSB7XG4gICAgdGhyb3dFcnJvcihtc2csIGFjdHVhbCA9PT0gbnVsbCA/ICdudWxsJyA6IHR5cGVvZiBhY3R1YWwsICdhcnJheScsICc9PT0nKTtcbiAgfVxufVxuXG4vKipcbiAqIEFzc2VydCB3aGV0aGVyIGBPYnNlcnZhYmxlYCB0eXBlXG4gKlxuICog5pat6KiA5piv5ZCmIGBPYnNlcnZhYmxlYCDnsbvlnotcbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIGFzc2VydE9ic2VydmFibGUob2JqOiB1bmtub3duLCBtc2c/OiBzdHJpbmcpOiB2b2lkIHtcbiAgaWYgKCFpc09ic2VydmFibGUob2JqKSkge1xuICAgIHRocm93RXJyb3IobXNnLCBvYmogPT09IG51bGwgPyAnbnVsbCcgOiB0eXBlb2Ygb2JqLCAnT2JzZXJ2YWJsZScsICc9PT0nKTtcbiAgfVxufVxuIl19
|
@@ -1,78 +1,78 @@
|
|
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
|
-
* NOTE: Don't a lot of recursion, maybe performance issues
|
26
|
-
*/
|
27
|
-
export function deepCopy(obj) {
|
28
|
-
const result = extend(true, {}, { _: obj });
|
29
|
-
return result._;
|
30
|
-
}
|
31
|
-
/**
|
32
|
-
* Deep merge object.
|
33
|
-
*
|
34
|
-
* 深度合并对象
|
35
|
-
*
|
36
|
-
* @param original 原始对象
|
37
|
-
* @param arrayProcessMethod 数组处理方式
|
38
|
-
* - `true` 表示替换新值,不管新值为哪种类型
|
39
|
-
* - `false` 表示会合并整个数组(将旧数据与新数据合并成新数组)
|
40
|
-
* @param objects 要合并的对象
|
41
|
-
*/
|
42
|
-
export function deepMergeKey(original, arrayProcessMethod, ...objects) {
|
43
|
-
if (Array.isArray(original) || typeof original !== 'object')
|
44
|
-
return original;
|
45
|
-
const isObject = (v) => typeof v === 'object';
|
46
|
-
const merge = (target, obj) => {
|
47
|
-
Object.keys(obj)
|
48
|
-
.filter(key => key !== '__proto__' && Object.prototype.hasOwnProperty.call(obj, key))
|
49
|
-
.forEach(key => {
|
50
|
-
const fromValue = obj[key];
|
51
|
-
const toValue = target[key];
|
52
|
-
if (Array.isArray(toValue)) {
|
53
|
-
target[key] = arrayProcessMethod ? fromValue : [...toValue, ...fromValue];
|
54
|
-
}
|
55
|
-
else if (typeof fromValue === 'function') {
|
56
|
-
target[key] = fromValue;
|
57
|
-
}
|
58
|
-
else if (fromValue != null && isObject(fromValue) && toValue != null && isObject(toValue)) {
|
59
|
-
target[key] = merge(toValue, fromValue);
|
60
|
-
}
|
61
|
-
else {
|
62
|
-
target[key] = deepCopy(fromValue);
|
63
|
-
}
|
64
|
-
});
|
65
|
-
return target;
|
66
|
-
};
|
67
|
-
objects.filter(v => v != null && isObject(v)).forEach(v => merge(original, v));
|
68
|
-
return original;
|
69
|
-
}
|
70
|
-
/**
|
71
|
-
* Deep merge object.
|
72
|
-
*
|
73
|
-
* 深度合并对象
|
74
|
-
*/
|
75
|
-
export function deepMerge(original, ...objects) {
|
76
|
-
return deepMergeKey(original, false, ...objects);
|
77
|
-
}
|
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
|
+
* NOTE: Don't a lot of recursion, maybe performance issues
|
26
|
+
*/
|
27
|
+
export function deepCopy(obj) {
|
28
|
+
const result = extend(true, {}, { _: obj });
|
29
|
+
return result._;
|
30
|
+
}
|
31
|
+
/**
|
32
|
+
* Deep merge object.
|
33
|
+
*
|
34
|
+
* 深度合并对象
|
35
|
+
*
|
36
|
+
* @param original 原始对象
|
37
|
+
* @param arrayProcessMethod 数组处理方式
|
38
|
+
* - `true` 表示替换新值,不管新值为哪种类型
|
39
|
+
* - `false` 表示会合并整个数组(将旧数据与新数据合并成新数组)
|
40
|
+
* @param objects 要合并的对象
|
41
|
+
*/
|
42
|
+
export function deepMergeKey(original, arrayProcessMethod, ...objects) {
|
43
|
+
if (Array.isArray(original) || typeof original !== 'object')
|
44
|
+
return original;
|
45
|
+
const isObject = (v) => typeof v === 'object';
|
46
|
+
const merge = (target, obj) => {
|
47
|
+
Object.keys(obj)
|
48
|
+
.filter(key => key !== '__proto__' && Object.prototype.hasOwnProperty.call(obj, key))
|
49
|
+
.forEach(key => {
|
50
|
+
const fromValue = obj[key];
|
51
|
+
const toValue = target[key];
|
52
|
+
if (Array.isArray(toValue)) {
|
53
|
+
target[key] = arrayProcessMethod ? fromValue : [...toValue, ...fromValue];
|
54
|
+
}
|
55
|
+
else if (typeof fromValue === 'function') {
|
56
|
+
target[key] = fromValue;
|
57
|
+
}
|
58
|
+
else if (fromValue != null && isObject(fromValue) && toValue != null && isObject(toValue)) {
|
59
|
+
target[key] = merge(toValue, fromValue);
|
60
|
+
}
|
61
|
+
else {
|
62
|
+
target[key] = deepCopy(fromValue);
|
63
|
+
}
|
64
|
+
});
|
65
|
+
return target;
|
66
|
+
};
|
67
|
+
objects.filter(v => v != null && isObject(v)).forEach(v => merge(original, v));
|
68
|
+
return original;
|
69
|
+
}
|
70
|
+
/**
|
71
|
+
* Deep merge object.
|
72
|
+
*
|
73
|
+
* 深度合并对象
|
74
|
+
*/
|
75
|
+
export function deepMerge(original, ...objects) {
|
76
|
+
return deepMergeKey(original, false, ...objects);
|
77
|
+
}
|
78
78
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVlcC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL3V0aWwvb3RoZXIvZGVlcC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLE1BQU0sTUFBTSxRQUFRLENBQUM7QUFJNUI7Ozs7R0FJRztBQUNILE1BQU0sVUFBVSxPQUFPLENBQUMsR0FBYyxFQUFFLElBQTBDLEVBQUUsWUFBc0I7SUFDeEcsSUFBSSxDQUFDLEdBQUcsSUFBSSxJQUFJLElBQUksSUFBSSxJQUFJLElBQUksQ0FBQyxNQUFNLEtBQUssQ0FBQztRQUFFL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FyZ2V0O1xuICB9O1xuXG4gIG9iamVjdHMuZmlsdGVyKHYgPT4gdiAhPSBudWxsICYmIGlzT2JqZWN0KHYpKS5mb3JFYWNoKHYgPT4gbWVyZ2Uob3JpZ2luYWwsIHYpKTtcblxuICByZXR1cm4gb3JpZ2luYWw7XG59XG5cbi8qKlxuICogRGVlcCBtZXJnZSBvYmplY3QuXG4gKlxuICog5rex5bqm5ZCI5bm25a+56LGhXG4gKi9cbmV4cG9ydCBmdW5jdGlvbiBkZWVwTWVyZ2Uob3JpZ2luYWw6IHVua25vd24sIC4uLm9iamVjdHM6IHVua25vd25bXSk6IE56U2FmZUFueSB7XG4gIHJldHVybiBkZWVwTWVyZ2VLZXkob3JpZ2luYWwsIGZhbHNlLCAuLi5vYmplY3RzKTtcbn1cbiJdfQ==
|
@@ -1,29 +1,29 @@
|
|
1
|
-
export function setFavicon(path) {
|
2
|
-
const link = document.querySelector("link[rel*='icon']") || document.createElement('link');
|
3
|
-
link.type = 'image/x-icon';
|
4
|
-
link.rel = 'shortcut icon';
|
5
|
-
link.href = path;
|
6
|
-
document.getElementsByTagName('head')[0].appendChild(link);
|
7
|
-
}
|
8
|
-
export function hasFavicon(url) {
|
9
|
-
return new Promise(resolve => {
|
10
|
-
let xmlHttp;
|
11
|
-
if (window['XMLHttpRequest']) {
|
12
|
-
xmlHttp = new XMLHttpRequest();
|
13
|
-
}
|
14
|
-
if (xmlHttp) {
|
15
|
-
xmlHttp.open('Get', url, false);
|
16
|
-
xmlHttp.send();
|
17
|
-
if (xmlHttp.status == 404) {
|
18
|
-
resolve(false);
|
19
|
-
}
|
20
|
-
else {
|
21
|
-
resolve(true);
|
22
|
-
}
|
23
|
-
}
|
24
|
-
else {
|
25
|
-
resolve(false);
|
26
|
-
}
|
27
|
-
});
|
28
|
-
}
|
1
|
+
export function setFavicon(path) {
|
2
|
+
const link = document.querySelector("link[rel*='icon']") || document.createElement('link');
|
3
|
+
link.type = 'image/x-icon';
|
4
|
+
link.rel = 'shortcut icon';
|
5
|
+
link.href = path;
|
6
|
+
document.getElementsByTagName('head')[0].appendChild(link);
|
7
|
+
}
|
8
|
+
export function hasFavicon(url) {
|
9
|
+
return new Promise(resolve => {
|
10
|
+
let xmlHttp;
|
11
|
+
if (window['XMLHttpRequest']) {
|
12
|
+
xmlHttp = new XMLHttpRequest();
|
13
|
+
}
|
14
|
+
if (xmlHttp) {
|
15
|
+
xmlHttp.open('Get', url, false);
|
16
|
+
xmlHttp.send();
|
17
|
+
if (xmlHttp.status == 404) {
|
18
|
+
resolve(false);
|
19
|
+
}
|
20
|
+
else {
|
21
|
+
resolve(true);
|
22
|
+
}
|
23
|
+
}
|
24
|
+
else {
|
25
|
+
resolve(false);
|
26
|
+
}
|
27
|
+
});
|
28
|
+
}
|
29
29
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmF2aWNvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL3V0aWwvb3RoZXIvZmF2aWNvbi50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxNQUFNLFVBQVUsVUFBVSxDQUFDLElBQVk7SUFDckMsTUFBTSxJQUFJLEdBQVEsUUFBUSxDQUFDLGFBQWEsQ0FBQyxtQkFBbUIsQ0FBQyxJQUFJLFFBQVEsQ0FBQyxhQUFhLENBQUMsTUFBTSxDQUFDLENBQUM7SUFDaEcsSUFBSSxDQUFDLElBQUksR0FBRyxjQUFjLENBQUM7SUFDM0IsSUFBSSxDQUFDLEdBQUcsR0FBRyxlQUFlLENBQUM7SUFDM0IsSUFBSSxDQUFDLElBQUksR0FBRyxJQUFJLENBQUM7SUFDakIsUUFBUSxDQUFDLG9CQUFvQixDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUMsQ0FBQyxDQUFDLFdBQVcsQ0FBQyxJQUFJLENBQUMsQ0FBQztBQUM3RCxDQUFDO0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GQobGluayk7XG59XG5cbmV4cG9ydCBmdW5jdGlvbiBoYXNGYXZpY29uKHVybDogc3RyaW5nKTogUHJvbWlzZTxib29sZWFuPiB7XG4gIHJldHVybiBuZXcgUHJvbWlzZShyZXNvbHZlID0+IHtcbiAgICBsZXQgeG1sSHR0cDtcbiAgICBpZiAod2luZG93WydYTUxIdHRwUmVxdWVzdCddKSB7XG4gICAgICB4bWxIdHRwID0gbmV3IFhNTEh0dHBSZXF1ZXN0KCk7XG4gICAgfVxuICAgIGlmICh4bWxIdHRwKSB7XG4gICAgICB4bWxIdHRwLm9wZW4oJ0dldCcsIHVybCwgZmFsc2UpO1xuICAgICAgeG1sSHR0cC5zZW5kKCk7XG4gICAgICBpZiAoeG1sSHR0cC5zdGF0dXMgPT0gNDA0KSB7XG4gICAgICAgIHJlc29sdmUoZmFsc2UpO1xuICAgICAgfSBlbHNlIHtcbiAgICAgICAgcmVzb2x2ZSh0cnVlKTtcbiAgICAgIH1cbiAgICB9IGVsc2Uge1xuICAgICAgcmVzb2x2ZShmYWxzZSk7XG4gICAgfVxuICB9KTtcbn1cbiJdfQ==
|
@@ -1,8 +1,8 @@
|
|
1
|
-
export * from './deep';
|
2
|
-
export * from './logger';
|
3
|
-
export * from './lazy.service';
|
4
|
-
export * from './assert';
|
5
|
-
export * from './resize';
|
6
|
-
export * from './path-to-regexp.service';
|
7
|
-
export * from './favicon';
|
1
|
+
export * from './deep';
|
2
|
+
export * from './logger';
|
3
|
+
export * from './lazy.service';
|
4
|
+
export * from './assert';
|
5
|
+
export * from './resize';
|
6
|
+
export * from './path-to-regexp.service';
|
7
|
+
export * from './favicon';
|
8
8
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL290aGVyL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsUUFBUSxDQUFDO0FBQ3ZCLGNBQWMsVUFBVSxDQUFDO0FBQ3pCLGNBQWMsZ0JBQWdCLENBQUM7QUFDL0IsY0FBYyxVQUFVLENBQUM7QUFDekIsY0FBYyxVQUFVLENBQUM7QUFDekIsY0FBYywwQkFBMEIsQ0FBQztBQUN6QyxjQUFjLFdBQVcsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJy4vZGVlcCc7XG5leHBvcnQgKiBmcm9tICcuL2xvZ2dlcic7XG5leHBvcnQgKiBmcm9tICcuL2xhenkuc2VydmljZSc7XG5leHBvcnQgKiBmcm9tICcuL2Fzc2VydCc7XG5leHBvcnQgKiBmcm9tICcuL3Jlc2l6ZSc7XG5leHBvcnQgKiBmcm9tICcuL3BhdGgtdG8tcmVnZXhwLnNlcnZpY2UnO1xuZXhwb3J0ICogZnJvbSAnLi9mYXZpY29uJztcbiJdfQ==
|
@@ -0,0 +1,133 @@
|
|
1
|
+
import { DOCUMENT } from '@angular/common';
|
2
|
+
import { Inject, Injectable } from '@angular/core';
|
3
|
+
import { BehaviorSubject, filter, share } from 'rxjs';
|
4
|
+
import * as i0 from "@angular/core";
|
5
|
+
/**
|
6
|
+
* `LazyService` delay loading JS or CSS files.
|
7
|
+
*
|
8
|
+
* 延迟加载资源(js 或 css)服务
|
9
|
+
*/
|
10
|
+
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
|
+
attachAttributes(el, attributes) {
|
25
|
+
if (attributes == null)
|
26
|
+
return;
|
27
|
+
Object.entries(attributes).forEach(([key, value]) => {
|
28
|
+
el.setAttribute(key, value);
|
29
|
+
});
|
30
|
+
}
|
31
|
+
/**
|
32
|
+
* Load script or style files
|
33
|
+
*/
|
34
|
+
load(paths) {
|
35
|
+
if (!Array.isArray(paths)) {
|
36
|
+
paths = [paths];
|
37
|
+
}
|
38
|
+
const promises = [];
|
39
|
+
paths
|
40
|
+
.map(v => (typeof v !== 'object' ? { path: v } : v))
|
41
|
+
.forEach(item => {
|
42
|
+
if (item.path.endsWith('.js')) {
|
43
|
+
promises.push(this.loadScript(item.path, item.options));
|
44
|
+
}
|
45
|
+
else {
|
46
|
+
promises.push(this.loadStyle(item.path, item.options));
|
47
|
+
}
|
48
|
+
});
|
49
|
+
return Promise.all(promises).then(res => {
|
50
|
+
this._notify.next(res);
|
51
|
+
return Promise.resolve(res);
|
52
|
+
});
|
53
|
+
}
|
54
|
+
loadScript(path, innerContent, attributes) {
|
55
|
+
const options = typeof innerContent === 'object'
|
56
|
+
? innerContent
|
57
|
+
: {
|
58
|
+
innerContent,
|
59
|
+
attributes
|
60
|
+
};
|
61
|
+
return new Promise(resolve => {
|
62
|
+
if (this.list[path] === true) {
|
63
|
+
resolve({ ...this.cached[path], status: 'loading' });
|
64
|
+
return;
|
65
|
+
}
|
66
|
+
this.list[path] = true;
|
67
|
+
const onSuccess = (item) => {
|
68
|
+
this.cached[path] = item;
|
69
|
+
resolve(item);
|
70
|
+
this._notify.next([item]);
|
71
|
+
};
|
72
|
+
const node = this.doc.createElement('script');
|
73
|
+
node.type = 'text/javascript';
|
74
|
+
node.src = path;
|
75
|
+
this.attachAttributes(node, options.attributes);
|
76
|
+
if (options.innerContent) {
|
77
|
+
node.innerHTML = options.innerContent;
|
78
|
+
}
|
79
|
+
node.onload = () => onSuccess({
|
80
|
+
path,
|
81
|
+
status: 'ok'
|
82
|
+
});
|
83
|
+
node.onerror = error => onSuccess({
|
84
|
+
path,
|
85
|
+
status: 'error',
|
86
|
+
error
|
87
|
+
});
|
88
|
+
this.doc.getElementsByTagName('head')[0].appendChild(node);
|
89
|
+
});
|
90
|
+
}
|
91
|
+
loadStyle(path, rel, innerContent, attributes) {
|
92
|
+
const options = typeof rel === 'object'
|
93
|
+
? rel
|
94
|
+
: {
|
95
|
+
rel,
|
96
|
+
innerContent,
|
97
|
+
attributes
|
98
|
+
};
|
99
|
+
return new Promise(resolve => {
|
100
|
+
if (this.list[path] === true) {
|
101
|
+
resolve(this.cached[path]);
|
102
|
+
return;
|
103
|
+
}
|
104
|
+
this.list[path] = true;
|
105
|
+
const node = this.doc.createElement('link');
|
106
|
+
node.rel = options.rel ?? 'stylesheet';
|
107
|
+
node.type = 'text/css';
|
108
|
+
node.href = path;
|
109
|
+
this.attachAttributes(node, options.attributes);
|
110
|
+
if (options.innerContent) {
|
111
|
+
node.innerHTML = options.innerContent;
|
112
|
+
}
|
113
|
+
this.doc.getElementsByTagName('head')[0].appendChild(node);
|
114
|
+
const item = {
|
115
|
+
path,
|
116
|
+
status: 'ok'
|
117
|
+
};
|
118
|
+
this.cached[path] = item;
|
119
|
+
resolve(item);
|
120
|
+
});
|
121
|
+
}
|
122
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.2", ngImport: i0, type: LazyService, deps: [{ token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
123
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.2", ngImport: i0, type: LazyService, providedIn: 'root' }); }
|
124
|
+
}
|
125
|
+
export { LazyService };
|
126
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.2", ngImport: i0, type: LazyService, decorators: [{
|
127
|
+
type: Injectable,
|
128
|
+
args: [{ providedIn: 'root' }]
|
129
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
130
|
+
type: Inject,
|
131
|
+
args: [DOCUMENT]
|
132
|
+
}] }]; } });
|
133
|
+
//# sourceMappingURL=data:application/json;base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IHtcbiAgICAgICAgcGF0aCxcbiAgICAgICAgc3RhdHVzOiAnb2snXG4gICAgICB9O1xuICAgICAgdGhpcy5jYWNoZWRbcGF0aF0gPSBpdGVtO1xuICAgICAgcmVzb2x2ZShpdGVtKTtcbiAgICB9KTtcbiAgfVxufVxuIl19
|
@@ -1,33 +1,33 @@
|
|
1
|
-
const record = {};
|
2
|
-
export const PREFIX = '[@YELON]:';
|
3
|
-
function notRecorded(...args) {
|
4
|
-
const asRecord = args.reduce((acc, c) => acc + c.toString(), '');
|
5
|
-
if (record[asRecord]) {
|
6
|
-
return false;
|
7
|
-
}
|
8
|
-
else {
|
9
|
-
record[asRecord] = true;
|
10
|
-
return true;
|
11
|
-
}
|
12
|
-
}
|
13
|
-
function consoleCommonBehavior(consoleFunc, ...args) {
|
14
|
-
if ((typeof ngDevMode === 'undefined' || ngDevMode) && notRecorded(...args)) {
|
15
|
-
consoleFunc(...args);
|
16
|
-
}
|
17
|
-
}
|
18
|
-
// Warning should only be printed in dev mode and only once.
|
19
|
-
export const warn = (...args) => consoleCommonBehavior((...arg) => console.warn(PREFIX, ...arg), ...args);
|
20
|
-
export const warnDeprecation = (...args) => {
|
21
|
-
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
22
|
-
return () => { };
|
23
|
-
}
|
24
|
-
const stack = new Error().stack;
|
25
|
-
return consoleCommonBehavior((...arg) => console.warn(PREFIX, 'deprecated:', ...arg, stack), ...args);
|
26
|
-
};
|
27
|
-
// Log should only be printed in dev mode.
|
28
|
-
export const log = (...args) => {
|
29
|
-
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
30
|
-
console.log(PREFIX, ...args);
|
31
|
-
}
|
32
|
-
};
|
1
|
+
const record = {};
|
2
|
+
export const PREFIX = '[@YELON]:';
|
3
|
+
function notRecorded(...args) {
|
4
|
+
const asRecord = args.reduce((acc, c) => acc + c.toString(), '');
|
5
|
+
if (record[asRecord]) {
|
6
|
+
return false;
|
7
|
+
}
|
8
|
+
else {
|
9
|
+
record[asRecord] = true;
|
10
|
+
return true;
|
11
|
+
}
|
12
|
+
}
|
13
|
+
function consoleCommonBehavior(consoleFunc, ...args) {
|
14
|
+
if ((typeof ngDevMode === 'undefined' || ngDevMode) && notRecorded(...args)) {
|
15
|
+
consoleFunc(...args);
|
16
|
+
}
|
17
|
+
}
|
18
|
+
// Warning should only be printed in dev mode and only once.
|
19
|
+
export const warn = (...args) => consoleCommonBehavior((...arg) => console.warn(PREFIX, ...arg), ...args);
|
20
|
+
export const warnDeprecation = (...args) => {
|
21
|
+
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
22
|
+
return () => { };
|
23
|
+
}
|
24
|
+
const stack = new Error().stack;
|
25
|
+
return consoleCommonBehavior((...arg) => console.warn(PREFIX, 'deprecated:', ...arg, stack), ...args);
|
26
|
+
};
|
27
|
+
// Log should only be printed in dev mode.
|
28
|
+
export const log = (...args) => {
|
29
|
+
if (typeof ngDevMode === 'undefined' || ngDevMode) {
|
30
|
+
console.log(PREFIX, ...args);
|
31
|
+
}
|
32
|
+
};
|
33
33
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9nZ2VyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvdXRpbC9vdGhlci9sb2dnZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBSUEsTUFBTSxNQUFNLEdBQTRCLEVBQUUsQ0FBQztBQUUzQyxNQUFNLENBQUMsTUFBTSxNQUFNLEdBQUcsV0FBVyxDQUFDO0FBRWxDLFNBQVMsV0FBVyxDQUFDLEdBQUcsSUFBaUI7SUFDdkMsTUFBTSxRQUFRLEdBQUcsSUFBSSxDQUFDLE1BQU0sQ0FBQyxDQUFDLEdBQUcsRUFBRSxDQUFDLEVBQUUsRUFBRSxDQUFDLEdBQUcsR0FBRyxDQUFDLENBQUMsUUFBUSxFQUFFLEVBQUUs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IHx8IG5nRGV2TW9kZSkge1xuICAgIGNvbnNvbGUubG9nKFBSRUZJWCwgLi4uYXJncyk7XG4gIH1cbn07XG4iXX0=
|
@@ -1,5 +1,5 @@
|
|
1
|
-
/**
|
2
|
-
* Generated bundle index. Do not edit.
|
3
|
-
*/
|
4
|
-
export * from './index';
|
1
|
+
/**
|
2
|
+
* Generated bundle index. Do not edit.
|
3
|
+
*/
|
4
|
+
export * from './index';
|
5
5
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3RoZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy91dGlsL290aGVyL290aGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxTQUFTLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vaW5kZXgnO1xuIl19
|