inspectable
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -35,3 +35,3 @@ 'use strict'; | ||
const payload = (((_a = options.serialize) === null || _a === void 0 ? void 0 : _a.call(options, instance)) || {}); | ||
for (const property of (klass[kInspectProperties] || [])) { | ||
for (const property of (Reflect.getMetadata(kInspectProperties, instance) || [])) { | ||
payload[property] = instance[property]; | ||
@@ -45,6 +45,7 @@ } | ||
const Inspect = (target, property) => { | ||
if (target.constructor[kInspectProperties] === undefined) { | ||
target.constructor[kInspectProperties] = []; | ||
const metadata = (Reflect.getMetadata(kInspectProperties, target) || []); | ||
if (metadata.length === 0) { | ||
Reflect.defineMetadata(kInspectProperties, metadata, target); | ||
} | ||
target.constructor[kInspectProperties].push(property); | ||
metadata.push(property); | ||
}; | ||
@@ -51,0 +52,0 @@ |
{ | ||
"name": "inspectable", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "Make the output of a class instance in the console meaningful", | ||
@@ -25,5 +25,11 @@ "license": "MIT", | ||
], | ||
"main": "lib/index", | ||
"module": "lib/index.mjs", | ||
"types": "lib/index.d.ts", | ||
"main": "./lib/index.js", | ||
"types": "./lib/index.d.ts", | ||
"exports": { | ||
".": { | ||
"import": "./lib/index.mjs", | ||
"require": "./lib/index.js" | ||
} | ||
}, | ||
"sideEffects": false, | ||
"engines": { | ||
@@ -33,16 +39,20 @@ "node": ">=12.0.0" | ||
"devDependencies": { | ||
"@types/jest": "^26.0.22", | ||
"@types/node": "^14.14.37", | ||
"@typescript-eslint/eslint-plugin": "^4.19.0", | ||
"@typescript-eslint/parser": "^4.19.0", | ||
"eslint": "7.23.0", | ||
"@types/jest": "^26.0.23", | ||
"@types/node": "^15.6.1", | ||
"@typescript-eslint/eslint-plugin": "^4.25.0", | ||
"@typescript-eslint/parser": "^4.25.0", | ||
"eslint": "7.27.0", | ||
"eslint-config-airbnb-base": "^14.2.1", | ||
"eslint-plugin-import": "^2.22.1", | ||
"jest": "^26.6.3", | ||
"rollup": "^2.43.1", | ||
"eslint-plugin-import": "^2.23.3", | ||
"jest": "^27.0.1", | ||
"reflect-metadata": "^0.1.13", | ||
"rollup": "^2.50.1", | ||
"rollup-plugin-typescript2": "^0.30.0", | ||
"ts-jest": "^26.5.4", | ||
"typedoc": "^0.20.34", | ||
"typescript": "^4.2.3" | ||
"ts-jest": "^27.0.0", | ||
"typedoc": "^0.20.36", | ||
"typescript": "^4.2.4" | ||
}, | ||
"peerDependencies": { | ||
"reflect-metadata": "^0.1.13" | ||
}, | ||
"scripts": { | ||
@@ -49,0 +59,0 @@ "prepare": "yarn run rollup:build && yarn run test", |
@@ -57,2 +57,3 @@ <p align="center"> | ||
```ts | ||
import 'reflect-metadata'; | ||
import { Inspectable, Inspect } from 'inspectable'; | ||
@@ -59,0 +60,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9760
120
75
1
14