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

@supercharge/macroable

Package Overview
Dependencies
Maintainers
3
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@supercharge/macroable - npm Package Compare versions

Comparing version 2.0.0 to 2.0.1

8

dist/index.d.ts

@@ -6,4 +6,4 @@ /**

export interface MacroableCtor {
macro<T extends typeof Macroable>(this: T, name: string, callback: MacroFn): T;
flushMacros<T extends typeof Macroable>(this: T): T;
macro<T extends MacroableCtor>(this: T, name: string, callback: MacroFn): T;
flushMacros<T extends MacroableCtor>(this: T): T;
hasMacro(name: string): boolean;

@@ -28,3 +28,3 @@ }

*/
static macro<T extends typeof Macroable>(this: T, name: string, callback: MacroFn): T;
static macro<T extends MacroableCtor>(this: T, name: string, callback: MacroFn): T;
/**

@@ -56,4 +56,4 @@ * Ensures the given `name` and `callback` are valid macro values.

*/
static flushMacros<T extends typeof Macroable>(this: T): T;
static flushMacros<T extends MacroableCtor>(this: T): T;
}
export {};

@@ -18,6 +18,7 @@ 'use strict';

static macro(name, callback) {
this.validateMacro(name, callback);
const self = this;
self.validateMacro(name, callback);
// @ts-expect-error
this.prototype[name] = callback;
this.macros.set(name, callback);
self.prototype[name] = callback;
self.macros.set(name, callback);
return this;

@@ -63,6 +64,8 @@ }

static flushMacros() {
for (const key of this.macros.keys()) {
const self = this;
for (const key of self.macros.keys()) {
// @ts-expect-error
Reflect.deleteProperty(this.prototype, key);
}
this.macros = new Map();
self.macros = new Map();
return this;

@@ -69,0 +72,0 @@ }

{
"name": "@supercharge/macroable",
"description": "An elegant way to extend the prototype of ES6 classes",
"version": "2.0.0",
"version": "2.0.1",
"author": "Marcus Pöhls <marcus@superchargejs.com>",

@@ -6,0 +6,0 @@ "bugs": {

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