You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@discordx/internal

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@discordx/internal - npm Package Compare versions

Comparing version

to
1.1.2

6

CHANGELOG.md
# @discordx/internal
## 1.1.2
### Patch Changes
- lint
## 1.1.1

@@ -4,0 +10,0 @@

72

dist/index.d.ts

@@ -86,3 +86,3 @@ /**

*/
static applyFromModifierListToList(modifiers: Modifier[], originals: Decorator[]): Promise<void[]>;
static applyFromModifierListToList(modifiers: Modifier[], originals: Decorator[]): Promise<void>;
/**

@@ -97,40 +97,34 @@ * Applies modifications to the specified decorator.

/**
* Utility class for decorator operations.
* @category Internal
* Gets the list of decorators linked to a specified decorator.
* @example
* ```typescript
* @A()
* @B()
* method() {}
* ```
* @example
* ```typescript
* method(
* @A()
* @B()
* param: string
* ) {}
* ```
* @example
* ```typescript
* @A()
* @B()
* class X {}
* ```
* @param a - The reference decorator.
* @param list - The list of decorators to filter.
* @returns The list of linked decorators.
*/
declare class DecoratorUtils {
/**
* Gets the list of decorators linked to a specified decorator.
* @example
* ```typescript
* @A()
* @B()
* method() {}
* ```
* @example
* ```typescript
* method(
* @A()
* @B()
* param: string
* ) {}
* ```
* @example
* ```typescript
* @A()
* @B()
* class X {}
* ```
* @param a - The reference decorator.
* @param list - The list of decorators to filter.
* @returns The list of linked decorators.
*/
static getLinkedObjects<Type extends Decorator>(a: Decorator, list: Type[]): Type[];
/**
* Determines if the target is a class based on the method descriptor.
* @param method - The method descriptor.
* @returns True if the target is a class, false otherwise.
*/
static decorateAClass(method?: PropertyDescriptor): boolean;
}
declare function getLinkedObjects<Type extends Decorator>(a: Decorator, list: Type[]): Type[];
/**
* Determines if the target is a class based on the method descriptor.
* @param method - The method descriptor.
* @returns True if the target is a class, false otherwise.
*/
declare function decorateAClass(method?: PropertyDescriptor): boolean;

@@ -143,2 +137,2 @@ type ClassDecoratorEx = (target: Record<string, any>, propertyKey?: undefined, descriptor?: undefined) => void;

export { type ClassDecoratorEx, type ClassMethodDecorator, type Constructor, Decorator, DecoratorUtils, type MethodDecoratorEx, Modifier, type ModifyFunction, type ParameterDecoratorEx, type PropertyDecorator };
export { type ClassDecoratorEx, type ClassMethodDecorator, type Constructor, Decorator, type MethodDecoratorEx, Modifier, type ModifyFunction, type ParameterDecoratorEx, type PropertyDecorator, decorateAClass, getLinkedObjects };

@@ -24,4 +24,5 @@ "use strict";

Decorator: () => Decorator,
DecoratorUtils: () => DecoratorUtils,
Modifier: () => Modifier
Modifier: () => Modifier,
decorateAClass: () => decorateAClass,
getLinkedObjects: () => getLinkedObjects
});

@@ -31,47 +32,14 @@ module.exports = __toCommonJS(src_exports);

// src/decorator/util.ts
var DecoratorUtils = class {
/**
* Gets the list of decorators linked to a specified decorator.
* @example
* ```typescript
* @A()
* @B()
* method() {}
* ```
* @example
* ```typescript
* method(
* @A()
* @B()
* param: string
* ) {}
* ```
* @example
* ```typescript
* @A()
* @B()
* class X {}
* ```
* @param a - The reference decorator.
* @param list - The list of decorators to filter.
* @returns The list of linked decorators.
*/
static getLinkedObjects(a, list) {
return list.filter((b) => {
let cond = a.from === b.from && a.key === b.key;
if (a.index !== void 0 && b.index !== void 0) {
cond &&= a.index === b.index;
}
return cond;
});
}
/**
* Determines if the target is a class based on the method descriptor.
* @param method - The method descriptor.
* @returns True if the target is a class, false otherwise.
*/
static decorateAClass(method) {
return !method?.value;
}
};
function getLinkedObjects(a, list) {
return list.filter((b) => {
let cond = a.from === b.from && a.key === b.key;
if (a.index !== void 0 && b.index !== void 0) {
cond &&= a.index === b.index;
}
return cond;
});
}
function decorateAClass(method) {
return !method?.value;
}

@@ -137,6 +105,6 @@ // src/decorator/classes/Decorator.ts

decorateUnknown(classRef, key, method, index) {
const decorateAClass = DecoratorUtils.decorateAClass(method) && index === void 0;
const finalClassRef = decorateAClass ? classRef : classRef.constructor;
const finalKey = decorateAClass ? finalClassRef.name : key;
const finalMethod = decorateAClass ? finalClassRef : method?.value;
const decoratedClass = decorateAClass(method) && index === void 0;
const finalClassRef = decoratedClass ? classRef : classRef.constructor;
const finalKey = decoratedClass ? finalClassRef.name : key;
const finalMethod = decoratedClass ? finalClassRef : method?.value;
return this.decorate(

@@ -199,5 +167,5 @@ finalClassRef,

static async applyFromModifierListToList(modifiers, originals) {
return Promise.all(
await Promise.all(
modifiers.map(async (modifier) => {
let linked = DecoratorUtils.getLinkedObjects(modifier, originals);
let linked = getLinkedObjects(modifier, originals);
linked = linked.filter(

@@ -226,4 +194,5 @@ (linkedOriginal) => modifier._modifyTypes.some((type) => linkedOriginal instanceof type)

Decorator,
DecoratorUtils,
Modifier
Modifier,
decorateAClass,
getLinkedObjects
});
{
"name": "@discordx/internal",
"version": "1.1.1",
"version": "1.1.2",
"private": false,

@@ -5,0 +5,0 @@ "description": "discordx internal methods, can be used for external projects",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet