@@ -9,6 +9,7 @@ A lightweight and versatile String Utility Package for Node.js & Browser.
99<img src =" https://user-images.githubusercontent.com/6517308/121813242-859a9700-cc6b-11eb-99c0-49e5bb63005b.jpg " >
1010
1111# Contents
12+
1213* [ Install] ( #install )
1314* [ require] ( #require )
1415* [ import] ( #import )
@@ -37,14 +38,11 @@ A lightweight and versatile String Utility Package for Node.js & Browser.
3738 * [ isAlpha] ( #isalpha )
3839 * [ isAlphaNumeric] ( #isalphanumeric )
3940 * [ reverse] ( #reverse )
40-
41- (Coming Soon)
42- * [ StringBuilder] ( # )
43- * [ StringValidator] ( # )
4441 * [ Build] ( #build )
4542 * [ License] ( #license )
4643
47- ## install
44+ ## Install
45+
4846``` sh
4947npm install @full-pack/string-pack
5048```
@@ -61,13 +59,16 @@ const { ... } = require('@full-pack/string-pack');
6159import { ... } from ' @full-pack/string-pack' ;
6260```
6361
64- ## API
62+ ## APIs
63+
64+ ### Padding
6565
66- ### padding
6766Adds padding to given string.
6867
6968##### padStart
69+
7070Pads the start of a string with a specified fill string a certain number of times.
71+
7172``` js
7273// Basic Usage
7374padStart (' hello' , ' abc' , 3 ) // abcabcabchello
@@ -77,7 +78,9 @@ padStart('hello', 'abc', 3, 8) // abchello
7778```
7879
7980##### padEnd
81+
8082Pads the end of a string with a specified fill string a certain number of times.
83+
8184``` js
8285// Basic Usage
8386padEnd (' hello' , ' abc' , 3 ); // helloabcabcabc
@@ -87,20 +90,25 @@ padEnd('hello', 'abc', 3, 8); // helloabc
8790```
8891
8992##### padBidirectional
93+
9094Pads a string with a specified fill string a certain number of times on both ends.
95+
9196``` js
9297// Basic usage
93- padBidirectional (' hello' , ' *' , 2 ); // '**hello**'
98+ padBidirectional (' hello' , ' *' , {repeatCount : 2 } ); // '**hello**'
9499
95100// Limiting total length
96- padBidirectional (' world' , ' -' , 3 , 10 ); // '--world---'
101+ padBidirectional (' world' , ' -' , {repeatCount : 3 , maxLen : 10 } ); // '--world---'
97102
98103// Controlling padding distribution
99- padBidirectional (' example' , ' *' , 2 , 10 , 0 ); // '**example*'
104+ padBidirectional (' example' , ' *' , {repeatCount: 2 , maxLen: 10 , bias: PaddingBias .START });
105+ // '**example*'
100106```
101107
102108### merge
109+
103110Merges an array of strings into a single string using a specified separator.
111+
104112``` js
105113merge (' -' , ' apple' , ' orange' , ' banana' ); // 'apple-orange-banana'
106114
@@ -110,31 +118,39 @@ merge(false, 'apple', 'orange', 'banana'); // 'appleorangebanana'
110118```
111119
112120### compare
121+
113122Performs a strict comparison between two strings.
123+
114124``` js
115125compare (" hello" , " hello" ); // true
116126
117127compare (" abc" , " ABC" ); // false
118128```
119129
120130### looseCompare
131+
121132Performs a case-insensitive loose comparison between two strings.
133+
122134``` js
123135looseCompare (" hello" , " HELLO" ); // true
124136
125137looseCompare (' abc' , ' 123' ); // false
126138```
127139
128140### capitalizeInitial
141+
129142Capitalizes the first letter of a word in a string.
143+
130144``` js
131145capitalizeInitial (' hello' ); // 'Hello'
132146
133147capitalizeInitial (' :> hello' ); // ':> Hello'
134148```
135149
136150### capitalizeWords
151+
137152Capitalizes the first letter of each word in a given string.
153+
138154``` js
139155capitalizeWords (' hello world' ); // 'Hello World'
140156
@@ -144,31 +160,39 @@ capitalizeWords('Sphinx of black quartz:-judge my vow'); // 'Sphinx Of Black Qua
144160### Case Conversion
145161
146162#### snakeCase
163+
147164Converts a string to snake_case format.
165+
148166``` js
149167snakeCase (' hello WorLd' ); // 'hello_world'
150168snakeCase (' from-kebab-case' ); // 'from_kebab_case'
151169snakeCase (' snake Case With Numbers123' , true ); // 'snake_case_with_numbers_one_two_three'
152170```
153171
154172#### kebabCase
173+
155174Converts a string to kebab-case format.
175+
156176``` js
157177kebabCase (' h3llo WoRld' ); // 'h3llo-world'
158178kebabCase (' from_snake_case' ); // 'from-snake-case'
159179kebabCase (' kebab Case With Numbers123' , true ); // 'kebab-case-with-numbers-one-two-three'
160180```
161181
162182#### camelCase
183+
163184Converts a string to camelCase format.
185+
164186``` js
165187camelCase (' hello WoRld' ); // 'helloWorld'
166188camelCase (' Test CaSe ExamplE' ); // 'testCaseExample'
167189camelCase (' camel Case With Numbers123' ); // 'camelCaseWithNumbers'
168190```
169191
170192#### pascalCase
193+
171194Converts a string to PascalCase format.
195+
172196``` js
173197pascalCase (' hello WoRld' ); // 'HelloWorld'
174198pascalCase (' Test CaSe ExamplE' ); // 'TestCaseExample'
@@ -178,7 +202,9 @@ pascalCase('pasCal Case With Numbers123'); // 'PascalCaseWithNumbers'
178202### Case Validation
179203
180204#### isSnakeCase
205+
181206Checks if a string is in snake_case format.
207+
182208``` js
183209// Valid
184210isSnakeCase (' snake_case_example' ); // true
@@ -195,7 +221,9 @@ isSnakeCase('no_CAPS'); // false
195221```
196222
197223#### isKebabCase
224+
198225Checks if a string is in kebab-case format.
226+
199227``` js
200228// Valid
201229isKebabCase (' kebab-case-example' ); // true
@@ -212,7 +240,9 @@ isKebabCase('no-CAPS'); // false
212240```
213241
214242#### isCamelCase
243+
215244Checks if a string is in camelCase format.
245+
216246``` js
217247// Valid
218248isCamelCase (' camelCaseExample' ); // true
@@ -225,7 +255,9 @@ isCamelCase('withThe1234'); // false
225255```
226256
227257#### isPascalCase
258+
228259Checks if a string is in PascalCase format.
260+
229261``` js
230262// Valid
231263isPascalCase (' PascalCaseExample' ); // true
@@ -238,7 +270,9 @@ isPascalCase('WithThe1234'); // false
238270```
239271
240272### regionMatch
273+
241274Compares two strings or regions for equality.
275+
242276``` js
243277// Matching identical strings
244278regionMatch (' hello' , ' hello' ); // true
@@ -255,7 +289,9 @@ regionMatch('hello world', 'hello there', 6, 11); // false
255289```
256290
257291### looseRegionMatch
292+
258293Performs a loose comparison of two strings or regions for equality.
294+
259295``` js
260296// Loose matching identical strings
261297looseRegionMatch (' hello' , ' HeLLo' ); // true
@@ -267,29 +303,39 @@ looseRegionMatch(str1, str2); // true
267303```
268304
269305### isAlpha
306+
270307Checks if a string contains only alphabetic characters (A-Z, a-z).
308+
271309``` js
272310isAlpha (" HelloWorld" ); // true
273311isAlpha (" Hello123" ); // false
274312```
275313
276314### isAlphaNumeric
315+
277316Checks if a string contains only alphanumeric characters (A-Z, a-z, 0-9).
317+
278318``` js
279319isAlphaNumeric (" Hello01" ); // true
280320isAlphaNumeric (" 1234567890" ); // false
281321```
282322
283323### Reverse
324+
284325Reverses the sequence of characters in given string.
326+
285327``` js
286328reverse (' bad' ) // 'dab'
287329```
288330
331+ Full documentation [ here] ( https://full-pack.github.io/string-pack )
332+
289333## Build
334+
290335```
291336npm run build
292337```
293338
294339## License
340+
295341The MIT License. Full License is [ here] ( LICENSE )
0 commit comments