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

hookie

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hookie

Simple function lifecycle hooks

  • 0.1.1
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Hookie

Simple function lifecycle hooks. Creates functions that call named hooks before and after each function calls.

Hookie(name, func, options)

Creates a wrapped function that will call hooks before and after it is called.

Example

var person = {
  beforeSlap: function () { log('before') },

  slap: Hookie('slap', function (name) {
    log('slap!')
  }),

  afterSlap: function () { log('after') }
}

person.slap()
// before
// slap!
// after

Options

type

default value: 'Prefix' Possible values: 'prefix', 'postfix'

Changes where hook term is placed in terms of the hook name.

Hookie(name, func, { type: 'postfix' })

capitalize

default value: true Possible values: true, false

Switch that decides whether callback functions have a captalized naming scheme.

Hookie(name, func, { capitalize: true })

before

default value: 'before'

Defines the term used when building the before-hook name.

Hookie(name, func, { before: 'pre' })

after

default value: 'after'

Defines the term used when building the after-hook name.

Hookie(name, func, { after: 'post' })

FAQs

Package last updated on 07 May 2015

Did you know?

Socket

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.

Install

Related posts

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