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

@aloreljs/bound-decorator

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aloreljs/bound-decorator

A TypeScript/ES7 decorator for automatically binding methods to the class instance

  • 3.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
82
increased by24.24%
Maintainers
1
Weekly downloads
 
Created
Source

Bound decorator

An ES7 decorator for making class methods bound to the class instance (including statics).

MASTER CI status NPM badge dependencies badge Coverage Status


Table of Contents

Installation

npm install @aloreljs/bound-decorator

Compatibility

The library's only goal is to be compatible with Typescript 5 decorators which, at the time of writing, use the 2022-03 stage 3 decorators proposal.

Usage

import {BoundMethod} from '@aloreljs/bound-decorator';

class MyClass {
  
  @BoundMethod()
  method1() {
    // equivalent to
    // this.method1 = this.method1.bind(this);
  }
  
  @BoundMethod('a', 'b')
  method2(a, b, c) {
    // equivalent to
    // this.method2 = this.method2.bind(this, 'a', 'b');
  }

  @BoundMethod()
  static foo() {
    // Equivalent to
    // MyClass.foo = MyClass.foo.bind(MyClass);
  }
}

Keywords

FAQs

Package last updated on 07 Dec 2023

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