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

parse-numeric-range

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parse-numeric-range

Takes a string, such as "1,2,3-10,5-8" and turns it into an array of numbers

  • 1.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
630K
increased by13.06%
Maintainers
1
Weekly downloads
 
Created

What is parse-numeric-range?

The parse-numeric-range npm package is a utility for parsing numeric ranges from strings. It can handle individual numbers, ranges, and combinations of both, making it useful for scenarios where you need to interpret and work with numeric ranges from user input or configuration files.

What are parse-numeric-range's main functionalities?

Parse Single Numbers

This feature allows you to parse a single number from a string and returns it as an array containing that number.

const parse = require('parse-numeric-range');
const result = parse('5');
console.log(result); // [5]

Parse Ranges

This feature allows you to parse a range of numbers from a string and returns an array containing all the numbers in that range.

const parse = require('parse-numeric-range');
const result = parse('1-5');
console.log(result); // [1, 2, 3, 4, 5]

Parse Combinations of Numbers and Ranges

This feature allows you to parse a combination of individual numbers and ranges from a string, returning an array containing all the specified numbers.

const parse = require('parse-numeric-range');
const result = parse('1-3,5,7-9');
console.log(result); // [1, 2, 3, 5, 7, 8, 9]

Other packages similar to parse-numeric-range

Keywords

FAQs

Package last updated on 22 Aug 2021

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