mol_time_all 1.1.12 → 1.1.13

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/.nojekyll ADDED
File without changes
package/README.md ADDED
@@ -0,0 +1,45 @@
1
+ # $mol_time
2
+
3
+ Small, simple, powerfull, and fast TypeScript/JavaScript library for proper date/time/duration/interval arithmetic.
4
+
5
+ # Installation
6
+
7
+ ## Direct
8
+
9
+ ```html
10
+ <script src="https://unpkg.com/mol_time_all/web.js"></script>
11
+ <script>
12
+ alert( new $mol_time_moment() ) // alerts current time
13
+ </script>
14
+ ```
15
+
16
+ ## NPM
17
+
18
+ ```sh
19
+ npm install mol_time_all
20
+ ```
21
+
22
+ ### JavaScript
23
+
24
+ ```js
25
+ const Moment = require( 'mol_time_all' ).$mol_time_moment
26
+ console.log( new Moment().toString() ) // logs current time
27
+ ```
28
+
29
+ ### TypeScript
30
+
31
+ ```js
32
+ import { $mol_time_moment as Moment } from 'mol_time_all'
33
+ console.log( new Moment().toString() ) // logs current time
34
+ ```
35
+
36
+ # API
37
+
38
+ - [$mol_time_moment](moment)
39
+ - [$mol_time_duration](duration)
40
+ - [$mol_time_interval](interval)
41
+
42
+ # Articles
43
+
44
+ - [$mol_time — работаем с датами и временем правильно](https://habhub.hyoo.ru/#!author=nin-jin/repo=HabHub/article=28)
45
+ - [JavaScript нанобенчмарки и преждевременные тормоза](https://habhub.hyoo.ru/#!author=nin-jin/repo=HabHub/article=42)
package/node.d.ts CHANGED
@@ -1,140 +1,155 @@
1
- declare let _$_: {
2
- new (): {};
3
- } & typeof globalThis;
4
- declare class $ extends _$_ {
5
- }
6
- declare namespace $ {
7
- export type $ = typeof $$;
8
- export class $$ extends $ {
9
- }
10
- namespace $$ {
11
- type $$ = $;
12
- }
13
- export {};
14
- }
1
+ declare let _$_: {
2
+ new (): {};
3
+ } & typeof globalThis;
4
+ declare class $ extends _$_ {
5
+ }
6
+ declare namespace $ {
7
+ export type $ = typeof $$;
8
+ export class $$ extends $ {
9
+ }
10
+ namespace $$ {
11
+ type $$ = $;
12
+ }
13
+ export {};
14
+ }
15
15
 
16
- declare namespace $ {
17
- class $mol_time_base {
18
- static patterns: Record<string, (arg: any) => string>;
19
- static formatter(pattern: string): (arg: any) => string;
20
- toString(pattern: string): string;
21
- }
22
- }
16
+ declare namespace $ {
17
+ class $mol_time_base {
18
+ static patterns: Record<string, (arg: any) => string>;
19
+ static formatter(pattern: string): (arg: any) => string;
20
+ toString(pattern: string): string;
21
+ }
22
+ }
23
23
 
24
- declare namespace $ {
25
- type $mol_time_duration_config = number | string | {
26
- year?: number;
27
- month?: number;
28
- day?: number;
29
- hour?: number;
30
- minute?: number;
31
- second?: number;
32
- };
33
- class $mol_time_duration extends $mol_time_base {
34
- constructor(config?: $mol_time_duration_config);
35
- readonly year: number;
36
- readonly month: number;
37
- readonly day: number;
38
- readonly hour: number;
39
- readonly minute: number;
40
- readonly second: number;
41
- summ(config: $mol_time_duration_config): $mol_time_duration;
42
- mult(numb: number): $mol_time_duration;
43
- count(config: $mol_time_duration_config): number;
44
- valueOf(): number;
45
- toJSON(): string;
46
- toString(pattern?: string): string;
47
- static patterns: {
48
- '#Y': (duration: $mol_time_duration) => string;
49
- '#M': (duration: $mol_time_duration) => string;
50
- '#D': (duration: $mol_time_duration) => string;
51
- '#h': (duration: $mol_time_duration) => string;
52
- '#m': (duration: $mol_time_duration) => string;
53
- '#s': (duration: $mol_time_duration) => string;
54
- };
55
- }
56
- }
24
+ declare namespace $ {
25
+ type $mol_time_duration_config = number | string | {
26
+ year?: number;
27
+ month?: number;
28
+ day?: number;
29
+ hour?: number;
30
+ minute?: number;
31
+ second?: number;
32
+ };
33
+ class $mol_time_duration extends $mol_time_base {
34
+ constructor(config?: $mol_time_duration_config);
35
+ readonly year: number;
36
+ readonly month: number;
37
+ readonly day: number;
38
+ readonly hour: number;
39
+ readonly minute: number;
40
+ readonly second: number;
41
+ summ(config: $mol_time_duration_config): $mol_time_duration;
42
+ mult(numb: number): $mol_time_duration;
43
+ count(config: $mol_time_duration_config): number;
44
+ valueOf(): number;
45
+ toJSON(): string;
46
+ toString(pattern?: string): string;
47
+ static patterns: {
48
+ '#Y': (duration: $mol_time_duration) => string;
49
+ '#M': (duration: $mol_time_duration) => string;
50
+ '#D': (duration: $mol_time_duration) => string;
51
+ '#h': (duration: $mol_time_duration) => string;
52
+ '#m': (duration: $mol_time_duration) => string;
53
+ '#s': (duration: $mol_time_duration) => string;
54
+ };
55
+ }
56
+ }
57
57
 
58
- declare namespace $ {
59
- type $mol_time_moment_config = number | Date | string | {
60
- year?: number;
61
- month?: number;
62
- day?: number;
63
- hour?: number;
64
- minute?: number;
65
- second?: number;
66
- offset?: $mol_time_duration_config;
67
- };
68
- class $mol_time_moment extends $mol_time_base {
69
- constructor(config?: $mol_time_moment_config);
70
- readonly year: number | undefined;
71
- readonly month: number | undefined;
72
- readonly day: number | undefined;
73
- readonly hour: number | undefined;
74
- readonly minute: number | undefined;
75
- readonly second: number | undefined;
76
- readonly offset: $mol_time_duration | undefined;
77
- get weekday(): number;
78
- _native: Date | undefined;
79
- get native(): Date;
80
- _normal: $mol_time_moment | undefined;
81
- get normal(): $mol_time_moment;
82
- merge(config: $mol_time_moment_config): $mol_time_moment;
83
- shift(config: $mol_time_duration_config): $mol_time_moment;
84
- mask(config: $mol_time_moment_config): $mol_time_moment;
85
- toOffset(config: $mol_time_duration_config): $mol_time_moment;
86
- valueOf(): number;
87
- toJSON(): string;
88
- toString(pattern?: string): string;
89
- static patterns: {
90
- YYYY: (moment: $mol_time_moment) => string;
91
- AD: (moment: $mol_time_moment) => string;
92
- YY: (moment: $mol_time_moment) => string;
93
- Month: (moment: $mol_time_moment) => string;
94
- 'DD Month': (moment: $mol_time_moment) => string;
95
- 'D Month': (moment: $mol_time_moment) => string;
96
- Mon: (moment: $mol_time_moment) => string;
97
- 'DD Mon': (moment: $mol_time_moment) => string;
98
- 'D Mon': (moment: $mol_time_moment) => string;
99
- '-MM': (moment: $mol_time_moment) => string;
100
- MM: (moment: $mol_time_moment) => string;
101
- M: (moment: $mol_time_moment) => string;
102
- WeekDay: (moment: $mol_time_moment) => string;
103
- WD: (moment: $mol_time_moment) => string;
104
- '-DD': (moment: $mol_time_moment) => string;
105
- DD: (moment: $mol_time_moment) => string;
106
- D: (moment: $mol_time_moment) => string;
107
- Thh: (moment: $mol_time_moment) => string;
108
- hh: (moment: $mol_time_moment) => string;
109
- h: (moment: $mol_time_moment) => string;
110
- ':mm': (moment: $mol_time_moment) => string;
111
- mm: (moment: $mol_time_moment) => string;
112
- m: (moment: $mol_time_moment) => string;
113
- ':ss': (moment: $mol_time_moment) => string;
114
- ss: (moment: $mol_time_moment) => string;
115
- s: (moment: $mol_time_moment) => string;
116
- '.sss': (moment: $mol_time_moment) => string;
117
- sss: (moment: $mol_time_moment) => string;
118
- Z: (moment: $mol_time_moment) => string;
119
- };
120
- }
121
- }
58
+ declare namespace $ {
59
+ function $mol_fail(error: any): never;
60
+ }
122
61
 
123
- declare namespace $ {
124
- type $mol_time_interval_config = string | {
125
- start?: $mol_time_moment_config;
126
- end?: $mol_time_moment_config;
127
- duration?: $mol_time_duration_config;
128
- };
129
- class $mol_time_interval extends $mol_time_base {
130
- constructor(config: $mol_time_interval_config);
131
- private _start;
132
- get start(): $mol_time_moment;
133
- private _end;
134
- get end(): $mol_time_moment;
135
- private _duration;
136
- get duration(): $mol_time_duration;
137
- toJSON(): string;
138
- toString(): string;
139
- }
140
- }
62
+ declare namespace $ {
63
+ enum $mol_time_moment_weekdays {
64
+ monday = 0,
65
+ tuesday = 1,
66
+ wednesday = 2,
67
+ thursday = 3,
68
+ friday = 4,
69
+ saturday = 5,
70
+ sunday = 6
71
+ }
72
+ type $mol_time_moment_config = number | Date | string | {
73
+ year?: number;
74
+ month?: number;
75
+ day?: number;
76
+ hour?: number;
77
+ minute?: number;
78
+ second?: number;
79
+ offset?: $mol_time_duration_config;
80
+ };
81
+ class $mol_time_moment extends $mol_time_base {
82
+ constructor(config?: $mol_time_moment_config);
83
+ readonly year: number | undefined;
84
+ readonly month: number | undefined;
85
+ readonly day: number | undefined;
86
+ readonly hour: number | undefined;
87
+ readonly minute: number | undefined;
88
+ readonly second: number | undefined;
89
+ readonly offset: $mol_time_duration | undefined;
90
+ get weekday(): number;
91
+ _native: Date | undefined;
92
+ get native(): Date;
93
+ _normal: $mol_time_moment | undefined;
94
+ get normal(): $mol_time_moment;
95
+ merge(config: $mol_time_moment_config): $mol_time_moment;
96
+ shift(config: $mol_time_duration_config): $mol_time_moment;
97
+ mask(config: $mol_time_moment_config): $mol_time_moment;
98
+ toOffset(config: $mol_time_duration_config): $mol_time_moment;
99
+ valueOf(): number;
100
+ toJSON(): string;
101
+ toString(pattern?: string): string;
102
+ static patterns: {
103
+ YYYY: (moment: $mol_time_moment) => string;
104
+ AD: (moment: $mol_time_moment) => string;
105
+ YY: (moment: $mol_time_moment) => string;
106
+ Month: (moment: $mol_time_moment) => string;
107
+ 'DD Month': (moment: $mol_time_moment) => string;
108
+ 'D Month': (moment: $mol_time_moment) => string;
109
+ Mon: (moment: $mol_time_moment) => string;
110
+ 'DD Mon': (moment: $mol_time_moment) => string;
111
+ 'D Mon': (moment: $mol_time_moment) => string;
112
+ '-MM': (moment: $mol_time_moment) => string;
113
+ MM: (moment: $mol_time_moment) => string;
114
+ M: (moment: $mol_time_moment) => string;
115
+ WeekDay: (moment: $mol_time_moment) => string;
116
+ WD: (moment: $mol_time_moment) => string;
117
+ '-DD': (moment: $mol_time_moment) => string;
118
+ DD: (moment: $mol_time_moment) => string;
119
+ D: (moment: $mol_time_moment) => string;
120
+ Thh: (moment: $mol_time_moment) => string;
121
+ hh: (moment: $mol_time_moment) => string;
122
+ h: (moment: $mol_time_moment) => string;
123
+ ':mm': (moment: $mol_time_moment) => string;
124
+ mm: (moment: $mol_time_moment) => string;
125
+ m: (moment: $mol_time_moment) => string;
126
+ ':ss': (moment: $mol_time_moment) => string;
127
+ ss: (moment: $mol_time_moment) => string;
128
+ s: (moment: $mol_time_moment) => string;
129
+ '.sss': (moment: $mol_time_moment) => string;
130
+ sss: (moment: $mol_time_moment) => string;
131
+ Z: (moment: $mol_time_moment) => string;
132
+ };
133
+ }
134
+ }
135
+
136
+ declare namespace $ {
137
+ type $mol_time_interval_config = string | {
138
+ start?: $mol_time_moment_config;
139
+ end?: $mol_time_moment_config;
140
+ duration?: $mol_time_duration_config;
141
+ };
142
+ class $mol_time_interval extends $mol_time_base {
143
+ constructor(config: $mol_time_interval_config);
144
+ private _start;
145
+ get start(): $mol_time_moment;
146
+ private _end;
147
+ get end(): $mol_time_moment;
148
+ private _duration;
149
+ get duration(): $mol_time_duration;
150
+ toJSON(): string;
151
+ toString(): string;
152
+ }
153
+ }
154
+
155
+ export = $;
package/node.deps.json CHANGED
@@ -1 +1 @@
1
- {"files":["mol/CNAME","mol/CODE_OF_CONDUCT.md","mol/CONTRIBUTING.md","mol/index.html","mol/LICENSE","mol/mol.jam.js","mol/mol.meta.tree","mol/mol.ts","mol/readme.md","mol/time/readme.md","mol/time/base/base.ts","mol/time/duration/duration.ts","mol/time/duration/readme.md","mol/time/moment/moment.ts","mol/time/moment/readme.md","mol/time/interval/interval.ts","mol/time/interval/readme.md","mol/time/all/all.meta.tree","mol/time/all/package.json"],"mods":{},"deps_in":{"mol/time":{"mol/time/all":-9007199254740991,"mol/time/moment":-9007199254740991,"mol/time/duration":-9007199254740991,"mol/time/base":-9007199254740991,"mol/time/interval":-9007199254740991},"mol":{"mol/time":-9007199254740991},"mol/time/moment":{"mol/time/all":-9000,"mol/time/interval":-2},"mol/time/duration":{"mol/time/moment":-2,"mol/time/all":-9000,"mol/time/interval":-2},"mol/time/base":{"mol/time/duration":-1,"mol/time/moment":-1,"mol/time/interval":-1},"mol/time/interval":{"mol/time/all":-9000}},"deps_out":{"mol/time/all":{"mol/time":-9007199254740991,"mol/time/moment":-9000,"mol/time/duration":-9000,"mol/time/interval":-9000},"mol/time":{"mol":-9007199254740991},"mol/time/moment":{"mol/time":-9007199254740991,"mol/time/duration":-2,"mol/time/base":-1},"mol/time/duration":{"mol/time":-9007199254740991,"mol/time/base":-1},"mol/time/base":{"mol/time":-9007199254740991},"mol/time/interval":{"mol/time":-9007199254740991,"mol/time/moment":-2,"mol/time/duration":-2,"mol/time/base":-1}},"sloc":{"CNAME":1,"md":615,"html":1,"LICENSE":17,"js":11,"tree":4,"ts":560,"json":3},"deps":{"mol/time/all":{"..":-9007199254740991,"/mol/time/moment":-9000,"/mol/time/duration":-9000,"/mol/time/interval":-9000},"mol/time":{"..":-9007199254740991},"mol":{"..":-9007199254740991,"/mol":0},"mol/time/moment":{"..":-9007199254740991,"/mol/time/moment/config":-1,"/mol/time/duration/config":-2,"/mol/time/moment":-1,"/mol/time/base":-1,"/mol/time/duration":-2,"/mol/time/moment/patterns":-4},"mol/time/duration":{"..":-9007199254740991,"/mol/time/duration/config":-1,"/mol/time/duration":-1,"/mol/time/base":-1},"mol/time/base":{"..":-9007199254740991,"/mol/time/base":-1},"mol/time/interval":{"..":-9007199254740991,"/mol/time/interval/config":-1,"/mol/time/moment/config":-2,"/mol/time/duration/config":-2,"/mol/time/interval":-1,"/mol/time/base":-1,"/mol/time/duration":-2,"/mol/time/moment":-2}}}
1
+ {"files":["LICENSE","README.md","lang.lang.tree","mam.jam.js","mam.ts","package.json","sandbox.config.json","tsconfig.json","tsfmt.json","yarn.lock","mol/CNAME","mol/CODE_OF_CONDUCT.md","mol/CONTRIBUTING.md","mol/LICENSE","mol/index.html","mol/mol.meta.tree","mol/readme.md","mol/time/readme.md","mol/time/base/base.ts","mol/time/duration/duration.ts","mol/time/duration/readme.md","mol/fail/fail.ts","mol/time/moment/moment.ts","mol/time/moment/readme.md","mol/time/interval/interval.ts","mol/time/interval/readme.md","mol/time/all/all.meta.tree","mol/time/all/package.json"],"mods":{},"deps_in":{"mol/time":{"mol/time/all":-9007199254740991,"mol/time/moment":-9007199254740991,"mol/time/duration":-9007199254740991,"mol/time/base":-9007199254740991,"mol/time/interval":-9007199254740991},"mol":{"mol/time":-9007199254740991,"mol/fail":-9007199254740991},"":{"mol":-9007199254740991},"mol/time/moment":{"mol/time/all":-9000,"mol/time/interval":-2},"mol/time/duration":{"mol/time/moment":-2,"mol/time/all":-9000,"mol/time/interval":-2},"mol/time/base":{"mol/time/duration":-1,"mol/time/moment":-1,"mol/time/interval":-1},"mol/fail":{"mol/time/moment":-2},"mol/time/interval":{"mol/time/all":-9000}},"deps_out":{"mol/time/all":{"mol/time":-9007199254740991,"mol/time/moment":-9000,"mol/time/duration":-9000,"mol/time/interval":-9000},"mol/time":{"mol":-9007199254740991},"mol":{"":-9007199254740991},"mol/time/moment":{"mol/time":-9007199254740991,"mol/time/duration":-2,"mol/fail":-2,"mol/time/base":-1},"mol/time/duration":{"mol/time":-9007199254740991,"mol/time/base":-1},"mol/time/base":{"mol/time":-9007199254740991},"mol/fail":{"mol":-9007199254740991},"mol/time/interval":{"mol/time":-9007199254740991,"mol/time/moment":-2,"mol/time/duration":-2,"mol/time/base":-1}},"sloc":{"LICENSE":113,"md":712,"tree":34,"js":10,"ts":577,"json":89,"lock":933,"CNAME":1,"html":1},"deps":{"mol/time/all":{"..":-9007199254740991,"/mol/time/moment":-9000,"/mol/time/duration":-9000,"/mol/time/interval":-9000},"mol/time":{"..":-9007199254740991},"mol":{"..":-9007199254740991},"":{},"mol/time/moment":{"..":-9007199254740991,"/mol/time/moment/weekdays":-1,"/mol/time/moment/config":-1,"/mol/time/duration/config":-2,"/mol/fail":-2,"/mol/time/moment":-1,"/mol/time/base":-1,"/mol/time/duration":-2,"/mol/time/moment/patterns":-4},"mol/time/duration":{"..":-9007199254740991,"/mol/time/duration/config":-1,"/mol/time/duration":-1,"/mol/time/base":-1},"mol/time/base":{"..":-9007199254740991,"/mol/time/base":-1},"mol/fail":{"..":-9007199254740991,"/mol/fail":-1},"mol/time/interval":{"..":-9007199254740991,"/mol/time/interval/config":-1,"/mol/time/moment/config":-2,"/mol/time/duration/config":-2,"/mol/time/interval":-1,"/mol/time/base":-1,"/mol/time/duration":-2,"/mol/time/moment":-2}}}