New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

around

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

around

Aspect oriented programming for JavaScript

  • 0.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
increased by50%
Maintainers
1
Weekly downloads
 
Created
Source

around.js

A prototype-aware AOP library

Motivation

Aspect oriented programming (AOP) is a programming methodology that tries to address the common issue of similar code being created in several files. This violates the basic DRY principle, and especially common for operations like logging, profiling, and error handling.

The solution was to create the ability to cut a function before, after, and around it. This allows you to modify the function without changing it making it more modular and reusable.

Read more on wikipedia.

API

around.extend()

Call this method to extend Function.prototype with
`around`, `before`, and `after` methods

fn.around(fnBefore, fnAfter)

Return a function that cuts before and after the function
being extended.

fn            The function being extended
fnBefore      The function called before fn
fnAfter       The function called after fn

fn.before(fnBefore)

Return a function that cuts before the function being extended.

fn            The function being extended
fnBefore      The function called before fn

fn.after(fnAfter)

Return a function that cuts after the function being extended.

fn            The function being extended
fnBefore      The function called before fn
fnAfter       The function called after fn

Examples

Keywords

FAQs

Package last updated on 11 Oct 2013

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