@peter.naydenov/notice 2.2.2 → 2.3.0
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.
- package/.github/ISSUE_TEMPLATE/bug_report.md +32 -0
- package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- package/CODE_OF_CONDUCT.md +128 -0
- package/Changelog.md +11 -0
- package/README.md +58 -6
- package/SECURITY.md +18 -0
- package/coverage/lcov-report/index.html +18 -18
- package/coverage/lcov-report/main.js.html +107 -74
- package/coverage/lcov.info +157 -138
- package/coverage/tmp/coverage-18329-1710398056283-0.json +1 -0
- package/coverage/tmp/coverage-18330-1710398055946-0.json +1 -0
- package/dist/notice.cjs +1 -0
- package/dist/notice.esm.mjs +1 -0
- package/dist/notice.umd.js +1 -0
- package/package.json +31 -16
- package/rollup.config.js +37 -0
- package/src/main.js +6 -1
- package/coverage/tmp/coverage-43593-1691169158883-0.json +0 -1
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Create a report to help us improve
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Describe the bug**
|
|
11
|
+
A clear and concise description of what the bug is.
|
|
12
|
+
|
|
13
|
+
**To Reproduce**
|
|
14
|
+
Steps to reproduce the behavior:
|
|
15
|
+
1. What is environment 'browser/node/version...'. Describe it best is possible
|
|
16
|
+
2. Settings applied to the library...
|
|
17
|
+
3. Call with data ...
|
|
18
|
+
4. See error
|
|
19
|
+
|
|
20
|
+
**Expected behavior**
|
|
21
|
+
A clear and concise description of what you expected to happen.
|
|
22
|
+
|
|
23
|
+
**Description of the result**
|
|
24
|
+
If applicable, add screenshots to help explain your problem.
|
|
25
|
+
|
|
26
|
+
**Desktop (please complete the following information):**
|
|
27
|
+
- OS: [e.g. iOS]
|
|
28
|
+
- Browser [e.g. chrome, safari]
|
|
29
|
+
- Version [e.g. 22]
|
|
30
|
+
|
|
31
|
+
**Additional context**
|
|
32
|
+
Add any other context about the problem here.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest an idea for this project
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Is your feature request related to a problem? Please describe.**
|
|
11
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
12
|
+
|
|
13
|
+
**Describe the solution you'd like**
|
|
14
|
+
A clear and concise description of what you want to happen.
|
|
15
|
+
|
|
16
|
+
**Describe alternatives you've considered**
|
|
17
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
|
18
|
+
|
|
19
|
+
**Additional context**
|
|
20
|
+
Add any other context or screenshots about the feature request here.
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity
|
|
10
|
+
and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
|
18
|
+
community include:
|
|
19
|
+
|
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
+
and learning from the experience
|
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the
|
|
26
|
+
overall community
|
|
27
|
+
|
|
28
|
+
Examples of unacceptable behavior include:
|
|
29
|
+
|
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or
|
|
31
|
+
advances of any kind
|
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
+
* Public or private harassment
|
|
34
|
+
* Publishing others' private information, such as a physical or email
|
|
35
|
+
address, without their explicit permission
|
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
+
professional setting
|
|
38
|
+
|
|
39
|
+
## Enforcement Responsibilities
|
|
40
|
+
|
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
+
or harmful.
|
|
45
|
+
|
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
+
decisions when appropriate.
|
|
50
|
+
|
|
51
|
+
## Scope
|
|
52
|
+
|
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
+
an individual is officially representing the community in public spaces.
|
|
55
|
+
Examples of representing our community include using an official e-mail address,
|
|
56
|
+
posting via an official social media account, or acting as an appointed
|
|
57
|
+
representative at an online or offline event.
|
|
58
|
+
|
|
59
|
+
## Enforcement
|
|
60
|
+
|
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
+
reported to the community leaders responsible for enforcement at
|
|
63
|
+
peter.naydenov@gmail.com.
|
|
64
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
65
|
+
|
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
|
67
|
+
reporter of any incident.
|
|
68
|
+
|
|
69
|
+
## Enforcement Guidelines
|
|
70
|
+
|
|
71
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
|
72
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
|
73
|
+
|
|
74
|
+
### 1. Correction
|
|
75
|
+
|
|
76
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
77
|
+
unprofessional or unwelcome in the community.
|
|
78
|
+
|
|
79
|
+
**Consequence**: A private, written warning from community leaders, providing
|
|
80
|
+
clarity around the nature of the violation and an explanation of why the
|
|
81
|
+
behavior was inappropriate. A public apology may be requested.
|
|
82
|
+
|
|
83
|
+
### 2. Warning
|
|
84
|
+
|
|
85
|
+
**Community Impact**: A violation through a single incident or series
|
|
86
|
+
of actions.
|
|
87
|
+
|
|
88
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
|
89
|
+
interaction with the people involved, including unsolicited interaction with
|
|
90
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
|
91
|
+
includes avoiding interactions in community spaces as well as external channels
|
|
92
|
+
like social media. Violating these terms may lead to a temporary or
|
|
93
|
+
permanent ban.
|
|
94
|
+
|
|
95
|
+
### 3. Temporary Ban
|
|
96
|
+
|
|
97
|
+
**Community Impact**: A serious violation of community standards, including
|
|
98
|
+
sustained inappropriate behavior.
|
|
99
|
+
|
|
100
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
|
101
|
+
communication with the community for a specified period of time. No public or
|
|
102
|
+
private interaction with the people involved, including unsolicited interaction
|
|
103
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
|
104
|
+
Violating these terms may lead to a permanent ban.
|
|
105
|
+
|
|
106
|
+
### 4. Permanent Ban
|
|
107
|
+
|
|
108
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
|
109
|
+
standards, including sustained inappropriate behavior, harassment of an
|
|
110
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
|
111
|
+
|
|
112
|
+
**Consequence**: A permanent ban from any sort of public interaction within
|
|
113
|
+
the community.
|
|
114
|
+
|
|
115
|
+
## Attribution
|
|
116
|
+
|
|
117
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
118
|
+
version 2.0, available at
|
|
119
|
+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
|
120
|
+
|
|
121
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
|
122
|
+
enforcement ladder](https://github.com/mozilla/diversity).
|
|
123
|
+
|
|
124
|
+
[homepage]: https://www.contributor-covenant.org
|
|
125
|
+
|
|
126
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
|
127
|
+
https://www.contributor-covenant.org/faq. Translations are available at
|
|
128
|
+
https://www.contributor-covenant.org/translations.
|
package/Changelog.md
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
# Release History
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
### 2.3.0 ( 2024-03-14 )
|
|
5
|
+
- [x] Stop execution of the event callbacks on first callback that returns string 'stop';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### 2.2.3 ( 2024-01-29)
|
|
10
|
+
- [x] Folder 'dist' was added. It contains compiled files for commonjs and es6 modules;
|
|
11
|
+
- [x] Package.json: "exports" section was added. Allows you to use package as commonjs or es6 module without additional configuration;
|
|
12
|
+
|
|
4
13
|
|
|
5
14
|
|
|
6
15
|
### 2.2.2 ( 2023-11-09)
|
|
@@ -11,6 +20,8 @@
|
|
|
11
20
|
### 2.2.1 ( 2023-10-23)
|
|
12
21
|
- [x] Fix: Calling 'Reset' breaks callback execution;
|
|
13
22
|
|
|
23
|
+
|
|
24
|
+
|
|
14
25
|
### 2.2.0 ( 2023-09-20)
|
|
15
26
|
- [x] Listen with wildcard was added;
|
|
16
27
|
- [ ] Bug: Calling 'Reset' breaks callback execution;
|
package/README.md
CHANGED
|
@@ -6,13 +6,24 @@
|
|
|
6
6
|
|
|
7
7
|
# Notice (@peter.naydenov/notice)
|
|
8
8
|
|
|
9
|
-

|
|
10
|
+

|
|
11
|
+

|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
`Notice` is an simple event emitter. Define a behaviour related to event and then trigger the event.
|
|
16
|
+
Register multiple callbacks to the same event. Order of execution is the same as the order of registration.
|
|
17
|
+
Use method '**stop**' to mute the event for a while. Use method '**start**' to unmute the event. Method '**off**' will remove the event and all related callbacks. Method 'reset' will remove all events and functions from the event emitter.
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
## Last Updates
|
|
22
|
+
- After version 2.1.0 Method 'reset' was added. It removes all events and functions from the event emitter;
|
|
23
|
+
- After version 2.3.0 If callback that returns a string 'stop', the execution of followed callbacks will be stopped. Use this functionality to create a condition checking functions before your main callback if needed;
|
|
24
|
+
|
|
13
25
|
|
|
14
26
|
|
|
15
|
-
Notice is an simple event emitter. Define a behaviour related to event and then trigger the event.
|
|
16
27
|
|
|
17
28
|
## Installation
|
|
18
29
|
Write in your project
|
|
@@ -28,12 +39,53 @@ npm install @peter.naydenov/notice
|
|
|
28
39
|
## How to use it
|
|
29
40
|
Here is simple example for using this trivial event emitter:
|
|
30
41
|
```js
|
|
42
|
+
// with ES6 modules:
|
|
31
43
|
import notice from '@peter.naydenov/notice'
|
|
44
|
+
// with CommonJS:
|
|
45
|
+
// const notice = require('@peter.naydenov/notice')
|
|
32
46
|
const eBus = notice ();
|
|
33
47
|
|
|
34
48
|
eBus.on ( 'note' , () => console.log ( 'hey!') )
|
|
35
49
|
eBus.emit ( 'note' )
|
|
36
50
|
// ---> 'hey!'
|
|
51
|
+
|
|
52
|
+
// example 2
|
|
53
|
+
eBus.on ( 'note' , () => console.log ( 'hey!') )
|
|
54
|
+
eBus.on ( 'note' , () => console.log ( 'ho!') )
|
|
55
|
+
eBus.emit ( 'note' ) // will execute all functions related to the event
|
|
56
|
+
// ---> 'hey!ho!'
|
|
57
|
+
|
|
58
|
+
// example 3
|
|
59
|
+
eBus.on ( 'note' , () => console.log ( 'hey!') )
|
|
60
|
+
eBus.on ( 'note' , () => console.log ( 'ho!') )
|
|
61
|
+
eBus.off ( 'note' ) // will remove all functions related to the event
|
|
62
|
+
eBus.emit ( 'note' ) // nothing will happen
|
|
63
|
+
|
|
64
|
+
// example 4
|
|
65
|
+
let x = 0;
|
|
66
|
+
eBus.on ( 'note' , () => {
|
|
67
|
+
console.log ( 'hey!')
|
|
68
|
+
if ( x === 0 ) {
|
|
69
|
+
x++
|
|
70
|
+
return 'stop'
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
eBus.on ( 'note' , () => {
|
|
74
|
+
console.log ( 'ho!')
|
|
75
|
+
x++
|
|
76
|
+
})
|
|
77
|
+
eBus.emit ( 'note' ) // Will execute only the first function. If callback returns 'stop', the execution of callbacks will be stopped.
|
|
78
|
+
// ---> 'hey!'
|
|
79
|
+
// x == 1
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
// example 5
|
|
84
|
+
eBus.on ( 'note' , () => console.log ( 'hey!') )
|
|
85
|
+
eBus.stop ( 'note' ) // will mute the event
|
|
86
|
+
eBus.emit ( 'note' ) // nothing will happen
|
|
87
|
+
eBus.start ( 'note' ) // will unmute the event
|
|
88
|
+
eBus.emit ( 'note' ) // ---> 'hey!'
|
|
37
89
|
```
|
|
38
90
|
|
|
39
91
|
|
|
@@ -238,4 +290,4 @@ eBus.emit ( 'dummy' )
|
|
|
238
290
|
|
|
239
291
|
|
|
240
292
|
## License
|
|
241
|
-
'notice' is released under the [
|
|
293
|
+
'notice' is released under the [MIT License](https://opensource.org/licenses/ISC).
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
Use this section to tell people about which versions of your project are
|
|
6
|
+
currently being supported with security updates.
|
|
7
|
+
|
|
8
|
+
| Version | Supported |
|
|
9
|
+
| ------- | ------------------ |
|
|
10
|
+
| 2.x.x | :white_check_mark: |
|
|
11
|
+
| < 2.0 | :x: |
|
|
12
|
+
|
|
13
|
+
## Reporting a Vulnerability
|
|
14
|
+
|
|
15
|
+
Security vulnerabilities should be reported as a 'issue' on the github repository. Please include the following information:
|
|
16
|
+
- A description of the vulnerability
|
|
17
|
+
- Steps to reproduce the vulnerability
|
|
18
|
+
- Versions affected
|
|
@@ -23,30 +23,30 @@
|
|
|
23
23
|
<div class='clearfix'>
|
|
24
24
|
|
|
25
25
|
<div class='fl pad1y space-right2'>
|
|
26
|
-
<span class="strong">90.
|
|
26
|
+
<span class="strong">90.26% </span>
|
|
27
27
|
<span class="quiet">Statements</span>
|
|
28
|
-
<span class='fraction'>
|
|
28
|
+
<span class='fraction'>102/113</span>
|
|
29
29
|
</div>
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
<div class='fl pad1y space-right2'>
|
|
33
|
-
<span class="strong">
|
|
33
|
+
<span class="strong">94.11% </span>
|
|
34
34
|
<span class="quiet">Branches</span>
|
|
35
|
-
<span class='fraction'>
|
|
35
|
+
<span class='fraction'>48/51</span>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
<div class='fl pad1y space-right2'>
|
|
40
|
-
<span class="strong">90% </span>
|
|
40
|
+
<span class="strong">90.9% </span>
|
|
41
41
|
<span class="quiet">Functions</span>
|
|
42
|
-
<span class='fraction'>
|
|
42
|
+
<span class='fraction'>10/11</span>
|
|
43
43
|
</div>
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
<div class='fl pad1y space-right2'>
|
|
47
|
-
<span class="strong">90.
|
|
47
|
+
<span class="strong">90.26% </span>
|
|
48
48
|
<span class="quiet">Lines</span>
|
|
49
|
-
<span class='fraction'>
|
|
49
|
+
<span class='fraction'>102/113</span>
|
|
50
50
|
</div>
|
|
51
51
|
|
|
52
52
|
|
|
@@ -80,17 +80,17 @@
|
|
|
80
80
|
</thead>
|
|
81
81
|
<tbody><tr>
|
|
82
82
|
<td class="file high" data-value="main.js"><a href="main.js.html">main.js</a></td>
|
|
83
|
-
<td data-value="90.
|
|
83
|
+
<td data-value="90.26" class="pic high">
|
|
84
84
|
<div class="chart"><div class="cover-fill" style="width: 90%"></div><div class="cover-empty" style="width: 10%"></div></div>
|
|
85
85
|
</td>
|
|
86
|
-
<td data-value="90.
|
|
87
|
-
<td data-value="
|
|
88
|
-
<td data-value="
|
|
89
|
-
<td data-value="
|
|
90
|
-
<td data-value="90" class="pct high">90%</td>
|
|
91
|
-
<td data-value="
|
|
92
|
-
<td data-value="90.
|
|
93
|
-
<td data-value="
|
|
86
|
+
<td data-value="90.26" class="pct high">90.26%</td>
|
|
87
|
+
<td data-value="113" class="abs high">102/113</td>
|
|
88
|
+
<td data-value="94.11" class="pct high">94.11%</td>
|
|
89
|
+
<td data-value="51" class="abs high">48/51</td>
|
|
90
|
+
<td data-value="90.9" class="pct high">90.9%</td>
|
|
91
|
+
<td data-value="11" class="abs high">10/11</td>
|
|
92
|
+
<td data-value="90.26" class="pct high">90.26%</td>
|
|
93
|
+
<td data-value="113" class="abs high">102/113</td>
|
|
94
94
|
</tr>
|
|
95
95
|
|
|
96
96
|
</tbody>
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
102
102
|
Code coverage generated by
|
|
103
103
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
104
|
-
at
|
|
104
|
+
at 2024-03-14T06:34:16.346Z
|
|
105
105
|
</div>
|
|
106
106
|
<script src="prettify.js"></script>
|
|
107
107
|
<script>
|