You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

style-to-object

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

style-to-object

Parse CSS inline style to JavaScript object.

1.0.9
latest
Source
npmnpm
Version published
Weekly downloads
10M
-1.68%
Maintainers
1
Weekly downloads
 
Created

What is style-to-object?

The style-to-object npm package is used to convert inline CSS style strings into JavaScript objects. This can be particularly useful when working with React or other JavaScript frameworks that expect style information to be provided as objects rather than strings.

What are style-to-object's main functionalities?

Convert CSS string to JavaScript object

This feature allows you to convert a CSS style string into a JavaScript object. The keys of the object are camelCased versions of the CSS property names, and the values are the corresponding CSS values as strings.

const styleToObject = require('style-to-object');
const styleString = 'color: red; font-size: 14px;';
const styleObject = styleToObject(styleString);
console.log(styleObject);

Other packages similar to style-to-object

Keywords

style-to-object

FAQs

Package last updated on 06 Jun 2025

Did you know?

Socket

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