Security News
ESLint is Now Language-Agnostic: Linting JSON, Markdown, and Beyond
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
hyphenate-style-name
Advanced tools
The hyphenate-style-name package is a small, focused utility designed for converting JavaScript style object keys from camelCase to hyphenated-case. This is particularly useful when working with CSS in JavaScript solutions, where you might need to convert style objects into a format that can be used directly in stylesheets or inline styles.
Hyphenating Style Names
Converts JavaScript style object keys from camelCase (e.g., 'marginLeft') to hyphenated-case (e.g., 'margin-left'). This is useful for dynamically generating CSS styles in JavaScript.
"marginLeft" => "margin-left"
Similar to hyphenate-style-name, camelcase-css converts CSS property names between camelCase and hyphenated-case. While hyphenate-style-name focuses on converting from camelCase to hyphenated-case, camelcase-css offers conversion in both directions, making it a bit more flexible depending on the user's needs.
change-case is a more comprehensive string manipulation library that includes functionality for transforming strings into various cases, including camel case, snake case, kebab case, and more. Compared to hyphenate-style-name, which is specialized for style names, change-case offers a broader range of string manipulation tools, making it suitable for a wider variety of applications beyond just CSS property names.
Hyphenates a camelcased CSS property name. For example:
backgroundColor
=> background-color
MozTransition
=> -moz-transition
msTransition
=> -ms-transition
color
=> color
$ npm install --save hyphenate-style-name
import hyphenateStyleName from 'hyphenate-style-name'
console.log(hyphenateStyleName('MozTransition')) // -moz-transition
BSD-3-Clause licensed. See LICENSE.
FAQs
Hyphenates a camelcased CSS property name
We found that hyphenate-style-name 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.
Security News
ESLint has added JSON and Markdown linting support with new officially-supported plugins, expanding its versatility beyond JavaScript.
Security News
Members Hub is conducting large-scale campaigns to artificially boost Discord server metrics, undermining community trust and platform integrity.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.