@kizmann/pico-js 0.4.15 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/pico-js.js +370 -2
- package/dist/pico-js.js.map +1 -1
- package/docs/index.html +12 -0
- package/docs/utility/any.md +427 -0
- package/package.json +2 -1
- package/src/utility/array.js +4 -0
- package/src/utility/number.js +1 -1
- package/tsconfig.json +14 -0
- package/types/index.d.ts +25 -0
- package/types/utility/any.d.ts +66 -0
- package/types/utility/array.d.ts +46 -0
- package/types/utility/now.d.ts +148 -0
- package/types/utility/number.d.ts +31 -0
- package/types/utility/object.d.ts +54 -0
- package/types/utility/string.d.ts +33 -0
- package/webservy.json +6 -0
@@ -0,0 +1,148 @@
|
|
1
|
+
// types/utility/now.d.ts
|
2
|
+
|
3
|
+
import { Num } from "./number";
|
4
|
+
import { Arr } from "./array";
|
5
|
+
import { Any } from "./any";
|
6
|
+
|
7
|
+
declare class Now {
|
8
|
+
initialDate : string | null;
|
9
|
+
moment : any;
|
10
|
+
|
11
|
+
constructor(date? : any, format? : string);
|
12
|
+
|
13
|
+
static make(date? : any, format? : string) : Now;
|
14
|
+
|
15
|
+
get() : any;
|
16
|
+
|
17
|
+
valid() : boolean;
|
18
|
+
|
19
|
+
clone() : Now;
|
20
|
+
|
21
|
+
code(format? : string) : number;
|
22
|
+
|
23
|
+
format(format? : string, force? : boolean) : string;
|
24
|
+
|
25
|
+
before(before? : any) : boolean;
|
26
|
+
|
27
|
+
beforeDate(before? : any) : boolean;
|
28
|
+
|
29
|
+
beforeTime(before? : any) : boolean;
|
30
|
+
|
31
|
+
after(after? : any) : boolean;
|
32
|
+
|
33
|
+
afterDate(after? : any) : boolean;
|
34
|
+
|
35
|
+
afterTime(after? : any) : boolean;
|
36
|
+
|
37
|
+
equal(equal? : any, format? : string) : boolean;
|
38
|
+
|
39
|
+
equalDate(equal? : any, format? : string) : boolean;
|
40
|
+
|
41
|
+
equalTime(equal? : any, format? : string) : boolean;
|
42
|
+
|
43
|
+
between(fromDate? : any, toDate? : any, format? : string) : boolean;
|
44
|
+
|
45
|
+
decade() : number;
|
46
|
+
|
47
|
+
prevDecade() : Now;
|
48
|
+
|
49
|
+
nextDecade() : Now;
|
50
|
+
|
51
|
+
addDecades(count? : number) : Now;
|
52
|
+
|
53
|
+
subDecades(count? : number) : Now;
|
54
|
+
|
55
|
+
year(year? : number | null) : number | Now;
|
56
|
+
|
57
|
+
prevYear() : Now;
|
58
|
+
|
59
|
+
nextYear() : Now;
|
60
|
+
|
61
|
+
addYears(count? : number) : Now;
|
62
|
+
|
63
|
+
subYears(count? : number) : Now;
|
64
|
+
|
65
|
+
month(month? : number | null) : number | Now;
|
66
|
+
|
67
|
+
addMonths(count? : number) : Now;
|
68
|
+
|
69
|
+
subMonths(count? : number) : Now;
|
70
|
+
|
71
|
+
prevMonth() : Now;
|
72
|
+
|
73
|
+
nextMonth() : Now;
|
74
|
+
|
75
|
+
date(date? : number | null) : number | Now;
|
76
|
+
|
77
|
+
addDates(count? : number) : Now;
|
78
|
+
|
79
|
+
subDates(count? : number) : Now;
|
80
|
+
|
81
|
+
prevDate() : Now;
|
82
|
+
|
83
|
+
nextDate() : Now;
|
84
|
+
|
85
|
+
lastDate() : number;
|
86
|
+
|
87
|
+
day(day? : number | null) : number | Now;
|
88
|
+
|
89
|
+
hour(hour? : number | null) : number | Now;
|
90
|
+
|
91
|
+
addHour(count? : number) : Now;
|
92
|
+
|
93
|
+
subHour(count? : number) : Now;
|
94
|
+
|
95
|
+
prevHour() : Now;
|
96
|
+
|
97
|
+
nextHour() : Now;
|
98
|
+
|
99
|
+
minute(minute? : number | null) : number | Now;
|
100
|
+
|
101
|
+
addMinute(count? : number) : Now;
|
102
|
+
|
103
|
+
subMinute(count? : number) : Now;
|
104
|
+
|
105
|
+
prevMinute() : Now;
|
106
|
+
|
107
|
+
nextMinute() : Now;
|
108
|
+
|
109
|
+
second(second? : number | null) : number | Now;
|
110
|
+
|
111
|
+
addSecond(count? : number) : Now;
|
112
|
+
|
113
|
+
subSecond(count? : number) : Now;
|
114
|
+
|
115
|
+
prevSecond() : Now;
|
116
|
+
|
117
|
+
nextSecond() : Now;
|
118
|
+
|
119
|
+
humanDay() : number;
|
120
|
+
|
121
|
+
humanMonth() : number;
|
122
|
+
|
123
|
+
getMonths() : Now[];
|
124
|
+
|
125
|
+
getYears() : Now[];
|
126
|
+
|
127
|
+
getYearsGrid(size? : number) : Now[];
|
128
|
+
|
129
|
+
getDates() : Now[];
|
130
|
+
|
131
|
+
getDatesRange(target? : any) : Now[];
|
132
|
+
|
133
|
+
getDatesGrid(start? : number, end? : number) : Now[];
|
134
|
+
|
135
|
+
getHours(interval? : number) : Now[];
|
136
|
+
|
137
|
+
getMinutes(interval? : number) : Now[];
|
138
|
+
|
139
|
+
getSeconds(interval? : number) : Now[];
|
140
|
+
|
141
|
+
resetTime() : Now;
|
142
|
+
|
143
|
+
applyDate(now : any, format? : string) : void;
|
144
|
+
|
145
|
+
applyTime(now : any, format? : string) : void;
|
146
|
+
}
|
147
|
+
|
148
|
+
export default Now;
|
@@ -0,0 +1,31 @@
|
|
1
|
+
// types/utility/number.d.ts
|
2
|
+
|
3
|
+
import { Any } from "./any";
|
4
|
+
import { Arr } from "./array";
|
5
|
+
import { Obj } from "./object";
|
6
|
+
|
7
|
+
declare class Num {
|
8
|
+
static int(num : any) : number;
|
9
|
+
|
10
|
+
static float(num : any) : number;
|
11
|
+
|
12
|
+
static ceil(num : number) : number;
|
13
|
+
|
14
|
+
static round(num : number) : number;
|
15
|
+
|
16
|
+
static floor(num : number) : number;
|
17
|
+
|
18
|
+
static fixed(num : number, fixed? : number) : string;
|
19
|
+
|
20
|
+
static random(start? : number, end? : number) : number;
|
21
|
+
|
22
|
+
static matrix(num : number, limit? : number, base? : number[]) : number[];
|
23
|
+
|
24
|
+
static combine(arr : number[]) : number;
|
25
|
+
|
26
|
+
static distance(cord1 : { lat : number; lng : number }, cord2 : { lat : number; lng : number }, miles? : boolean) : number;
|
27
|
+
|
28
|
+
static format(num : number | null, decimal? : string, thousand? : string, fixed? : number | null) : string | null;
|
29
|
+
}
|
30
|
+
|
31
|
+
export default Num;
|
@@ -0,0 +1,54 @@
|
|
1
|
+
// types/utility/object.d.ts
|
2
|
+
|
3
|
+
import { Arr } from "./array";
|
4
|
+
import { Any } from "./any";
|
5
|
+
|
6
|
+
declare class Obj {
|
7
|
+
static has(obj : any, keys : string | string[]) : boolean;
|
8
|
+
|
9
|
+
static empty(obj : any, key : string) : boolean;
|
10
|
+
|
11
|
+
static get(obj : any, keys : string | string[], fallback? : any) : any;
|
12
|
+
|
13
|
+
static set(obj : any, keys : string | string[], val : any) : any;
|
14
|
+
|
15
|
+
static unset(obj : any, keys : string | string[]) : any;
|
16
|
+
|
17
|
+
static pluck(obj : any, keys : string | string[], fallback? : any) : any;
|
18
|
+
|
19
|
+
static only(obj : any, keys : string[], assign? : any) : any;
|
20
|
+
|
21
|
+
static except(obj : any, keys : string[], assign? : any) : any;
|
22
|
+
|
23
|
+
static includes(obj : any, val : any) : boolean;
|
24
|
+
|
25
|
+
static matches(obj : any, val : any) : boolean;
|
26
|
+
|
27
|
+
static sort(obj : any, key : string | ((a : any, b : any) => number)) : any[];
|
28
|
+
|
29
|
+
static sortString(obj : any, key : string) : any[];
|
30
|
+
|
31
|
+
static filter(obj : any, filter : any) : any[];
|
32
|
+
|
33
|
+
static filterIndex(obj : any, filter : any) : string[];
|
34
|
+
|
35
|
+
static find(arr : any[], obj : any, fallback? : any) : any;
|
36
|
+
|
37
|
+
static findIndex(arr : any[], obj : any, fallback? : number) : number;
|
38
|
+
|
39
|
+
static clone(obj : any) : any;
|
40
|
+
|
41
|
+
static assign(...args : any[]) : any;
|
42
|
+
|
43
|
+
static remove(obj : any, keys : string[]) : any;
|
44
|
+
|
45
|
+
static each(obj : any, callback : (value : any, key : string) => void) : any;
|
46
|
+
|
47
|
+
static map(obj : any, callback : (value : any, key : string) => any) : any;
|
48
|
+
|
49
|
+
static values(obj : any) : any[];
|
50
|
+
|
51
|
+
static flatten(obj : any) : any;
|
52
|
+
}
|
53
|
+
|
54
|
+
export default Obj;
|
@@ -0,0 +1,33 @@
|
|
1
|
+
// types/utility/string.d.ts
|
2
|
+
|
3
|
+
declare module "@kizmann/pico-js/src/utility/string" {
|
4
|
+
import { Arr } from "@kizmann/pico-js/src/utility/array";
|
5
|
+
import { Obj } from "@kizmann/pico-js/src/utility/object";
|
6
|
+
import { Num } from "@kizmann/pico-js/src/utility/number";
|
7
|
+
import { Any } from "@kizmann/pico-js/src/utility/any";
|
8
|
+
|
9
|
+
export class Str {
|
10
|
+
static regexEscape(val: string): string;
|
11
|
+
static upper(val: string): string;
|
12
|
+
static lower(val: string): string;
|
13
|
+
static camelcase(val: string): string;
|
14
|
+
static humancase(val: string): string;
|
15
|
+
static slugify(val: string): string;
|
16
|
+
static ucfirst(val: string): string;
|
17
|
+
static lcfirst(val: string): string;
|
18
|
+
static has(val: string, search: string): boolean;
|
19
|
+
static filesize(val: number, decimals?: number): string | null;
|
20
|
+
static array(value: string, fallback?: any[]): any[];
|
21
|
+
static real(value: string): any;
|
22
|
+
static objectify(value: any, mode?: 'options' | 'params', isArray?: boolean): any;
|
23
|
+
static stringify(value: any, mode?: 'options' | 'params'): string;
|
24
|
+
static options(params: any, quota?: string | null): string;
|
25
|
+
static fromOptions(value: string, isArray?: boolean): any;
|
26
|
+
private static convertFromOptions(result: any, match: string): any;
|
27
|
+
static params(params: any, quota?: string | null): string;
|
28
|
+
static fromParams(value: string, isArray?: boolean): any;
|
29
|
+
private static convertFromParams(result: any, match: string): any;
|
30
|
+
}
|
31
|
+
|
32
|
+
export default Str;
|
33
|
+
}
|