Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

style-to-object

Package Overview
Dependencies
Maintainers
1
Versions
20
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.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7.7M
increased by0.51%
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

FAQs

Package last updated on 11 Sep 2024

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc