Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean up usage of null/undefined #380

Merged
merged 17 commits into from
Mar 21, 2024
Merged

clean up usage of null/undefined #380

merged 17 commits into from
Mar 21, 2024

Conversation

wjhsf
Copy link
Contributor

@wjhsf wjhsf commented Mar 13, 2024

This standardizes most of our methods to accept both null and undefined, and mostly return a value or undefined. Exceptions that I noticed are canonicalDomain, getPublicSuffix, permuteDomain, and domainMatch, which all return null. I don't remember why I skipped them when I originally did this, so I figured I'd just leave them for now. (I did most of this work a while ago, and evidently never pushed!)

This also introduces a helper type Nullable<T> for readability.

nb: #377 but without changes to cookie creation

lib/cookie/cookie.ts Outdated Show resolved Hide resolved
lib/cookie/cookie.ts Outdated Show resolved Hide resolved
lib/cookie/cookie.ts Outdated Show resolved Hide resolved
lib/memstore.ts Outdated Show resolved Hide resolved
colincasey
colincasey previously approved these changes Mar 15, 2024
lib/cookie/cookie.ts Outdated Show resolved Hide resolved
@wjhsf wjhsf requested a review from colincasey March 20, 2024 21:11
test/parsing_test.js Outdated Show resolved Hide resolved
test/parsing_test.js Outdated Show resolved Hide resolved
test/parsing_test.js Outdated Show resolved Hide resolved
test/parsing_test.js Outdated Show resolved Hide resolved
Apply suggestions from code review

Co-authored-by: Colin Casey <[email protected]>
@wjhsf wjhsf merged commit a48c867 into master Mar 21, 2024
6 checks passed
@wjhsf wjhsf deleted the nullable branch March 21, 2024 19:46
@wjhsf wjhsf added this to the v5 milestone Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants