Socket
Socket
Sign inDemoInstall

superscript-number

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    superscript-number

Converts a number to superscript format


Version published
Weekly downloads
56
increased by21.74%
Maintainers
1
Install size
4.53 kB
Created
Weekly downloads
 

Readme

Source

superscript-number

Converts a number to a superscript unicode character.

Example

var super = require('superscript-number')

console.log(super(1052))
console.log(super(-66))
console.log(super(1e32))
console.log(super(Infinity))
console.log(super(NaN))
console.log(super(-Infinity))

Output:

¹⁰⁵²
⁻⁶⁶
¹ᵉ⁺³²
⁺ᴵⁿᶠ
ᴺᵃᴺ
⁻ᴵⁿᶠ

Not the prettiest kerning in the world, but it works :shrug:

Install

npm i superscript-number

API

var str = require('superscript-number')(x[, base])

Converts a number to a superscript string

  • x is a number
  • base is an integer between 2 and 36 represeting the base of the output

Returns a superscript string printing out x

License

(c) 2015 Mikola Lysenko. MIT License.

Keywords

FAQs

Last updated on 24 Feb 2015

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.

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