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 1.4.0-alpha.b123904d to 1.4.0-alpha.caa0578b

47

lib/index.js
"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
//version 1.3.0
//github https://github.com/ktutnik/my-own-reflect
require("reflect-metadata");
const debug_1 = tslib_1.__importDefault(require("debug"));
const util_1 = require("util");
const chalk_1 = tslib_1.__importDefault(require("chalk"));
/*
version history:
1.3.0: added property reflection
1.2.0: added decorator reflection
1.1.0:
1.0.0: initial
*/
const log = debug_1.default("tinspector");
exports.DECORATOR_KEY = "plumier.key:DECORATOR";

@@ -85,2 +91,9 @@ exports.DESIGN_PARAMETER_TYPE = "design:paramtypes";

exports.getDecorators = getDecorators;
function b(value) {
if (typeof value === "object") {
return chalk_1.default.blue(util_1.inspect(value));
}
else
return chalk_1.default.blue(value);
}
/* ---------------------------------------------------------------- */

@@ -101,2 +114,3 @@ /* ------------------------- MAIN FUNCTIONS ----------------------- */

const parameters = getParameterNames(fn).map(x => reflectParameter(x));
log(`[Reflect Method] ${b(fn.name)}(${b(parameters)})`);
return { type: "Function", name: fn.name, parameters, decorators: [] };

@@ -107,2 +121,3 @@ }

const parameters = getParameterNames(method).map((x, i) => reflectParameter(x, parType[i]));
log(`[Reflect Method] ParType ${b(parType)} Method: ${b(clazz.name)}.${b(method.name)}(${b(parameters)})`);
return { type: "Function", name: method.name, parameters, decorators: [] };

@@ -112,8 +127,11 @@ }

const parTypes = Reflect.getMetadata(exports.DESIGN_PARAMETER_TYPE, fn) || [];
return getConstructorParameters(fn)
.map((x, i) => reflectParameter(x, parTypes[i]));
const params = getConstructorParameters(fn);
log(`[Reflect Ctor] ${b(params)}`);
return params.map((x, i) => reflectParameter(x, parTypes[i]));
}
function reflectClass(fn) {
log(`[Reflect Class] ${b(fn.name)} Properties: ${b(Object.getOwnPropertyNames(fn.prototype))}`);
const methods = Object.getOwnPropertyNames(fn.prototype)
.filter(x => x != "constructor")
.filter(x => !x.startsWith("__"))
.map(x => reflectMethod(fn, fn.prototype[x]));

@@ -149,8 +167,13 @@ const ctorParameters = reflectConstructorParameters(fn);

if (typeof option === "string") {
return Promise.resolve(Promise.resolve().then(() => __importStar(require(option))))
.then(object => reflectObject(object));
log(`Inspecting module ${b(option)}`);
return Promise.resolve(Promise.resolve().then(() => tslib_1.__importStar(require(option))))
.then(object => {
return reflectObject(object);
});
}
else
else {
log(`Inspecting class ${b(option.name)}`);
return reflectClass(option);
}
}
exports.reflect = reflect;
{
"name": "tinspector",
"version": "1.4.0-alpha.b123904d",
"version": "1.4.0-alpha.caa0578b",
"description": "TypeScript type inspector library",

@@ -12,4 +12,4 @@ "main": "lib/index.js",

"compile": "tsc -p tsconfig.build.json",
"package-prod": "node ../../.script/modify-package.js production",
"package-dev": "node ../../.script/modify-package.js"
"package-prod": "node ../../.script/modify-package production",
"package-dev": "node ../../.script/modify-package"
},

@@ -19,10 +19,13 @@ "author": "Ketut Sandiarsa",

"dependencies": {
"@types/debug": "^0.0.30",
"chalk": "^2.4.1",
"debug": "^3.1.0",
"reflect-metadata": "^0.1.12"
},
"devDependencies": {
"@types/ejs": "^2.6.0",
"benalu": "^2.0.0-beta-1",
"edit-json-file": "^1.0.8",
"json": "^9.0.6"
"ejs": "^2.6.1"
},
"types": "lib/index.d.ts"
}
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