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

alphanum-compare

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alphanum-compare

Compare alphanumeric strings

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

alphanum-compare

Node.js CI codecov Known Vulnerabilities FOSSA Status

Compare function extrated from alphanum-sort. It can be used as compareFunction in Array.prototype.sort().

Install

yarn add alphanum-compare

Usage

import compareFn from "alphanum-compare";

const result = ["item20", "item19", "item1", "item10", "item2"].sort(compareFn);
// ['item1', 'item2', 'item10', 'item19', 'item20']

compareFn(a: string, b: string, opts?: { sign?: boolean }): number

It returns a negative value if first argument is less than second argument, zero if they're equal and a positive value otherwise.

Options
  • sign?: boolean: Allows + and - characters before numbers. (Default: false)

License

FOSSA Status

Keywords

FAQs

Package last updated on 12 Oct 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