Research
Recent Trends in Malicious Packages Targeting Discord
The Socket research team breaks down a sampling of malicious packages that download and execute files, among other suspicious behaviors, targeting the popular Discord platform.
Readme
Casefy (/keɪsfaɪ/) is a lightweight Python package to convert the casing of strings. It has no third-party dependencies and supports Unicode.
The latest release can be installed using pip:
pip install -U casefy
Casefy is also available as an Arch Linux AUR package.
Note: for more details, you can check the API Reference.
import casefy
# camelCase
string = casefy.camelcase("foo_bar")
print(string) # fooBar
string = casefy.camelcase("FooBar")
print(string) # fooBar
string = casefy.camelcase("FOO BAR")
print(string) # fooBar
# PascalCase
string = casefy.pascalcase("foo_bar")
print(string) # FooBar
string = casefy.pascalcase("fooBar")
print(string) # FooBar
# snake_case
string = casefy.snakecase("fooBar")
print(string) # foo_bar
string = casefy.snakecase("fooBARbaz", keep_together=["bar"])
print(string) # foo_bar_baz
string = casefy.snakecase("FOO BAR")
print(string) # foo_bar
# CONST_CASE
string = casefy.constcase("fooBar")
print(string) # FOO_BAR
# kebab-case
string = casefy.kebabcase("fooBar")
print(string) # foo-bar
# UPPER-KEBAB-CASE
string = casefy.upperkebabcase("fooBar")
print(string) # FOO-BAR
# separator case
string = casefy.separatorcase("fooBar", separator="/")
print(string) # foo/bar
string = casefy.separatorcase("fooBARbaz", separator="%", keep_together=["bar"])
print(string) # foo%bar%baz
# Sentence case
string = casefy.sentencecase("fooBar")
print(string) # Foo bar
# Title Case
string = casefy.titlecase("fooBar")
print(string) # Foo Bar
# Alphanum3ric case (removes non-alphanumeric chars)
string = casefy.alphanumcase("foo - 123 ; bar!")
print(string) # foo123bar
If you find a bug, please open an issue. Pull Requests are also welcome!
This project started when I saw that the package python-stringcase
was flagged-out-of-date in the Arch AUR Repository. The project stringcase seems not to be actively maintained anymore, so I decided to address its issues and pull requests and solve them in this new package. I kept the API as similar as possible, in order to facilitate any possible migration. I thank Taka Okunishi (author of stringcase) and its contributors for their work.
case-conversion
offers a very similar functionality as this project. I probably wouldn't have written this package if I had known of it before. However, the code of Casefy is more lightweight and just enough for most cases. If you need more functionality, e.g., detecting the case of a string, go with case-conversion
.
Inflection presents some overlap with this project as well, allowing the transformation of strings from CamelCase to underscored_string, but also singularizing and pluralizing English words.
Casefy is distributed under the MIT license.
FAQs
Utilities for string case conversion.
We found that casefy demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
The Socket research team breaks down a sampling of malicious packages that download and execute files, among other suspicious behaviors, targeting the popular Discord platform.
Security News
Socket CEO Feross Aboukhadijeh joins a16z partners to discuss how modern, sophisticated supply chain attacks require AI-driven defenses and explore the challenges and solutions in leveraging AI for threat detection early in the development life cycle.
Security News
NIST's new AI Risk Management Framework aims to enhance the security and reliability of generative AI systems and address the unique challenges of malicious AI exploits.