@yurkimus/cookies 0.0.0 → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/deno.json +1 -1
  3. package/package.json +1 -1
  4. package/readme.md +55 -23
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 yurkimus
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/deno.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yurkimus/cookies",
3
- "version": "0.0.0",
3
+ "version": "0.0.1",
4
4
  "fmt": {
5
5
  "semiColons": false,
6
6
  "singleQuote": true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "type": "module",
3
- "version": "0.0.0",
3
+ "version": "0.0.1",
4
4
  "name": "@yurkimus/cookies",
5
5
  "author": {
6
6
  "name": "yurkimus",
package/readme.md CHANGED
@@ -1,33 +1,63 @@
1
1
  # Cookies
2
2
 
3
- A collection of utilities for handling cookies in JavaScript.
3
+ JavaScript-utilities to handle cookies everywhere.
4
4
 
5
- ## parseCookie
5
+ ## Table of Contents
6
6
 
7
- Parses a cookie string into a list of key-value pairs.
7
+ - [Installation](#installation)
8
+ - [Exports](#exports)
9
+ - [parseCookie](#parseCookie)
10
+ - [readCookie](#readCookie)
11
+ - [serializeCookie](#serializeCookie)
12
+ - [License](#license)
8
13
 
9
- | Parameter | Type | Description |
10
- | --------- | -------- | ------------- |
11
- | cookie | `string` | Cookie string |
14
+ ## Installation
12
15
 
13
- **Returns**: `[string, string][]`
16
+ ### npm
14
17
 
15
- **Example**:
18
+ ```
19
+ npm install @yurkimus/cookies
20
+ ```
21
+
22
+ ### urls
23
+
24
+ ```
25
+ "@yurkimus/cookies": "npm:@yurkimus/cookies"
26
+ ```
27
+
28
+ ```
29
+ "@yurkimus/cookies": "github:yurkimus/cookies"
30
+ ```
31
+
32
+ ```
33
+ "@yurkimus/cookies": "https://raw.githubusercontent.com/yurkimus/cookies/main/source/index.js"
34
+ ```
35
+
36
+ ## Exports
37
+
38
+ ### parseCookie
39
+
40
+ #### Definition
41
+
42
+ ```
43
+ parseCookie :: string -> *
44
+ ```
45
+
46
+ #### Example
16
47
 
17
48
  ```javascript
18
49
  parseCookie('name=John; age=30; role=admin') // => [['name', 'John'], ['age', '30'], ['role', 'admin']]
19
50
  ```
20
51
 
21
- ## readCookie
52
+ ### readCookie
22
53
 
23
- Reads cookies from a cookie string using a provided list of keys.
54
+ #### Definition
24
55
 
25
- | Parameter | Type | Description |
26
- | --------- | ---------------------- | ---------------------------- |
27
- | keys | `string` or `string[]` | List of keys or a single key |
28
- | cookie | `string` | Cookie string |
56
+ ```
57
+ readCookie :: * -> string -> *
58
+ ```
29
59
 
30
- **Example**:
60
+ #### Example
31
61
 
32
62
  ```javascript
33
63
  let cookie = 'name=John; age=30; role=admin'
@@ -37,17 +67,15 @@ readCookie('age', cookie) // => '30'
37
67
  readCookie(['age', 'name'], cookie) // => ['30', 'John']
38
68
  ```
39
69
 
40
- ## serializeCookie
70
+ ### serializeCookie
41
71
 
42
- Serializes a cookie from its components into a string.
72
+ #### Definition
43
73
 
44
- | Parameter | Type | Description |
45
- | ---------- | -------------------- | -------------------------------------------------------- |
46
- | name | `string` | The name of the cookie |
47
- | value | `string` | The value of the cookie |
48
- | attributes | `[string, string][]` | An array containing additional attributes for the cookie |
74
+ ```
75
+ serializeCookie :: string -> * -> [(string, string)] -> string
76
+ ```
49
77
 
50
- **Example**:
78
+ #### Example
51
79
 
52
80
  ```javascript
53
81
  let attributes = [
@@ -57,3 +85,7 @@ let attributes = [
57
85
 
58
86
  serializeCookie('name', 'John', attributes) // => 'name=John; path=/; expires=Wed, 21 Oct 2026 07:28:00 GMT'
59
87
  ```
88
+
89
+ ## License
90
+
91
+ [MIT](LICENSE)