Skip to content

Commit 1ed1592

Browse files
committed
Closes Issue #27
1 parent 5fa047f commit 1ed1592

File tree

6 files changed

+214
-3
lines changed

6 files changed

+214
-3
lines changed

CODE_OF_CONDUCT.md

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
2+
# Contributor Covenant Code of Conduct
3+
4+
## Our Pledge
5+
6+
We as members, contributors, and leaders pledge to make participation in our
7+
community a harassment-free experience for everyone, regardless of age, body
8+
size, visible or invisible disability, ethnicity, sex characteristics, gender
9+
identity and expression, level of experience, education, socio-economic status,
10+
nationality, personal appearance, race, caste, color, religion, or sexual
11+
identity and orientation.
12+
13+
We pledge to act and interact in ways that contribute to an open, welcoming,
14+
diverse, inclusive, and healthy community.
15+
16+
## Our Standards
17+
18+
Examples of behavior that contributes to a positive environment for our
19+
community include:
20+
21+
* Demonstrating empathy and kindness toward other people
22+
* Being respectful of differing opinions, viewpoints, and experiences
23+
* Giving and gracefully accepting constructive feedback
24+
* Accepting responsibility and apologizing to those affected by our mistakes,
25+
and learning from the experience
26+
* Focusing on what is best not just for us as individuals, but for the overall
27+
community
28+
29+
Examples of unacceptable behavior include:
30+
31+
* The use of sexualized language or imagery, and sexual attention or advances of
32+
any kind
33+
* Trolling, insulting or derogatory comments, and personal or political attacks
34+
* Public or private harassment
35+
* Publishing others' private information, such as a physical or email address,
36+
without their explicit permission
37+
* Other conduct which could reasonably be considered inappropriate in a
38+
professional setting
39+
40+
## Enforcement Responsibilities
41+
42+
Community leaders are responsible for clarifying and enforcing our standards of
43+
acceptable behavior and will take appropriate and fair corrective action in
44+
response to any behavior that they deem inappropriate, threatening, offensive,
45+
or harmful.
46+
47+
Community leaders have the right and responsibility to remove, edit, or reject
48+
comments, commits, code, wiki edits, issues, and other contributions that are
49+
not aligned to this Code of Conduct, and will communicate reasons for moderation
50+
decisions when appropriate.
51+
52+
## Scope
53+
54+
This Code of Conduct applies within all community spaces, and also applies when
55+
an individual is officially representing the community in public spaces.
56+
Examples of representing our community include using an official e-mail address,
57+
posting via an official social media account, or acting as an appointed
58+
representative at an online or offline event.
59+
60+
## Enforcement
61+
62+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
63+
reported to the primary community leader by private DM to
64+
[Larry on LinkedIn](https://www.linkedin.com/in/LarryMaccherone/).
65+
All complaints will be reviewed and investigated promptly and fairly.
66+
67+
All community leaders are obligated to respect the privacy and security of the
68+
reporter of any incident.
69+
70+
## Enforcement Guidelines
71+
72+
Community leaders will follow these Community Impact Guidelines in determining
73+
the consequences for any action they deem in violation of this Code of Conduct:
74+
75+
### 1. Correction
76+
77+
**Community Impact**: Use of inappropriate language or other behavior deemed
78+
unprofessional or unwelcome in the community.
79+
80+
**Consequence**: A private, written warning from community leaders, providing
81+
clarity around the nature of the violation and an explanation of why the
82+
behavior was inappropriate. A public apology may be requested.
83+
84+
### 2. Warning
85+
86+
**Community Impact**: A violation through a single incident or series of
87+
actions.
88+
89+
**Consequence**: A warning with consequences for continued behavior. No
90+
interaction with the people involved, including unsolicited interaction with
91+
those enforcing the Code of Conduct, for a specified period of time. This
92+
includes avoiding interactions in community spaces as well as external channels
93+
like social media. Violating these terms may lead to a temporary or permanent
94+
ban.
95+
96+
### 3. Temporary Ban
97+
98+
**Community Impact**: A serious violation of community standards, including
99+
sustained inappropriate behavior.
100+
101+
**Consequence**: A temporary ban from any sort of interaction or public
102+
communication with the community for a specified period of time. No public or
103+
private interaction with the people involved, including unsolicited interaction
104+
with those enforcing the Code of Conduct, is allowed during this period.
105+
Violating these terms may lead to a permanent ban.
106+
107+
### 4. Permanent Ban
108+
109+
**Community Impact**: Demonstrating a pattern of violation of community
110+
standards, including sustained inappropriate behavior, harassment of an
111+
individual, or aggression toward or disparagement of classes of individuals.
112+
113+
**Consequence**: A permanent ban from any sort of public interaction within the
114+
community.
115+
116+
## Attribution
117+
118+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119+
version 2.1, available at
120+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
121+
122+
Community Impact Guidelines were inspired by
123+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
124+
125+
For answers to common questions about this code of conduct, see the FAQ at
126+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
127+
[https://www.contributor-covenant.org/translations][translations].
128+
129+
[homepage]: https://www.contributor-covenant.org
130+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
131+
[Mozilla CoC]: https://github.com/mozilla/diversity
132+
[FAQ]: https://www.contributor-covenant.org/faq
133+
[translations]: https://www.contributor-covenant.org/translations
134+

CONTRIBUTING.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
2+
# Contributing to node-localstorage
3+
4+
First off, thanks for taking the time to contribute! ❤️
5+
6+
All types of contributions are encouraged and valued. See the [Table of Contents](#table-of-contents) for different ways to help and details about how this project handles them. The community looks forward to your contributions. 🎉
7+
8+
## I Have a Question
9+
10+
Before you ask a question read the available [documentation](https://github.com/lmaccherone/node-localstorage/blob/master/README.md) and search for existing [issues](https://github.com/lmaccherone/node-localstorage/issues) that might help you. In case you have found a suitable issue but need more clarification, you can write your question as a comment in the issue.
11+
12+
If you then still need to ask a question, then feel free open an [Issue](https://github.com/lmaccherone/node-localstorage/issues/new).
13+
14+
We will respond to the issue as soon as possible.
15+
16+
17+
## I Want To Contribute
18+
19+
> ### Legal Notice
20+
> Contributions must be free of any encumberance. Contributions are an attestation that you have the necessary authority to contribute it under the project license. By making a contribution of code or documentation, you agree to donate rights to the contribution to the project for the project to do with it whatever it wishes including but not limited to offering the project under a different license.
21+
22+
### Reporting Bugs
23+
24+
> #### Security Issues
25+
> You must never report security related issues, including vulnerabilities or the presence of sensitive information, to the issue tracker or elsewhere in public. See [SECURITY.md](https://github.com/lmaccherone/node-localstorage/blob/master/SECURITY.md) for instructions on how to report security issues.
26+
27+
We use GitHub issues to track bugs and errors. If you run into an issue with the project:
28+
29+
- Open an [Issue](https://github.com/lmaccherone/node-localstorage/issues/new).
30+
- Explain the behavior you would expect and the actual behavior.
31+
- The working agreement for this project is that the first step in fixing a bug is reproducing it in an automated test case, so the ideal bug report includes a failing test case but at the very least should include enough information for someone to reproduce it and write a test case. If you can't reproduce it, we can't fix it.
32+
- Make sure that your preferences are set so that you are notified when the issue is updated. This will allow you to respond to any questions or requests for additional information.
33+
34+
35+
### Suggesting Enhancements
36+
37+
Enhancement suggestions are tracked as [GitHub issues](https://github.com/lmaccherone/node-localstorage/issues).
38+
39+
Steps to suggest an enhancement:
40+
41+
- Make sure that you are using the latest version.
42+
- Read the [documentation](https://github.com/lmaccherone/node-localstorage/blob/master/README.md) carefully and find out if the functionality is already covered, maybe with an optional parameter or configuration.
43+
- Perform a [search](https://github.com/lmaccherone/node-localstorage/issues) to see if the enhancement has already been suggested. If it has, add a comment to the existing issue in support rather than opening a new one.
44+
- Think about whether your idea fits with the scope and goals of the project.
45+
- Open an [Issue](https://github.com/lmaccherone/node-localstorage/issues/new).
46+
- Describe the enhancement and the motivation behind it. If your enhancement targets a minority of users or is backward breaking propose it as optional with additional parameters or configuration.
47+
48+
49+
### Your First Contribution
50+
51+
Use the steps below to make your first code or documentation contribution to the project:
52+
53+
- Fork the [repository](https://github.com/lmaccherone/node-localstorage/fork) into your account.
54+
- Make your changes in your fork.
55+
- Be sure to keep the style consistent with the existing code or documentation.
56+
- If your contribution adds new functionality, make sure that you add tests for both the happy path and unexpected inputs.
57+
- If your contribution fixes a bug, start by writing a failing test the duplicates the bug, then modify the code so the test no longer fails. Then go back and write more tests to cover any other cases similar to the one you just fixed.
58+
59+
60+
## Attribution
61+
This guide is based on the **contributing-gen**. [Make your own](https://github.com/bttger/contributing-gen)!

LocalStorage.coffee

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,16 +76,30 @@ class LocalStorage extends events.EventEmitter
7676
set: (receiver, key, value) =>
7777
if @[key]?
7878
@[key] = value
79-
return true
8079
else
8180
@setItem(key, value)
81+
return true
8282

8383
get: (receiver, key) =>
8484
if @[key]?
8585
return @[key]
8686
else
8787
return @getItem(key)
8888

89+
ownKeys: (target) =>
90+
return @_keys.map((k) ->
91+
if k is KEY_FOR_EMPTY_STRING
92+
''
93+
else
94+
k
95+
)
96+
97+
getOwnPropertyDescriptor: (target, key) =>
98+
return
99+
value: @[key]
100+
enumerable: true
101+
configurable: true
102+
89103
instanceMap[@_location] = new Proxy(this, handler)
90104
return instanceMap[@_location]
91105

SECURITY.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,5 @@ receiving such patches depend on the CVSS v3.0 Rating:
1515
Please report (suspected) security vulnerabilities by private DM to
1616
[Larry on LinkedIn](https://www.linkedin.com/in/LarryMaccherone/).
1717
You will receive a response within 48 hours. If the issue is confirmed,
18-
1918
I will release a patch as soon as possible depending on complexity
2019
but historically within a few days.

test/es6-test.coffee

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ tape('array and dot notation', (test) => # TODO: These tests are inadequate in
1313
localStorage.b = 1
1414
test.equal(localStorage['b'], '1')
1515

16+
test.deepEqual(Object.keys(localStorage), ['a', '', 'b'])
17+
1618
localStorage._deleteLocation()
1719
test.end()
1820
)

test/localstorage-test.coffee

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ tape('localStorage API', (test) =>
3737
test.equal(localStorage.length, 0)
3838

3939
localStorage._deleteLocation()
40-
4140
test.end()
4241
)
4342

@@ -93,6 +92,7 @@ tape('remove keys', (test) =>
9392
localStorage.setItem('d', 'hello')
9493

9594
test.deepEqual(localStorage._keys, ['a', 'b', 'c', 'd'])
95+
test.deepEqual(Object.keys(localStorage), ['a', 'b', 'c', 'd'])
9696
localStorage.removeItem('c')
9797
test.deepEqual(localStorage._keys, ['a', 'b', 'd'])
9898
localStorage.removeItem('a');
@@ -101,6 +101,7 @@ tape('remove keys', (test) =>
101101
test.deepEqual(localStorage._keys, ['d'])
102102
localStorage.removeItem('d')
103103
test.deepEqual(localStorage._keys, [])
104+
test.deepEqual(Object.keys(localStorage), [])
104105

105106
localStorage._deleteLocation()
106107
test.end()

0 commit comments

Comments
 (0)