Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hable

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hable - npm Package Compare versions

Comparing version 1.0.1 to 2.0.0

14

CHANGELOG.md

@@ -5,2 +5,16 @@ # Change Log

# [2.0.0](https://github.com/jsless/hable/compare/v1.0.1...v2.0.0) (2019-08-21)
### Features
* custom logger ([ada6e37](https://github.com/jsless/hable/commit/ada6e37))
### BREAKING CHANGES
* console is replaced by consola by default
## [1.0.1](https://github.com/jsless/hable/compare/v1.0.0...v1.0.1) (2019-03-16)

@@ -7,0 +21,0 @@

11

lib/hookable.js

@@ -1,7 +0,6 @@

const { serial } = require('items-promise')
const consola = require('consola')
const { flatHooks } = require('./utils')
const { serial, flatHooks } = require('./utils')
module.exports = class Hookable {
constructor () {
constructor (logger = console) {
this.logger = logger
this._hooks = {}

@@ -20,3 +19,3 @@ this._deprecatedHooks = {}

if (this._deprecatedHooks[name]) {
consola.warn(`${name} hook has been deprecated, please use ${this._deprecatedHooks[name]}`)
this.logger.warn(`${name} hook has been deprecated, please use ${this._deprecatedHooks[name]}`)
name = this._deprecatedHooks[name]

@@ -48,3 +47,3 @@ }

name !== 'error' && await this.callHook('error', err)
consola.error(err)
this.logger.error(err)
}

@@ -51,0 +50,0 @@ }

@@ -13,1 +13,5 @@ exports.flatHooks = function flatHooks (configHooks, hooks = {}, parentName) {

}
exports.serial = function serial (tasks, fn) {
return tasks.reduce((promise, task) => promise.then(previous => fn(task, previous)), Promise.resolve(null))
}
{
"name": "hable",
"version": "1.0.1",
"version": "2.0.0",
"description": "Awaitable hooks for Node.js",

@@ -29,6 +29,2 @@ "license": "MIT",

},
"dependencies": {
"consola": "^2.4.0",
"items-promise": "^1.0.0"
},
"devDependencies": {

@@ -35,0 +31,0 @@ "codecov": "^3.0.0",

@@ -36,2 +36,4 @@ # Hable

super()
// Initialize Hookable with custom logger
// super(consola)
}

@@ -66,3 +68,12 @@

### `constructor(logger)`
Custom logger. Default logger is `console` but you can use your own or [consola](https://github.com/nuxt/consola).
It should be an object implementing following functions:
- log
- warn
- error
- debug
### `hook (name, fn)`

@@ -69,0 +80,0 @@

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