@naturalcycles/js-lib 14.155.1 → 14.157.0
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/datetime/dateInterval.d.ts +3 -3
- package/dist/datetime/localDate.d.ts +18 -18
- package/dist/datetime/localTime.d.ts +21 -21
- package/dist/datetime/timeInterval.d.ts +3 -3
- package/dist/form.util.d.ts +9 -0
- package/dist/form.util.js +19 -0
- package/dist/http/fetcher.d.ts +1 -0
- package/dist/http/fetcher.js +38 -15
- package/dist/http/fetcher.model.d.ts +21 -6
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist-esm/form.util.js +14 -0
- package/dist-esm/http/fetcher.js +36 -15
- package/dist-esm/index.js +1 -0
- package/package.json +1 -2
- package/src/datetime/dateInterval.ts +3 -3
- package/src/datetime/localDate.ts +19 -19
- package/src/datetime/localTime.ts +21 -21
- package/src/datetime/timeInterval.ts +3 -3
- package/src/form.util.ts +17 -0
- package/src/http/fetcher.model.ts +30 -6
- package/src/http/fetcher.ts +46 -21
- package/src/index.ts +1 -0
- package/src/__exclude/lazyLocalDate.ts +0 -73
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { LocalDateUnit, LocalDate, LocalDateConfig } from '../datetime/localDate'
|
|
2
|
-
|
|
3
|
-
export class LazyLocalDate {
|
|
4
|
-
constructor(private str: string) {}
|
|
5
|
-
|
|
6
|
-
private ld?: LocalDate
|
|
7
|
-
|
|
8
|
-
eq(d: LocalDateConfig): boolean {
|
|
9
|
-
if (typeof d === 'string') return d === this.str
|
|
10
|
-
this.ld ||= LocalDate.of(this.str)
|
|
11
|
-
return this.ld.isSame(d)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
lt(d: LocalDateConfig): boolean {
|
|
15
|
-
return this.cmp(d) === -1
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
lte(d: LocalDateConfig): boolean {
|
|
19
|
-
return this.cmp(d) <= 0
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
gt(d: LocalDateConfig): boolean {
|
|
23
|
-
return this.cmp(d) === 1
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
gte(d: LocalDateConfig): boolean {
|
|
27
|
-
return this.cmp(d) >= 0
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
cmp(d: LocalDateConfig): -1 | 0 | 1 {
|
|
31
|
-
if (typeof d === 'string') {
|
|
32
|
-
return this.str < d ? -1 : this.str > d ? 1 : 0
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
this.ld ||= LocalDate.of(this.str)
|
|
36
|
-
return this.ld.cmp(d)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
absDiff(d: LocalDateConfig, unit: LocalDateUnit): number {
|
|
40
|
-
return Math.abs(this.diff(d, unit))
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
diff(d: LocalDateConfig, unit: LocalDateUnit): number {
|
|
44
|
-
this.ld ||= LocalDate.of(this.str)
|
|
45
|
-
return this.ld.diff(d, unit)
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
add(num: number, unit: LocalDateUnit): LocalDate {
|
|
49
|
-
this.ld ||= LocalDate.of(this.str)
|
|
50
|
-
return this.ld.add(num, unit)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
subtract(num: number, unit: LocalDateUnit): LocalDate {
|
|
54
|
-
return this.add(-num, unit)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
clone(): LazyLocalDate {
|
|
58
|
-
return new LazyLocalDate(this.str)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
toDate(): Date {
|
|
62
|
-
this.ld ||= LocalDate.of(this.str)
|
|
63
|
-
return this.ld.toDate()
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
toString(): string {
|
|
67
|
-
return this.str
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
toJSON(): string {
|
|
71
|
-
return this.str
|
|
72
|
-
}
|
|
73
|
-
}
|