Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@inversifyjs/prototype-utils

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@inversifyjs/prototype-utils - npm Package Compare versions

Comparing version
0.1.3
to
0.2.0-beta.0
+6
lib/index.d.ts
import { findInPrototypeChain } from './prototype/calculations/findInPrototypeChain.js';
import { getBaseType } from './prototype/calculations/getBaseType.js';
import { type Prototype } from './prototype/models/Prototype.js';
export type { Prototype };
export { findInPrototypeChain, getBaseType };
//# sourceMappingURL=index.d.ts.map
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AACtE,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE,YAAY,EAAE,SAAS,EAAE,CAAC;AAE1B,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,CAAC"}
import { findInPrototypeChain } from './prototype/calculations/findInPrototypeChain.js';
import { getBaseType } from './prototype/calculations/getBaseType.js';
export { findInPrototypeChain, getBaseType };
//# sourceMappingURL=index.js.map
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kDAAkD,CAAC;AACxF,OAAO,EAAE,WAAW,EAAE,MAAM,yCAAyC,CAAC;AAKtE,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,CAAC"}
import { type Newable } from '@inversifyjs/common';
export declare function findInPrototypeChain<T>(type: Newable, reader: (type: Newable) => T | undefined): T | undefined;
//# sourceMappingURL=findInPrototypeChain.d.ts.map
{"version":3,"file":"findInPrototypeChain.d.ts","sourceRoot":"","sources":["../../../src/prototype/calculations/findInPrototypeChain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAInD,wBAAgB,oBAAoB,CAAC,CAAC,EACpC,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,CAAC,GAAG,SAAS,GACvC,CAAC,GAAG,SAAS,CAcf"}
import { getBaseType } from './getBaseType.js';
export function findInPrototypeChain(type, reader) {
for (let currentType = type; currentType !== undefined; currentType = getBaseType(currentType)) {
const value = reader(currentType);
if (value !== undefined) {
return value;
}
}
return undefined;
}
//# sourceMappingURL=findInPrototypeChain.js.map
{"version":3,"file":"findInPrototypeChain.js","sourceRoot":"","sources":["../../../src/prototype/calculations/findInPrototypeChain.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,UAAU,oBAAoB,CAClC,IAAa,EACb,MAAwC;IAExC,KACE,IAAI,WAAW,GAAwB,IAAI,EAC3C,WAAW,KAAK,SAAS,EACzB,WAAW,GAAG,WAAW,CAAC,WAAW,CAAC,EACtC,CAAC;QACD,MAAM,KAAK,GAAkB,MAAM,CAAC,WAAW,CAAC,CAAC;QAEjD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
export {};
//# sourceMappingURL=findInPrototypeChain.spec.d.ts.map
import { type Newable } from '@inversifyjs/common';
export declare function getBaseType<TInstance, TArgs extends unknown[]>(type: Newable<TInstance, TArgs>): Newable | undefined;
//# sourceMappingURL=getBaseType.d.ts.map
{"version":3,"file":"getBaseType.d.ts","sourceRoot":"","sources":["../../../src/prototype/calculations/getBaseType.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAInD,wBAAgB,WAAW,CAAC,SAAS,EAAE,KAAK,SAAS,OAAO,EAAE,EAC5D,IAAI,EAAE,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC,GAC9B,OAAO,GAAG,SAAS,CAQrB"}
export function getBaseType(type) {
const prototype = Object.getPrototypeOf(type.prototype);
const baseType = prototype?.constructor;
return baseType;
}
//# sourceMappingURL=getBaseType.js.map
{"version":3,"file":"getBaseType.js","sourceRoot":"","sources":["../../../src/prototype/calculations/getBaseType.ts"],"names":[],"mappings":"AAIA,MAAM,UAAU,WAAW,CACzB,IAA+B;IAE/B,MAAM,SAAS,GAAqB,MAAM,CAAC,cAAc,CACvD,IAAI,CAAC,SAAS,CACK,CAAC;IAEtB,MAAM,QAAQ,GAAwB,SAAS,EAAE,WAAW,CAAC;IAE7D,OAAO,QAAQ,CAAC;AAClB,CAAC"}
export {};
//# sourceMappingURL=getBaseType.spec.d.ts.map
import { type Newable } from '@inversifyjs/common';
export interface Prototype {
constructor: Newable;
}
//# sourceMappingURL=Prototype.d.ts.map
{"version":3,"file":"Prototype.d.ts","sourceRoot":"","sources":["../../../src/prototype/models/Prototype.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,WAAW,SAAS;IACxB,WAAW,EAAE,OAAO,CAAC;CACtB"}
export {};
//# sourceMappingURL=Prototype.js.map
{"version":3,"file":"Prototype.js","sourceRoot":"","sources":["../../../src/prototype/models/Prototype.ts"],"names":[],"mappings":""}
+11
-0
# @inversifyjs/prototype-utils
## 0.2.0-beta.0
### Minor Changes
- Updated package to be ESM only
### Patch Changes
- Updated dependencies
- @inversifyjs/common@2.0.0-beta.0
## 0.1.3

@@ -4,0 +15,0 @@

+15
-22
{
"name": "@inversifyjs/prototype-utils",
"version": "0.1.3",
"version": "0.2.0-beta.0",
"description": "Prototype related utils",
"main": "lib/cjs/index.js",
"module": "lib/esm/index.js",
"exports": {
".": {
"import": "./lib/esm/index.js",
"require": "./lib/cjs/index.js"
}
".": "./lib/index.js"
},
"type": "module",
"repository": {

@@ -29,18 +25,17 @@ "type": "git",

"dependencies": {
"@inversifyjs/common": "1.5.2"
"@inversifyjs/common": "2.0.0-beta.0"
},
"devDependencies": {
"@stryker-mutator/core": "9.2.0",
"@stryker-mutator/vitest-runner": "9.2.0",
"@stryker-mutator/typescript-checker": "9.2.0",
"@types/node": "24.9.1",
"@vitest/coverage-v8": "4.0.4",
"eslint": "9.38.0",
"prettier": "3.6.2",
"rimraf": "6.0.1",
"rollup": "4.52.5",
"ts-loader": "9.5.4",
"@stryker-mutator/core": "9.5.1",
"@stryker-mutator/vitest-runner": "9.5.1",
"@stryker-mutator/typescript-checker": "9.5.1",
"@types/node": "24.10.13",
"@vitest/coverage-v8": "4.0.18",
"eslint": "9.39.3",
"prettier": "3.8.1",
"rimraf": "6.1.3",
"tslib": "2.8.1",
"typescript": "5.9.3",
"vitest": "4.0.4"
"vitest": "4.0.18",
"@inversifyjs/eslint-plugin-require-extensions": "0.2.0-beta.0"
},

@@ -56,5 +51,3 @@ "devEngines": {

"scripts": {
"build": "pnpm run build:cjs && pnpm run build:esm",
"build:cjs": "tsc --build tsconfig.cjs.json && pnpm exec foundation-ts-package-cjs ./lib/cjs",
"build:esm": "rollup -c ./rollup.config.mjs && pnpm exec foundation-ts-package-esm ./lib/esm",
"build": "tsc",
"build:clean": "rimraf lib",

@@ -61,0 +54,0 @@ "format": "prettier --write ./src",

import { findInPrototypeChain } from './prototype/calculations/findInPrototypeChain';
import { getBaseType } from './prototype/calculations/getBaseType';
import { Prototype } from './prototype/models/Prototype';
export type { Prototype };
export { findInPrototypeChain, getBaseType };
//# sourceMappingURL=index.d.ts.map
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,YAAY,EAAE,SAAS,EAAE,CAAC;AAE1B,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,CAAC"}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getBaseType = exports.findInPrototypeChain = void 0;
const findInPrototypeChain_1 = require("./prototype/calculations/findInPrototypeChain");
Object.defineProperty(exports, "findInPrototypeChain", { enumerable: true, get: function () { return findInPrototypeChain_1.findInPrototypeChain; } });
const getBaseType_1 = require("./prototype/calculations/getBaseType");
Object.defineProperty(exports, "getBaseType", { enumerable: true, get: function () { return getBaseType_1.getBaseType; } });
//# sourceMappingURL=index.js.map
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,wFAAqF;AAM5E,qGANA,2CAAoB,OAMA;AAL7B,sEAAmE;AAKpC,4FALtB,yBAAW,OAKsB"}
{
"type": "commonjs"
}
import { type Newable } from '@inversifyjs/common';
export declare function findInPrototypeChain<T>(type: Newable, reader: (type: Newable) => T | undefined): T | undefined;
//# sourceMappingURL=findInPrototypeChain.d.ts.map
{"version":3,"file":"findInPrototypeChain.d.ts","sourceRoot":"","sources":["../../../../src/prototype/calculations/findInPrototypeChain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAInD,wBAAgB,oBAAoB,CAAC,CAAC,EACpC,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,CAAC,GAAG,SAAS,GACvC,CAAC,GAAG,SAAS,CAcf"}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.findInPrototypeChain = findInPrototypeChain;
const getBaseType_1 = require("./getBaseType");
function findInPrototypeChain(type, reader) {
for (let currentType = type; currentType !== undefined; currentType = (0, getBaseType_1.getBaseType)(currentType)) {
const value = reader(currentType);
if (value !== undefined) {
return value;
}
}
return undefined;
}
//# sourceMappingURL=findInPrototypeChain.js.map
{"version":3,"file":"findInPrototypeChain.js","sourceRoot":"","sources":["../../../../src/prototype/calculations/findInPrototypeChain.ts"],"names":[],"mappings":";;AAIA,oDAiBC;AAnBD,+CAA4C;AAE5C,SAAgB,oBAAoB,CAClC,IAAa,EACb,MAAwC;IAExC,KACE,IAAI,WAAW,GAAwB,IAAI,EAC3C,WAAW,KAAK,SAAS,EACzB,WAAW,GAAG,IAAA,yBAAW,EAAC,WAAW,CAAC,EACtC,CAAC;QACD,MAAM,KAAK,GAAkB,MAAM,CAAC,WAAW,CAAC,CAAC;QAEjD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
export {};
//# sourceMappingURL=findInPrototypeChain.spec.d.ts.map
{"version":3,"file":"findInPrototypeChain.spec.d.ts","sourceRoot":"","sources":["../../../../src/prototype/calculations/findInPrototypeChain.spec.ts"],"names":[],"mappings":""}
import { Newable } from '@inversifyjs/common';
export declare function getBaseType<TInstance, TArgs extends unknown[]>(type: Newable<TInstance, TArgs>): Newable | undefined;
//# sourceMappingURL=getBaseType.d.ts.map
{"version":3,"file":"getBaseType.d.ts","sourceRoot":"","sources":["../../../../src/prototype/calculations/getBaseType.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAI9C,wBAAgB,WAAW,CAAC,SAAS,EAAE,KAAK,SAAS,OAAO,EAAE,EAC5D,IAAI,EAAE,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC,GAC9B,OAAO,GAAG,SAAS,CAQrB"}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getBaseType = getBaseType;
function getBaseType(type) {
const prototype = Object.getPrototypeOf(type.prototype);
const baseType = prototype?.constructor;
return baseType;
}
//# sourceMappingURL=getBaseType.js.map
{"version":3,"file":"getBaseType.js","sourceRoot":"","sources":["../../../../src/prototype/calculations/getBaseType.ts"],"names":[],"mappings":";;AAIA,kCAUC;AAVD,SAAgB,WAAW,CACzB,IAA+B;IAE/B,MAAM,SAAS,GAAqB,MAAM,CAAC,cAAc,CACvD,IAAI,CAAC,SAAS,CACK,CAAC;IAEtB,MAAM,QAAQ,GAAwB,SAAS,EAAE,WAAW,CAAC;IAE7D,OAAO,QAAQ,CAAC;AAClB,CAAC"}
export {};
//# sourceMappingURL=getBaseType.spec.d.ts.map
{"version":3,"file":"getBaseType.spec.d.ts","sourceRoot":"","sources":["../../../../src/prototype/calculations/getBaseType.spec.ts"],"names":[],"mappings":""}
import { Newable } from '@inversifyjs/common';
export interface Prototype {
constructor: Newable;
}
//# sourceMappingURL=Prototype.d.ts.map
{"version":3,"file":"Prototype.d.ts","sourceRoot":"","sources":["../../../../src/prototype/models/Prototype.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,MAAM,WAAW,SAAS;IACxB,WAAW,EAAE,OAAO,CAAC;CACtB"}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=Prototype.js.map
{"version":3,"file":"Prototype.js","sourceRoot":"","sources":["../../../../src/prototype/models/Prototype.ts"],"names":[],"mappings":""}
import { Newable } from '@inversifyjs/common';
declare function findInPrototypeChain<T>(type: Newable, reader: (type: Newable) => T | undefined): T | undefined;
declare function getBaseType<TInstance, TArgs extends unknown[]>(type: Newable<TInstance, TArgs>): Newable | undefined;
interface Prototype {
constructor: Newable;
}
export { findInPrototypeChain, getBaseType };
export type { Prototype };
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAC;AACrF,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,YAAY,EAAE,SAAS,EAAE,CAAC;AAE1B,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,CAAC"}
function t(t){const o=Object.getPrototypeOf(t.prototype),r=o?.constructor;return r}function o(o,r){for(let n=o;void 0!==n;n=t(n)){const t=r(n);if(void 0!==t)return t}}export{o as findInPrototypeChain,t as getBaseType};
//# sourceMappingURL=index.js.map
{"version":3,"file":"index.js","sources":["../../src/prototype/calculations/getBaseType.ts","../../src/prototype/calculations/findInPrototypeChain.ts"],"sourcesContent":[null,null],"names":["getBaseType","type","prototype","Object","getPrototypeOf","baseType","constructor","findInPrototypeChain","reader","currentType","undefined","value"],"mappings":"AAIM,SAAUA,EACdC,GAEA,MAAMC,EAA8BC,OAAOC,eACzCH,EAAKC,WAGDG,EAAgCH,GAAWI,YAEjD,OAAOD,CACT,CCVM,SAAUE,EACdN,EACAO,GAEA,IACE,IAAIC,EAAmCR,OACvBS,IAAhBD,EACAA,EAAcT,EAAYS,GAC1B,CACA,MAAME,EAAuBH,EAAOC,GAEpC,QAAcC,IAAVC,EACF,OAAOA,CAEX,CAGF"}
{
"type": "module"
}