dphelper 1.9.27 → 1.9.30

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.
@@ -13,20 +13,20 @@ appearance, race, religion, or sexual identity and orientation.
13
13
 
14
14
  ## Our Standards
15
15
 
16
- Examples of behaviour that contributes to a positive environment for our
16
+ Examples of behavior that contributes to a positive environment for our
17
17
  community include:
18
18
 
19
19
  * Demonstrating empathy and kindness toward other people
20
20
  * Being respectful of differing opinions, viewpoints, and experiences
21
21
  * Giving and gracefully accepting constructive feedback
22
- * Accepting responsibility and apologising to those affected by our mistakes,
22
+ * Accepting responsibility and apologizing to those affected by our mistakes,
23
23
  and learning from the experience
24
24
  * Focusing on what is best not just for us as individuals, but for the
25
25
  overall community
26
26
 
27
- Examples of unacceptable behaviour include:
27
+ Examples of unacceptable behavior include:
28
28
 
29
- * The use of sexualised language or imagery, and sexual attention or advances
29
+ * The use of sexualized language or imagery, and sexual attention or advances
30
30
  * Trolling, insulting or derogatory comments, and personal or political attacks
31
31
  * Public or private harassment
32
32
  * Publishing others' private information, such as a physical or email
@@ -37,8 +37,8 @@ Examples of unacceptable behaviour include:
37
37
  ## Our Responsibilities
38
38
 
39
39
  Project maintainers are responsible for clarifying and enforcing our standards of
40
- acceptable behaviour and will take appropriate and fair corrective action in
41
- response to any behaviour that they deem inappropriate,
40
+ acceptable behavior and will take appropriate and fair corrective action in
41
+ response to any behavior that they deem inappropriate,
42
42
  threatening, offensive, or harmful.
43
43
 
44
44
  Project maintainers have the right and responsibility to remove, edit, or reject
@@ -56,7 +56,7 @@ representative at an online or offline event.
56
56
 
57
57
  ## Enforcement
58
58
 
59
- Instances of abusive, harassing, or otherwise unacceptable behaviour may be
59
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
60
60
  reported to the community leaders responsible for enforcement at <dariopassariello@gmail.com>.
61
61
  All complaints will be reviewed and investigated promptly and fairly.
62
62
 
@@ -70,19 +70,19 @@ the consequences for any action they deem in violation of this Code of Conduct:
70
70
 
71
71
  ### 1. Correction
72
72
 
73
- **Community Impact**: Use of inappropriate language or other behaviour deemed
73
+ **Community Impact**: Use of inappropriate language or other behavior deemed
74
74
  unprofessional or unwelcome in the community.
75
75
 
76
76
  **Consequence**: A private, written warning from community leaders, providing
77
77
  clarity around the nature of the violation and an explanation of why the
78
- behaviour was inappropriate. A public apology may be requested.
78
+ behavior was inappropriate. A public apology may be requested.
79
79
 
80
80
  ### 2. Warning
81
81
 
82
82
  **Community Impact**: A violation through a single incident or series
83
83
  of actions.
84
84
 
85
- **Consequence**: A warning with consequences for continued behaviour. No
85
+ **Consequence**: A warning with consequences for continued behavior. No
86
86
  interaction with the people involved, including unsolicited interaction with
87
87
  those enforcing the Code of Conduct, for a specified period of time. This
88
88
  includes avoiding interactions in community spaces as well as external channels
@@ -92,7 +92,7 @@ permanent ban.
92
92
  ### 3. Temporary Ban
93
93
 
94
94
  **Community Impact**: A serious violation of community standards, including
95
- sustained inappropriate behaviour.
95
+ sustained inappropriate behavior.
96
96
 
97
97
  **Consequence**: A temporary ban from any sort of interaction or public
98
98
  communication with the community for a specified period of time. No public or
@@ -103,7 +103,7 @@ Violating these terms may lead to a permanent ban.
103
103
  ### 4. Permanent Ban
104
104
 
105
105
  **Community Impact**: Demonstrating a pattern of violation of community
106
- standards, including sustained inappropriate behaviour, harassment of an
106
+ standards, including sustained inappropriate behavior, harassment of an
107
107
  individual, or aggression toward or disparagement of classes of individuals.
108
108
 
109
109
  **Consequence**: A permanent ban from any sort of public interaction within
package/CONTRIBUTING.md CHANGED
@@ -46,8 +46,8 @@ We will then take care of the issue as soon as possible.
46
46
 
47
47
  ## I Want To Contribute
48
48
 
49
- > #### Legal Notice
50
- >
49
+ ### Legal Notice
50
+
51
51
  > When contributing to this project, you must agree that you have authored 100% of the content, that you have the necessary rights to the content and that the content you contribute may be provided under the project licence.
52
52
 
53
53
  ### Reporting Bugs
@@ -107,4 +107,4 @@ Enhancement suggestions are tracked as [GitHub issues](https://github.com/a51-de
107
107
 
108
108
  ## Join The Project Team
109
109
 
110
- Please send email to dariopassariello@gmail.com
110
+ Please send email to <dariopassariello@gmail.com>
package/HISTORY.md CHANGED
@@ -1 +1 @@
1
- none
1
+ # empty
package/LICENSE.md CHANGED
@@ -1,9 +1,21 @@
1
- MIT License
1
+ # MIT License
2
2
 
3
- Copyright (c) 2019 Dario Passariello
3
+ Copyright (c) 2019 Dario Passariello - <dariopassariello@gmail.com>
4
4
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
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:
6
11
 
7
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
8
14
 
9
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
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/README.md CHANGED
@@ -6,9 +6,12 @@
6
6
 
7
7
  [![version](https://img.shields.io/npm/v/dphelper.svg)](https://npmjs.org/package/dphelper)
8
8
  [![downloads](https://img.shields.io/npm/dm/dphelper.svg)](https://npmjs.org/package/dphelper)
9
- [![dphelper](https://snyk.io/advisor/npm-package/dphelper/badge.svg)](https://snyk.io/advisor/npm-package/dphelper)
10
9
 
10
+ ![jQuery](https://img.shields.io/badge/jQuery-gray?logo=jQuery)
11
+ ![Javascript](https://img.shields.io/badge/Javascript-gray?logo=Javascript)
12
+ ![React](https://img.shields.io/badge/React-gray?logo=React)
11
13
  ![TypeScript](https://img.shields.io/badge/TypeScript-gray?logo=typescript)
14
+
12
15
  ![Node.js](https://img.shields.io/badge/Node.js-gray?logo=node.js)
13
16
  ![Jest](https://img.shields.io/badge/Jest-gray?logo=jest)
14
17
  ![ESLint](https://img.shields.io/badge/ESLint-gray?logo=eslint)
@@ -18,10 +21,19 @@
18
21
 
19
22
  [![GitBook](https://img.shields.io/static/v1?message=Documented%20on%20GitBook&logo=gitbook&logoColor=ffffff&label=%20&labelColor=5c5c5c&color=3F89A1)](https://a51.gitbook.io/dphelper)
20
23
 
21
- <!--
22
- [![dphelper](https://snyk.io/advisor/npm-package/dphelper/badge.svg)](https://snyk.io/advisor/npm-package/dphelper)
23
- [![Socket Badge](https://socket.dev/api/badge/npm/package/dphelper)](https://socket.dev/npm/package/dphelper)
24
- -->
24
+ ## Table of Contents
25
+
26
+ 1. [About](#about)
27
+ 2. [Live Demo](#live-demo)
28
+ 3. [Installation](#install)
29
+ 4. [Documentation](#documentation)
30
+ 1. [State](#state)
31
+ 2. [Store](#store)
32
+ 3. [Session](#session)
33
+ 4. [Observer](#observer)
34
+ 5. [Extension](#extension)
35
+ 6. [Security](#security)
36
+ 7. [License](#license)
25
37
 
26
38
  ## About
27
39
 
@@ -33,6 +45,8 @@ dpHelper is a precise and complete collection of 190+ tools ready to use in all
33
45
 
34
46
  3. **Changes are made with proxy handle function**: To define state changes, dpHelper employs pure functions as intermediaries. These functions accept the current state as input and produce a new state as output, ensuring predictability and ease of testing in the system.
35
47
 
48
+ 4. **Based on [Memorio](https://www.npmjs.com/package/memorio) by Dario Passariello** to manage STATE, STORE, SESSION and OBSERVER. You can use Memorio is you need only state management. DpHelper is indicate when you use a complete suite of tools.
49
+
36
50
  ### 1. Example in React
37
51
 
38
52
  ```js
@@ -80,7 +94,7 @@ You can see:
80
94
 
81
95
  You can see more tutorials, information, and examples about **dpHelper** [clicking here](https://a51.gitbook.io/dphelper).
82
96
 
83
- ## Usage
97
+ ## Install
84
98
 
85
99
  Install dpHelper.
86
100
 
@@ -114,7 +128,7 @@ Note: You don't need to use npm install in this case, or you will get an error.
114
128
  <script src="https://cdn.jsdelivr.net/npm/dphelper"></script>
115
129
  ```
116
130
 
117
- ## The Best Way To Use State
131
+ ## State
118
132
 
119
133
  ### Using the "state" Function
120
134
 
@@ -149,7 +163,7 @@ state.removeAll()
149
163
 
150
164
  ```
151
165
 
152
- ### Observer for States
166
+ ### Observer
153
167
 
154
168
  **Note**: _Observer works only with states. Stores are excluded at the moment._
155
169
 
@@ -186,6 +200,8 @@ observer(
186
200
  setInterval(() => state.count = Date.now(), 5000);
187
201
  ```
188
202
 
203
+ > NOTE: In some cases you need to wrap inside and useEffect in React to avoid multiple observers
204
+
189
205
  #### Another Simple Example
190
206
 
191
207
  ```js
@@ -206,7 +222,7 @@ observer('myData', () => {
206
222
  state.myData = 'New value';
207
223
  ```
208
224
 
209
- ## The Best Way To Use Store 🫙
225
+ ## Store
210
226
 
211
227
  ### Persistent Storage with dpHelper
212
228
 
@@ -272,7 +288,26 @@ function App() {
272
288
  export default App;
273
289
  ```
274
290
 
275
- ## Console It
291
+ ## session
292
+
293
+ Similar to store but it's removed when you close the browser.
294
+ For more performance it's better to use state over session. State is global and access to data is more faster and not require the time to resolve promises.
295
+
296
+ ```js
297
+ // Set a store:
298
+ store.set("test", { test: "test" })
299
+
300
+ // Get a store:
301
+ store.get("test") // Output: { test: "test" }
302
+
303
+ // Remove a store:
304
+ store.remove("test") // Output: "ok"
305
+
306
+ // Remove all stores:
307
+ store.removeAll() // Output: "ok"
308
+ ```
309
+
310
+ ## Extension
276
311
 
277
312
  Type **dphelper** in the devtool console of your browser to have a look at all available tools that you can use! You can call these from everywhere without import (just one time in the main/root page).
278
313
 
@@ -300,7 +335,7 @@ The dpHelper browser extension allows you to manage your application's dpHelper
300
335
  4. Easy installation: Simply import 'dphelper' in your project index to get started.
301
336
  5. Global accessibility: All scripts are available globally and can be accessed from anywhere in your application.
302
337
 
303
- ## Check
338
+ ## Security
304
339
 
305
340
  [Socket.dev](https://socket.dev/npm/package/dphelper)
306
341
 
package/SECURITY.md CHANGED
@@ -1,3 +1,3 @@
1
1
  # Security
2
2
 
3
- Please email [@passariello](https://github.com/passariello) or see https://dario.passariello.ca/contact/ if you have a potential security vulnerability to report.
3
+ Please email [@passariello](https://github.com/passariello) or see <https://dario.passariello.ca/contact/> if you have a potential security vulnerability to report.
package/SUMMARY.md CHANGED
@@ -7,6 +7,7 @@
7
7
  * [State](/documents/STATE.md)
8
8
  * [Observer](/documents/OBSERVER.md)
9
9
  * [Store](/documents/STORE.md)
10
+ * [Session](/documents/SESSION.md)
10
11
  * [All Functions](/documents/TOOLS.md)
11
12
 
12
13
  ## documents
package/docs/index.md CHANGED
@@ -6,9 +6,12 @@
6
6
 
7
7
  [![version](https://img.shields.io/npm/v/dphelper.svg)](https://npmjs.org/package/dphelper)
8
8
  [![downloads](https://img.shields.io/npm/dm/dphelper.svg)](https://npmjs.org/package/dphelper)
9
- [![dphelper](https://snyk.io/advisor/npm-package/dphelper/badge.svg)](https://snyk.io/advisor/npm-package/dphelper)
10
9
 
10
+ ![jQuery](https://img.shields.io/badge/jQuery-gray?logo=jQuery)
11
+ ![Javascript](https://img.shields.io/badge/Javascript-gray?logo=Javascript)
12
+ ![React](https://img.shields.io/badge/React-gray?logo=React)
11
13
  ![TypeScript](https://img.shields.io/badge/TypeScript-gray?logo=typescript)
14
+
12
15
  ![Node.js](https://img.shields.io/badge/Node.js-gray?logo=node.js)
13
16
  ![Jest](https://img.shields.io/badge/Jest-gray?logo=jest)
14
17
  ![ESLint](https://img.shields.io/badge/ESLint-gray?logo=eslint)
@@ -18,10 +21,19 @@
18
21
 
19
22
  [![GitBook](https://img.shields.io/static/v1?message=Documented%20on%20GitBook&logo=gitbook&logoColor=ffffff&label=%20&labelColor=5c5c5c&color=3F89A1)](https://a51.gitbook.io/dphelper)
20
23
 
21
- <!--
22
- [![dphelper](https://snyk.io/advisor/npm-package/dphelper/badge.svg)](https://snyk.io/advisor/npm-package/dphelper)
23
- [![Socket Badge](https://socket.dev/api/badge/npm/package/dphelper)](https://socket.dev/npm/package/dphelper)
24
- -->
24
+ ## Table of Contents
25
+
26
+ 1. [About](#about)
27
+ 2. [Live Demo](#live-demo)
28
+ 3. [Installation](#install)
29
+ 4. [Documentation](#documentation)
30
+ 1. [State](#state)
31
+ 2. [Store](#store)
32
+ 3. [Session](#session)
33
+ 4. [Observer](#observer)
34
+ 5. [Extension](#extension)
35
+ 6. [Security](#security)
36
+ 7. [License](#license)
25
37
 
26
38
  ## About
27
39
 
@@ -33,6 +45,8 @@ dpHelper is a precise and complete collection of 190+ tools ready to use in all
33
45
 
34
46
  3. **Changes are made with proxy handle function**: To define state changes, dpHelper employs pure functions as intermediaries. These functions accept the current state as input and produce a new state as output, ensuring predictability and ease of testing in the system.
35
47
 
48
+ 4. **Based on [Memorio](https://www.npmjs.com/package/memorio) by Dario Passariello** to manage STATE, STORE, SESSION and OBSERVER. You can use Memorio is you need only state management. DpHelper is indicate when you use a complete suite of tools.
49
+
36
50
  ### 1. Example in React
37
51
 
38
52
  ```js
@@ -80,7 +94,7 @@ You can see:
80
94
 
81
95
  You can see more tutorials, information, and examples about **dpHelper** [clicking here](https://a51.gitbook.io/dphelper).
82
96
 
83
- ## Usage
97
+ ## Install
84
98
 
85
99
  Install dpHelper.
86
100
 
@@ -114,7 +128,7 @@ Note: You don't need to use npm install in this case, or you will get an error.
114
128
  <script src="https://cdn.jsdelivr.net/npm/dphelper"></script>
115
129
  ```
116
130
 
117
- ## The Best Way To Use State
131
+ ## State
118
132
 
119
133
  ### Using the "state" Function
120
134
 
@@ -149,7 +163,7 @@ state.removeAll()
149
163
 
150
164
  ```
151
165
 
152
- ### Observer for States
166
+ ### Observer
153
167
 
154
168
  **Note**: _Observer works only with states. Stores are excluded at the moment._
155
169
 
@@ -186,6 +200,8 @@ observer(
186
200
  setInterval(() => state.count = Date.now(), 5000);
187
201
  ```
188
202
 
203
+ > NOTE: In some cases you need to wrap inside and useEffect in React to avoid multiple observers
204
+
189
205
  #### Another Simple Example
190
206
 
191
207
  ```js
@@ -206,7 +222,7 @@ observer('myData', () => {
206
222
  state.myData = 'New value';
207
223
  ```
208
224
 
209
- ## The Best Way To Use Store 🫙
225
+ ## Store
210
226
 
211
227
  ### Persistent Storage with dpHelper
212
228
 
@@ -272,7 +288,26 @@ function App() {
272
288
  export default App;
273
289
  ```
274
290
 
275
- ## Console It
291
+ ## session
292
+
293
+ Similar to store but it's removed when you close the browser.
294
+ For more performance it's better to use state over session. State is global and access to data is more faster and not require the time to resolve promises.
295
+
296
+ ```js
297
+ // Set a store:
298
+ store.set("test", { test: "test" })
299
+
300
+ // Get a store:
301
+ store.get("test") // Output: { test: "test" }
302
+
303
+ // Remove a store:
304
+ store.remove("test") // Output: "ok"
305
+
306
+ // Remove all stores:
307
+ store.removeAll() // Output: "ok"
308
+ ```
309
+
310
+ ## Extension
276
311
 
277
312
  Type **dphelper** in the devtool console of your browser to have a look at all available tools that you can use! You can call these from everywhere without import (just one time in the main/root page).
278
313
 
@@ -300,7 +335,7 @@ The dpHelper browser extension allows you to manage your application's dpHelper
300
335
  4. Easy installation: Simply import 'dphelper' in your project index to get started.
301
336
  5. Global accessibility: All scripts are available globally and can be accessed from anywhere in your application.
302
337
 
303
- ## Check
338
+ ## Security
304
339
 
305
340
  [Socket.dev](https://socket.dev/npm/package/dphelper)
306
341
 
@@ -0,0 +1,58 @@
1
+ # dpHelper Session
2
+
3
+ ## Overview
4
+
5
+ This document provides a comprehensive list of all available session functions in the `dphelper` library along with their descriptions and examples.
6
+
7
+ **Based on [Memorio](https://www.npmjs.com/package/memorio) by Dario Passariello** to manage STATE, STORE, SESSION and OBSERVER. You can use Memorio is you need only state management. DpHelper is indicate when you use a complete suite of tools.
8
+
9
+ ## Functions
10
+
11
+ ### session.get([session.name])
12
+
13
+ - **Description:** Retrieve an item from session storage.
14
+ - **Parameters:**
15
+ - `name` (string): The name of the item to retrieve.
16
+ - **Example:**
17
+
18
+ ```javascript
19
+ const value = session.get('itemName');
20
+ console.log(value);
21
+ ```
22
+
23
+ ### session.set([name, value])
24
+
25
+ - **Description:** Set an item in session storage.
26
+ - **Parameters:**
27
+ - `name` (string): The name of the item to set.
28
+ - `value` (any): The value of the item to set.
29
+ - **Example:**
30
+
31
+ ```javascript
32
+ session.set('itemName', value);
33
+ ```
34
+
35
+ ### session.remove([session.name])
36
+
37
+ - **Description:** Delete an item from session storage.
38
+ - **Parameters:**
39
+ - `name` (string): The name of the item to delete.
40
+ - **Example:**
41
+
42
+ ```javascript
43
+ session.remove('itemName');
44
+ ```
45
+
46
+ ### session.removeAll()
47
+
48
+ - **Description:** Remove all items from session storage.
49
+ - **Parameters:** None
50
+ - **Example:**
51
+
52
+ ```javascript
53
+ session.removeAll();
54
+ ```
55
+
56
+ ## License
57
+
58
+ This project is licensed under the MIT License.
@@ -4,6 +4,8 @@
4
4
 
5
5
  This document provides a comprehensive list of all available state functions in the `dphelper` library along with their descriptions and examples.
6
6
 
7
+ **Based on [Memorio](https://www.npmjs.com/package/memorio) by Dario Passariello** to manage STATE, STORE, SESSION and OBSERVER. You can use Memorio is you need only state management. DpHelper is indicate when you use a complete suite of tools.
8
+
7
9
  ## Functions
8
10
 
9
11
  ### state.[state.name] ex: _state.test_
@@ -4,6 +4,8 @@
4
4
 
5
5
  This document provides a comprehensive list of all available store functions in the `dphelper` library along with their descriptions and examples.
6
6
 
7
+ **Based on [Memorio](https://www.npmjs.com/package/memorio) by Dario Passariello** to manage STATE, STORE, SESSION and OBSERVER. You can use Memorio is you need only state management. DpHelper is indicate when you use a complete suite of tools.
8
+
7
9
  ## Functions
8
10
 
9
11
  ### store.get([store.name])