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

tinspector

Package Overview
Dependencies
Maintainers
1
Versions
194
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tinspector - npm Package Compare versions

Comparing version 2.2.8 to 2.2.9

3

lib/index.d.ts

@@ -83,2 +83,5 @@ import "reflect-metadata";

})[];
export declare function getMethodParameters(fn: Class, method: string): (string | {
[key: string]: string[];
})[];
export declare function getConstructorParameters(fn: Class): (string | {

@@ -85,0 +88,0 @@ [key: string]: string[];

24

lib/index.js

@@ -51,6 +51,5 @@ "use strict";

function getParameterNames(fn) {
const body = fn.toString();
const src = !body.startsWith("function") ? "function " + body : body;
try {
const ast = acorn_1.parse(src);
const body = fn.toString();
const ast = acorn_1.parse(body);
return getNamesFromAst(ast.body[0].params);

@@ -63,2 +62,9 @@ }

exports.getParameterNames = getParameterNames;
function getMethodParameters(fn, method) {
const body = fn.toString();
const ast = acorn_1.parse(body);
const ctor = getNode(ast, x => x.type === "MethodDefinition" && x.kind === "method" && x.key.name === method);
return getNamesFromAst(ctor ? ctor.value.params : []);
}
exports.getMethodParameters = getMethodParameters;
function getConstructorParameters(fn) {

@@ -286,9 +292,9 @@ const body = fn.toString();

function reflectMethod(clazz, method, iterator) {
const parType = Reflect.getOwnMetadata(exports.DESIGN_PARAMETER_TYPE, clazz.prototype, method.name) || [];
const rawReturnType = Reflect.getOwnMetadata(exports.DESIGN_RETURN_TYPE, clazz.prototype, method.name);
const parameters = getParameterNames(method).map((x, i) => reflectParameter(x, parType[i], iterator("Parameter", method.name, i)));
const decorators = iterator("Method", method.name);
const parType = Reflect.getOwnMetadata(exports.DESIGN_PARAMETER_TYPE, clazz.prototype, method) || [];
const rawReturnType = Reflect.getOwnMetadata(exports.DESIGN_RETURN_TYPE, clazz.prototype, method);
const parameters = getMethodParameters(clazz, method).map((x, i) => reflectParameter(x, parType[i], iterator("Parameter", method, i)));
const decorators = iterator("Method", method);
const returnType = getReflectionType(decorators, rawReturnType);
const typeClassification = getTypeClassification(returnType);
return { kind: "Method", name: method.name, parameters, decorators, returnType, typeClassification };
return { kind: "Method", name: method, parameters, decorators, returnType, typeClassification };
}

@@ -308,3 +314,3 @@ function reflectProperty(name, typeAnnotation, des, iterator) {

if (des && typeof des.value === "function" && !des.get && !des.set) {
return reflectMethod(clazz, clazz.prototype[name], iterator);
return reflectMethod(clazz, name, iterator);
}

@@ -311,0 +317,0 @@ else {

{
"name": "tinspector",
"version": "2.2.8",
"version": "2.2.9",
"description": "TypeScript type inspector",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

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