Product
Introducing Java Support in Socket
We're excited to announce that Socket now supports the Java programming language.
lowercase-keys
Advanced tools
The lowercase-keys npm package is designed to convert the keys of an object to lowercase. It is a simple utility that can be particularly useful when dealing with data that may have inconsistent capitalization in its keys and you need to ensure uniformity for processing or matching purposes.
Lowercase Object Keys
This feature allows you to convert all keys in an object to lowercase. It's particularly useful for normalizing data received from different sources that may not adhere to a consistent capitalization scheme.
{"const lowercaseKeys = require('lowercase-keys');\nconst myObj = {'Name': 'John', 'AGE': 30, 'Country': 'USA'};\nconst lowercasedObj = lowercaseKeys(myObj);\nconsole.log(lowercasedObj); // Output: { name: 'John', age: 30, country: 'USA' }"}
Similar to lowercase-keys, camelcase-keys converts the keys in an object to camelCase. It's useful for situations where camelCase is the desired or required key format, providing a different kind of normalization compared to lowercase-keys.
This package converts object keys to snake_case. It serves a similar purpose to lowercase-keys in terms of normalizing key names, but it targets a different naming convention, offering flexibility depending on the specific case format needs.
Lowercase the keys of an object
Check out map-obj
if you need support for deep iteration.
npm install lowercase-keys
import lowercaseKeys from 'lowercase-keys';
lowercaseKeys({FOO: true, bAr: false});
//=> {foo: true, bar: false}
Returns a new object with the keys lowercased.
Available as part of the Tidelift Subscription.
The maintainers of lowercase-keys and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.
FAQs
Lowercase the keys of an object
We found that lowercase-keys demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Product
We're excited to announce that Socket now supports the Java programming language.
Security News
Socket detected a malicious Python package impersonating a popular browser cookie library to steal passwords, screenshots, webcam images, and Discord tokens.
Security News
Deno 2.0 is now available with enhanced package management, full Node.js and npm compatibility, improved performance, and support for major JavaScript frameworks.