Socket
Socket
Sign inDemoInstall

@emotion/is-prop-valid

Package Overview
Dependencies
1
Maintainers
4
Versions
35
Alerts
File Explorer

Advanced tools

Install Socket

Protect your apps from supply chain attacks

Install

@emotion/is-prop-valid

A function to check whether a prop is valid for HTML and SVG elements

    1.2.1latest
    GitHub
    npm

Version published
Maintainers
4
Weekly downloads
12,483,053
increased by3.09%

Weekly downloads

Package description

What is @emotion/is-prop-valid?

The @emotion/is-prop-valid package is a utility for checking if a given property is a valid HTML or SVG attribute. It is commonly used in CSS-in-JS libraries, such as Emotion, to filter out props that should not be passed to DOM elements to avoid React warnings about unknown DOM props.

What are @emotion/is-prop-valid's main functionalities?

Checking HTML validity of a prop

This feature allows you to check if a prop is a valid HTML attribute. It returns true for valid attributes like 'onClick' and false for non-standard or invalid attributes like 'randomPropName'.

import isPropValid from '@emotion/is-prop-valid';

console.log(isPropValid('onClick')); // true
console.log(isPropValid('randomPropName')); // false

Checking SVG validity of a prop

This feature allows you to check if a prop is a valid SVG attribute. It returns true for valid attributes like 'viewBox' and false for non-standard or invalid attributes like 'randomSVGProp'.

import isPropValid from '@emotion/is-prop-valid';

console.log(isPropValid('viewBox')); // true
console.log(isPropValid('randomSVGProp')); // false

Other packages similar to @emotion/is-prop-valid

Readme

Source

@emotion/is-prop-valid

Check whether a prop is valid for HTML and SVG elements

yarn add @emotion/is-prop-valid
import isPropValid from '@emotion/is-prop-valid'

isPropValid('href') // true

isPropValid('someRandomProp') // false

FAQs

Last updated on 06 May 2023

Did you know?

Socket installs a GitHub app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the 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