0.0.2 • Published 9 years ago
sweeties v0.0.2
sweeties
Extensions for primitive JS types
Installation
$ npm install sweetiesUsage
const sweeties = require('sweeties')
sweeties()OR
require('sweeties')()Module does not export anything, so assigning require result to a variable would be pretty useless.
Extensions of Number
Static
random (min, max): Number
Generates random number between min and max.
Default value for min = 0, for max = Number.MAX_SAFE_INTEGER
Instance
between (min, max): Boolean
Returns true if reference number is between (non-inclusive) min and max, false otherwise.
Example:
let x = 5
x.between(1, 10) // true
x.between(5, 7) // falsebetweenIncl (min, max): Boolean
Returns true if reference number is between (inclusive) min and max, false otherwise.
Example:
let x = 5
x.between(1, 10) // true
x.between(5, 7) // trueisPositive (): Boolean
Returns true if reference number is bigger or equeals to 0 (eg. positive), false otherwise.
Example:
let x = 5
x.isPositive() // trueisNegative (): Boolean
Returns true if reference number is less than 0 (eg. negative), false otherwise.
Example:
let x = 5
x.isPositive() // false