@supercharge/numbers

Extended Number utilities for Node.js and JavaScript

Usage no npm install needed!

<script type="module">
  import superchargeNumbers from 'https://cdn.skypack.dev/@supercharge/numbers';
</script>

README



Numbers

Number utilities for Node.js and JavaScript


Installation · Docs · Usage



Latest Version Monthly downloads

Follow @marcuspoehls and @superchargejs for updates!


Introduction

The @supercharge/numbers package extends JavaScripthttps://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Numbers Number class to provide additional helper methods when working with numbers, like generating a random number in a given range.

Installation

npm i @supercharge/numbers

Docs

Find all the details for @supercharge/numbers in the extensive Supercharge docs.

Usage

Using @supercharge/numbers is pretty straightforward. Use the exposed static methods directly from the imported package:

const Num = require('@supercharge/numbers')

Num.randomInt(0, 10)
// 10
// randomInt returns a number from 0 to 10 (inclusive start and end)

Num.randomIntBetween(0, 10)
// 4
// randomIntBetween returns a number from 1 to 9 (exclusive start and end)

Contributing

Do you miss a string function? We very much appreciate your contribution! Please send in a pull request 😊

  1. Create a fork
  2. Create your feature branch: git checkout -b my-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request 🚀

License

MIT © Supercharge


superchargejs.com  ·  GitHub @superchargejs  ·  Twitter @superchargejs