
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
is-css-unit
Advanced tools
Check if a given value contains a valid CSS unit
npm install --save is-css-unit
const isCSSUnit = require('is-css-unit').isCSSUnit;
console.log(isCSSUnit('300px'))
// => true
console.log(isCSSUnit('10bark'))
// => false
If you need more specific checks, you can require different functions:
isFontUnit
: checks for all relative font units (em
, ex
, ch
, rem
)isViewportUnit
: checks for all viewport units (vw
, vh
, vmin
, vmax
)isAbsoluteUnit
: checks for all absolute units (cm
, mm
, q
, in
, pt
, pc
, px
)isAngleUnit
: checks for all angle units (deg
, grad
, rad
, turn
)isDurationUnit
: checks for all duration units (s
, ms
)isFrequencyUnit
: checks for all frequency units (Hz
, kHz
)isResolutionUnit
: checks for all resolution units (dpi
, dpcm
, dppx
)is-css-unit
is licensed under the MIT License
FAQs
Check if a given value contains a valid CSS unit
The npm package is-css-unit receives a total of 624 weekly downloads. As such, is-css-unit popularity was classified as not popular.
We found that is-css-unit demonstrated a not healthy version release cadence and project activity because the last version was released 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
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.