Skip to content

Commit 24a0c2a

Browse files
Documentation enhancement
This commit is a follow-up of the discussion at js-cookiegh-54 with a few improvements. * Clarify the values that are allowed in the cookie attributes. * Change "cookie available" wording to "cookie visible" to make it clear what it means
1 parent f8e01f4 commit 24a0c2a

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Cookies.get('name'); // => 'value'
6161
Cookies.get('nothing'); // => undefined
6262
```
6363

64-
Read all available cookies:
64+
Read all visible cookies:
6565

6666
```javascript
6767
Cookies.get(); // => { name: 'value' }
@@ -139,7 +139,7 @@ Cookie attributes defaults can be set globally by setting properties of the `Coo
139139

140140
### expires
141141

142-
Define when the cookie will be removed. Value can be a `Number` which will be interpreted as days from time of creation or a `Date` instance. If omitted, the cookie becomes a session cookie.
142+
Define when the cookie will be removed. Value can be a [`Number`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) which will be interpreted as days from time of creation or a [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) instance. If omitted, the cookie becomes a session cookie.
143143

144144
**Default:** Cookie is removed when the user closes the browser.
145145

@@ -153,7 +153,7 @@ Cookies.remove('name');
153153

154154
### path
155155

156-
Define the path where the cookie is available.
156+
A [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) indicating the path where the cookie is visible.
157157

158158
**Default:** `/`
159159

@@ -175,9 +175,9 @@ This means one cannot set a path using `path: window.location.pathname` in case
175175

176176
### domain
177177

178-
Define the domain where the cookie is available
178+
A [`String`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String) indicating a valid domain where the cookie is visible.
179179

180-
**Default:** Domain of the page where the cookie was created
180+
**Default:** Domain of the page where the cookie was created.
181181

182182
**Examples:**
183183

@@ -188,9 +188,9 @@ Cookies.get('name'); // => undefined (need to read at 'sub.domain.com')
188188

189189
### secure
190190

191-
A `Boolean` indicating if the cookie transmission requires a secure protocol (https)
191+
Either `true` or `false`, indicating if the cookie transmission requires a secure protocol (https).
192192

193-
**Default:** No secure protocol requirement
193+
**Default:** No secure protocol requirement.
194194

195195
**Examples:**
196196

0 commit comments

Comments
 (0)