Skip to content

Commit 0fb75d6

Browse files
committed
feat(str): add new implementation
1 parent 25a41ac commit 0fb75d6

File tree

2 files changed

+121
-8
lines changed

2 files changed

+121
-8
lines changed

lib/str/string.interface.ts

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
11
export interface IString {
22
after(): this;
3-
camel(): this;
3+
camel(value: string): this;
44
finish(): this;
55
is(): this;
66
slug(): this;
77
startWith(): this;
8-
upper(): this;
8+
upper(value: string): this;
9+
capitalize(value: string): this;
910
snake(): this;
1011
studly(): this;
1112
words(): this;
1213
title(): this;
1314
singular(): this;
14-
plural(): this;
15+
plural(value: string, count: number): this;
1516
start(): this;
17+
random(length: number): this;
1618
end(): this;
1719
endWith(): this;
1820
contains(): this;
1921
before(): this;
2022
lower(value: string): this;
21-
length(value: string, encoding: string): this;
23+
l(value: string, encoding: string): this;
2224
kebab(value: string): this;
23-
limit(value: string, limit?: number, end?: string): this;
25+
limit(value: string, limit: number, end: string): this;
2426
replaceFirst(): this;
2527
replaceLast(): this;
26-
ucFirst(): this;
28+
ucFirst(value: string): this;
2729
}

lib/str/string.ts

+113-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,114 @@
1-
export class Str extends String {
2-
//
1+
import { IString } from './string.interface';
2+
3+
export class Str extends String implements IString {
4+
after(): this {
5+
return this;
6+
}
7+
8+
before(): this {
9+
return this;
10+
}
11+
12+
camel(value: string): this {
13+
return this;
14+
}
15+
16+
capitalize(value: string): this {
17+
return this;
18+
}
19+
20+
contains(): this {
21+
return this;
22+
}
23+
24+
end(): this {
25+
return this;
26+
}
27+
28+
endWith(): this {
29+
return this;
30+
}
31+
32+
finish(): this {
33+
return this;
34+
}
35+
36+
is(): this {
37+
return this;
38+
}
39+
40+
kebab(value: string): this {
41+
return this;
42+
}
43+
44+
limit(value: string, limit = 100, end = '...'): this {
45+
return this;
46+
}
47+
48+
lower(value: string): this {
49+
value;
50+
return this;
51+
}
52+
53+
plural(value: string, count: number): this {
54+
return this;
55+
}
56+
57+
random(length = 16): this {
58+
return this;
59+
}
60+
61+
replaceFirst(): this {
62+
return this;
63+
}
64+
65+
replaceLast(): this {
66+
return this;
67+
}
68+
69+
singular(): this {
70+
return this;
71+
}
72+
73+
slug(): this {
74+
return this;
75+
}
76+
77+
snake(): this {
78+
return this;
79+
}
80+
81+
start(): this {
82+
return this;
83+
}
84+
85+
startWith(): this {
86+
return this;
87+
}
88+
89+
studly(): this {
90+
return this;
91+
}
92+
93+
title(): this {
94+
return this;
95+
}
96+
97+
ucFirst(value: string): this {
98+
return this;
99+
}
100+
101+
upper(value: string): this {
102+
value.toUpperCase();
103+
104+
return this;
105+
}
106+
107+
words(): this {
108+
return this;
109+
}
110+
111+
l(value: string, encoding: string): this {
112+
return this;
113+
}
3114
}

0 commit comments

Comments
 (0)