Socket
Socket
Sign inDemoInstall

@stackbit/utils

Package Overview
Dependencies
Maintainers
11
Versions
294
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stackbit/utils - npm Package Compare versions

Comparing version 0.1.2 to 0.2.0

__tests__/test.js

27

package.json
{
"name": "@stackbit/utils",
"version": "0.1.2",
"version": "0.2.0",
"description": "Stackbit utilities",
"main": "src/index.js",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test": "jest",
"build": "tsc",
"prettier": "prettier --write src",
"prepack": "npm test && npm run build",
"version-minor": "npm version minor -m \"bumped version to v%s\"",

@@ -17,3 +21,3 @@ "version-patch": "npm version patch -m \"bumped version to v%s\""

"stackbit",
"jamstack"
"utilities"
],

@@ -28,6 +32,15 @@ "author": "Stackbit Inc.",

"@iarna/toml": "^2.2.5",
"fs-extra": "^9.0.1",
"js-yaml": "^3.14.0",
"lodash": "^4.17.15"
"fs-extra": "^9.1.0",
"js-yaml": "^4.0.0",
"lodash": "^4.17.21"
},
"devDependencies": {
"@types/fs-extra": "^9.0.8",
"@types/js-yaml": "^4.0.0",
"@types/lodash": "^4.14.168",
"jest": "^26.6.3",
"prettier": "^2.2.1",
"ts-jest": "^26.5.4",
"typescript": "^4.2.3"
}
}
const _ = require('lodash');
let taskTagCounter = 0;
class Task {
constructor(job, tag) {
this.tag = tag || ('task-' + (taskTagCounter++));
this.tag = tag || 'task-' + taskTagCounter++;
this.promise = new Promise((resolve, reject) => {
this.run = function() {
this.run = function () {
return job().then(resolve, reject);

@@ -16,7 +14,5 @@ };

}
}
module.exports = class TaskQueue {
constructor(options) {

@@ -69,3 +65,6 @@ this.limit = _.get(options, 'limit', null);

if (this.debug) {
console.log(`[TaskQueue] task run count limit (${this.limit}) reached, queue size: ${this.taskQueue.length}, running tasks: ${this.runCount}, waiting for previous tasks to finish`);
console.log(
`[TaskQueue] task run count limit (${this.limit}) reached, queue size: ${this.taskQueue.length}, ` +
`running tasks: ${this.runCount}, waiting for previous tasks to finish`
);
}

@@ -85,3 +84,6 @@ }

if (this.debug) {
console.log(`[TaskQueue] task interval is less than allowed (${this.interval}) reached, queue size: ${this.taskQueue.length}, running tasks: ${this.runCount}, waiting for ${this.interval - diffMs}ms`);
console.log(
`[TaskQueue] task interval is less than allowed (${this.interval}) reached, queue size: ` +
`${this.taskQueue.length}, running tasks: ${this.runCount}, waiting for ${this.interval - diffMs}ms`
);
}

@@ -112,3 +114,2 @@ }

}
}
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc