Socket
Socket
Sign inDemoInstall

camelcase-css

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    camelcase-css

Convert a kebab-cased CSS property into a camelCased DOM property.


Version published
Weekly downloads
9.3M
increased by3.22%
Maintainers
1
Install size
4.99 kB
Created
Weekly downloads
 

Package description

What is camelcase-css?

The camelcase-css npm package is designed to convert CSS property names from kebab-case to camelCase. This is particularly useful when working with CSS in JavaScript, such as when using inline styles in React components or when manipulating CSS properties through JavaScript. By converting CSS property names to camelCase, it aligns with the JavaScript naming conventions and allows for a more seamless integration of CSS styles within JavaScript code.

What are camelcase-css's main functionalities?

Converting CSS property names

This feature allows you to convert any CSS property from kebab-case to camelCase. For example, if you have a CSS property like 'margin-top', using camelcase-css, you can easily convert it to 'marginTop' which is the format expected by JavaScript for setting CSS properties.

"margin-top" => "marginTop"

Batch conversion of CSS properties

In addition to converting individual CSS property names, camelcase-css can also handle objects containing multiple CSS properties. This is particularly useful when you have an object representing a style (e.g., for inline styles in React) and you need to ensure all property names are in camelCase.

{ 'margin-top': '20px', 'text-align': 'center' } => { marginTop: '20px', textAlign: 'center' }

Other packages similar to camelcase-css

Readme

Source

camelcase-css NPM Version Build Status

Convert a kebab-cased CSS property into a camelCased DOM property.

Installation

Node.js >= 6 is required. Type this at the command line:

npm install camelcase-css

Usage

const camelCaseCSS = require('camelcase-css');

camelCaseCSS('-webkit-border-radius');  //-> WebkitBorderRadius
camelCaseCSS('-moz-border-radius');     //-> MozBorderRadius
camelCaseCSS('-ms-border-radius');      //-> msBorderRadius
camelCaseCSS('border-radius');          //-> borderRadius

Keywords

FAQs

Last updated on 11 Aug 2018

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc