@@ -8,9 +8,9 @@ Some functions to work better with arrays, objects and more!!
88
99### sortBy
1010
11- _ function to sort an array _
11+ # sortBy
1212
13- How to use it?
13+ How to import it?
1414
1515```
1616import { Array } from "some-javascript-utils";
@@ -44,9 +44,9 @@ Array.sortBy(array, "id", "asc") ;
4444
4545## Browser
4646
47- _ function to get user language _
47+ # getUserLanguage
4848
49- Hot to use it?
49+ Hot to import it?
5050
5151```
5252import { Browser } from "some-javascript-utils";
@@ -73,12 +73,52 @@ const userLang = getUserLanguage();
7373// if pass a string parameter will save the language to a cookie ()
7474// example: "en"
7575
76+ ```
77+
78+ # parseQueries
79+
80+ Hot to import it?
81+
82+ ```
83+
84+ import { Browser } from "some-javascript-utils";
85+ // import { parseQueries } from "some-javascript-utils";
86+
87+ ```
88+
89+ or
90+
91+ ```
92+
93+ const { Browser } = "some-javascript-utils";
94+ // const { parseQueries } = "some-javascript-utils";
95+
96+ ```
97+
98+ #### In Action!
99+
100+ 🔶⚠Very important⚠🔶!!
101+
102+ _ just work in browsers_
76103
77104```
78105
79- _ function to scroll to position_
106+ // ...imports
107+
108+ //! using location from useLocation() hook from "react-router-dom"
109+
110+ useEffect(() => {
111+ const { search } = location // ex: [some-url]?id=1&folder=sito
112+ const queryParams = parseQueries(search)
113+ // queryParams will value { id: "1", folder: "sito" }
114+ },[location])
80115
81- Hot to use it?
116+
117+ ```
118+
119+ # scrollTo
120+
121+ Hot to import it?
82122
83123```
84124
@@ -111,9 +151,9 @@ scrollTo(0) // go to top of the page
111151
112152```
113153
114- _ function to create a cookie _
154+ # createCookie
115155
116- Hot to use it?
156+ Hot to import it?
117157
118158```
119159
@@ -151,9 +191,9 @@ createCookie(name, expiration, value);
151191
152192```
153193
154- _ function to get a cookie value _
194+ # getCookie
155195
156- Hot to use it?
196+ Hot to import it?
157197
158198```
159199
@@ -186,11 +226,12 @@ getCookie(name);
186226
187227// result
188228// sito (of previous example)
229+
189230```
190231
191- _ function to delete a cookie _
232+ # deleteCookie
192233
193- Hot to use it?
234+ Hot to import it?
194235
195236```
196237
@@ -223,4 +264,7 @@ deleteCookie(name);
223264
224265// result
225266// (document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`);/
267+
268+ ```
269+
226270```
0 commit comments