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

is-hex-prefixed

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-hex-prefixed

A simple method to check if a string is hex prefixed.

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
555K
decreased by-0.9%
Maintainers
1
Weekly downloads
 
Created

What is is-hex-prefixed?

The is-hex-prefixed npm package is a simple utility to check if a given string is prefixed with '0x', which is commonly used to denote hexadecimal values.

What are is-hex-prefixed's main functionalities?

Check if a string is hex-prefixed

This feature allows you to check if a given string starts with the '0x' prefix, indicating that it is a hexadecimal value.

const isHexPrefixed = require('is-hex-prefixed');

const hexString = '0x123abc';
const result = isHexPrefixed(hexString);
console.log(result); // true

Check if a non-hex string is hex-prefixed

This feature allows you to verify that a string without the '0x' prefix is correctly identified as not being hex-prefixed.

const isHexPrefixed = require('is-hex-prefixed');

const nonHexString = '123abc';
const result = isHexPrefixed(nonHexString);
console.log(result); // false

Other packages similar to is-hex-prefixed

Keywords

FAQs

Package last updated on 06 Dec 2016

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