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

Fix breaking change causing null and booleans to make a breaking error #75

Merged
merged 2 commits into from
Sep 3, 2024

Conversation

jonhassall
Copy link
Contributor

A change in Release 2.4.0 has made null and boolean inputs to trigger an error. This was not the case before.

`const { profanity, CensorType } = require('@2toad/profanity');

console.log(profanity.exists('I like big butts and I cannot lie'));
console.log(profanity.exists('I like cheeseburgers'));
console.log(profanity.exists(null));
console.log(profanity.exists(true));
`

`node_modules@2toad\profanity\dist\profanity.js:17
const lowercaseText = text.toLowerCase();
^

TypeError: Cannot read properties of null (reading 'toLowerCase')
at Profanity.exists (C:\Users\User\Documents\soundbites\src\soundbites\node_modules@2toad\profanity\dist\profanity.js:17:36)
at Object. (C:\Users\User\Documents\soundbites\src\soundbites\testing.js:5:23)
at Module._compile (node:internal/modules/cjs/loader:1369:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
at Module.load (node:internal/modules/cjs/loader:1206:32)
at Module._load (node:internal/modules/cjs/loader:1022:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
at node:internal/main/run_main_module:28:49`

@JasonPierce
Copy link
Contributor

Hi @jonhassall! Thanks for reporting this issue and submitting a fix. I've created a ticket for it: #76

@JasonPierce JasonPierce linked an issue Sep 3, 2024 that may be closed by this pull request
Copy link
Contributor

@JasonPierce JasonPierce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!
Please remember to run npm run lint:fix && npm run prettier:fix before pushing changes

src/profanity.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@JasonPierce JasonPierce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💎

@JasonPierce JasonPierce merged commit 626fcc1 into 2Toad:master Sep 3, 2024
1 check passed
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.

non-string type throws error in exists and censor
2 participants