Comments (23)
I would just keep it simple
from decancer.
Hey @net-tech! Due to a slight hiccup in the cure_char_inner
function, this bug apparently still persists for ASCII characters by v3.0.0
, i'm so sorry for this. 😭 This bug should be fixed by the latest update, v3.1.2
! ❤️
from decancer.
Hey @net-tech! Due to a slight hiccup in the
cure_char_inner
function, this bug apparently still persists for ASCII characters byv3.0.0
, i'm so sorry for this. 😭 This bug should be fixed by the latest update,v3.1.2
! ❤️
No problem! Thanks for letting me know.
from decancer.
@net-tech Hai! You can now support me through donations at ko-fi. So sorry for the delay, setting it up took a while!
from decancer.
Just donated! Thank you for setting it up and for fixing the issue!
from decancer.
Hi! Yes, unfortunately this is an intentional design decision. All characters are lowercased in order to ease the comparison checks later.
from decancer.
May i ask why you would want this to be a feature? Because the purpose of the output of decancer is for comparison, not to display (it's not used for formatting!)
I recommend you use the provided methods contains
, equals
, startsWith
, and endsWith
rather than using toString()
, only use it as a last resort.
from decancer.
May i ask why you would want this to be a feature?
I'm working on a Discord bot that cleans up the display names of members (You seem to be familiar with what Discord and its bots are) so I'm just trying to replace the characters that are strange.
I was originally using https://www.npmjs.com/package/@aero/sanitizer but decancer
is more performant which is what attracted me to it.
from decancer.
Ah, i see, i could make a feature that lets you customize how the curing process works, though that would be breaking (for some bindings) therefore would be for a major update.
from decancer.
I see. How would adjusting the curing process look like from a dev perspective?
from decancer.
It's complicated, but it would be something like:
if input_character.is_uppercase:
return lowercased_output.to_uppercase()
then, on the user-end, you would call something like this:
decancer(text, {
retainCapitalization: true
})
or
const config = decancer.config({
retainCapitalization: true
})
decancer(text, config)
from decancer.
Yeah that would be very nice
from decancer.
Please note that this change would be major and breaking (therefore for v3.0.0
) - and such change would be time consuming. Be patient!
from decancer.
No problem and thanks for your quick replies!
from decancer.
@net-tech Quick question regarding the ambiguity of capitalization: Some unicode characters, like 🆑 are shown in uppercase CL
, do you think decancer should output them in uppercase as well? (Despite 🆑 technically being neither a lowercase nor uppercase character)
If yes, this can be ambiguous when the package says retainCapitalization
. I could keep it simple with just uppercasing output characters where the original input characters are in uppercase.
from decancer.
Hai! By 19 February 2024, this issue has been resolved in the latest commit. At the moment you just need to wait until v3.0.0
is out.
from decancer.
Wow! Amazing. Do you have a one time donation link somewhere?
from decancer.
Thank you soo much for that offer! ❤️ I've never gotten a donation before -- i'm afraid at the moment donation links won't be available until 22 April 2024. I'll let you know once it's available!
from decancer.
No problem. When it's available let me know via this issue or [email protected]. It will be a small amount but I'm still dedicated to giving something
from decancer.
It's finally here!
For your use case, it's probably either
const output = decancer(string, {
retainCapitalization: true
})
Or if you call decancer()
multiple times, you can do
const options = decancer.options({
retainCapitalization: true
})
const output = decancer(string, options)
Or if you want for decancer to keep capitalization and not cure characters from the world's major foreign scripts, you can do
// output is a javascript string
const output = decancer.format(string)
Cheers! If you have any problems or found any bugs, please be sure to let me know! Happy coding! Much love ❤️❤️
from decancer.
Thank you so much!
from decancer.
❤️
from decancer.
Thank you so much for the donation! I'm glad that my project helped yours! ❤️
from decancer.
Related Issues (10)
- Python bindings? HOT 2
- The character "Æ" (U+00C6) appears to cause cure to panic. HOT 2
- Add safety comments for unsafe portions of code. HOT 4
- Implement unicode bidi support HOT 1
- feature request: equal/startsWith/endsWith HOT 3
- Remove usage of `unsafe` completely HOT 9
- Undefined behavior in tests HOT 3
- Wrong type definition ? HOT 6
- `cure` hangs when fed specific character HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from decancer.