Socket
Socket
Sign inDemoInstall

bootme

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bootme - npm Package Compare versions

Comparing version 0.0.27 to 0.0.28

.nyc_output/4e9bda445a4440f2644e081dc2bc62e0.json

53

lib/task.js

@@ -58,2 +58,8 @@ 'use strict'

*/
async action() {}
/**
*
*
* @memberof Task
*/
async init() {}

@@ -121,3 +127,3 @@ /**

*/
action(fn) {
setAction(fn) {
if (typeof fn !== 'function') {

@@ -137,22 +143,32 @@ throw new TypeError(

*
* @param {any} name
* @param {any} fn
* @memberof Task
*/
addHook(name, fn) {
if (typeof fn !== 'function' && !(fn instanceof Task)) {
setInit(fn) {
if (typeof fn !== 'function') {
throw new TypeError(
`Task <${this.constructor.name}:${this
.name}> Hook handler of must be a function or Task instance`
.name}> Init handler must be a function`
)
}
if (supportedHooks.indexOf(name) === -1) {
this.init = fn
return this
}
/**
*
*
* @param {any} fn
* @memberof Task
*/
setRollback(fn) {
if (typeof fn !== 'function') {
throw new TypeError(
`Task <${this.constructor.name}:${this
.name}> Hook "${name}" not supported!`
.name}> Rollback handler must be a function`
)
}
this[name].push(fn)
this.rollback = fn

@@ -164,17 +180,24 @@ return this

*
* @param {any} queue
* @returns
* @param {any} name
* @param {any} fn
* @memberof Task
*/
async start(queue) {
if (typeof this.action !== 'function') {
addHook(name, fn) {
if (typeof fn !== 'function' && !(fn instanceof Task)) {
throw new TypeError(
`Task <${this.constructor.name}:${this
.name}> Action must be a function. Actual ${typeof this.action}`
.name}> Hook handler of must be a function or Task instance`
)
}
const result = await this.action(queue)
if (supportedHooks.indexOf(name) === -1) {
throw new TypeError(
`Task <${this.constructor.name}:${this
.name}> Hook "${name}" not supported!`
)
}
return result
this[name].push(fn)
return this
}

@@ -181,0 +204,0 @@ /**

{
"name": "bootme",
"version": "0.0.27",
"version": "0.0.28",
"description": "",
"main": "index.js",
"scripts": {
"test": "tap -j4 \"test/*.test.js\" \"test/*/*.test.js\""
"test": "tap -j4 \"test/*.test.js\" \"test/*/*.test.js\" --coverage",
"coverage": "npm run test -- --cov --coverage-report=html"
},

@@ -22,2 +23,5 @@ "keywords": [

},
"engines": {
"node": ">=8"
},
"homepage": "https://github.com/StarpTech/bootme#readme",

@@ -29,4 +33,5 @@ "dependencies": {

"devDependencies": {
"delay": "^2.0.0",
"tap": "^10.7.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