Socket
Socket
Sign inDemoInstall

uuid-cron

Package Overview
Dependencies
55
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.6 to 1.1.0

.eslintignore

31

package.json
{
"name": "uuid-cron",
"version": "1.0.6",
"description": "",
"main": "src/index.js",
"version": "1.1.0",
"description": "uuid-cron",
"main": "index.js",
"repository": {

@@ -11,13 +11,18 @@ "type": "git",

"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"lint": "eslint . --ext .js",
"lint-fix": "eslint . --ext .js --fix",
"start": "./src/index.js"
"start": "npm run build && npm run serve",
"serve": "node dist/index.js",
"clean": "rimraf coverage build tmp",
"build": "tsc -p tsconfig.release.json",
"build:watch": "tsc -w -p tsconfig.release.json",
"lint": "eslint . --ext .ts,.tsx",
"lint-fix": "eslint . --ext .ts,.tsx --fix",
"test": "jest --coverage",
"test:watch": "jest --watch"
},
"keywords": [],
"author": "",
"license": "ISC",
"license": "MIT",
"dependencies": {
"cron": "1.8.2",
"express": "^4.17.1",
"express": "4.17.1",
"human-to-cron": "0.3.1",

@@ -27,6 +32,12 @@ "uuid": "8.3.2"

"devDependencies": {
"@types/jest": "^27.0.2",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"eslint": "^8.0.1",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-plugin-import": "^2.25.2"
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-jest": "^25.2.1",
"jest": "^27.2.5",
"ts-jest": "^27.0.7"
}
}
# uuid-cron
Generate random uuids in a given time
# Quickstart
# Getting Started

@@ -13,13 +13,12 @@ **1. Install**

const { init, uuidv4CronLimited, stop } = require('uuid-cron');
// run cron job every 20 seconds with 30 random uuids each time.
// for the first param, read for more details: https://www.npmjs.com/package/human-to-cron
init('each 20 seconds', 30);
// for the first param, read cron syntax here: https://www.npmjs.com/package/human-to-cron
init('each 20 seconds');
```
**3. Get random uuid according to the init params**
**3. uuidv4Cron() will return random uuid every 20 seconds**
```javascript
const randomUUID = uuidv4CronLimited();
const randomUUID = uuidv4Cron();
```
**4. stop the cron job on finish**
**4. On finish, stop the cron job, otherwise it will continue infinitely**
```javascript

@@ -29,1 +28,10 @@ stop();

### Limit the number of random uuids
use uuidv4CronLimited to control the number of uuids generated in each cron job
```javascript
init('each 20 seconds', 30);
// each 20 second generate 30 random uuids and return one of them each time
const limitedRandomUUIDS = uuidv4CronLimited();
```
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