Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
random-stuff-js
Advanced tools
Readme
A library that provides some random but very useful functions that are commonly used in most javascript projects.
To install random-stuff-js
# with npm:
npm install random-stuff-js --save
# with yarn:
yarn add random-stuff-js
# with pnpm:
pnpm add random-stuff-js
# with bun:
bun add random-stuff-js
random-stuff-js
can be used in almost any javascript project to achieve the above mentioned features with no extra effort. The functions provided by random-stuff-js
may be categorised into 3 categories:
import { randomNumber, randomElement, randomAdjective, randomAnimal, randomName, generateOTP } from 'random-stuff-js';
console.log(randomNumber(10, 20)) // Any number between 10 and 20 (both numbers included) will be logged
console.log(randomElement([3, 2, 10, 7, 8])) // Any one random element of the array will be logged
console.log(randomAdjective()) // Any one adjective from a list of 25 adjective will be logged
console.log(randomAnimal()) // Any one animal from a list of 200 animals will be logged
console.log(randomName('-')) // A combination of randomAdjective() and randomAnimal() will be logged with a '-' separator in between. Default separator is ' '
console.log(generateOTP(6)) // A 6 digit string OTP will be logged
import { probability, minimumNumber, maximumNumber } from 'random-stuff-js';
if (probability(0.5)) console.log(true) // There is a 50% chance that true will be logged
const array = [89, 6, 99, 2, 50, 10]
console.log(minimumNumber(array)) // 2
console.log(maximumNumber(array)) // 99
import { wait } from 'random-stuff-js';
async function test(time) {
const ref = Date.now()
await wait(time)
return Date.now() - ref
}
test(1000).then(time => console.log(time)) // ~1000
FAQs
An easy to use library export random javascript stuff for doing useful things.
We found that random-stuff-js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).