Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@automapper/classes

Package Overview
Dependencies
Maintainers
1
Versions
141
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@automapper/classes - npm Package Compare versions

Comparing version 2.0.1 to 2.1.0

src/lib/constants/automap-properties-metadata-key.d.ts

6

package.json
{
"name": "@automapper/classes",
"version": "2.0.1",
"version": "2.1.0",
"peerDependencies": {
"reflect-metadata": "~0.1.13",
"@automapper/core": "2.0.1",
"@automapper/types": "2.0.1"
"@automapper/core": "2.1.0",
"@automapper/types": "2.1.0"
},

@@ -9,0 +9,0 @@ "sideEffects": false,

export * from './lib/classes';
export * from './lib/decorators';
export * from './lib/constants';

@@ -6,2 +6,3 @@ "use strict";

tslib_1.__exportStar(require("./lib/decorators"), exports);
tslib_1.__exportStar(require("./lib/constants"), exports);
//# sourceMappingURL=index.js.map

@@ -6,2 +6,3 @@ "use strict";

require("reflect-metadata");
const constants_1 = require("./constants");
const storages_1 = require("./storages");

@@ -90,3 +91,3 @@ const utils_1 = require("./utils");

// get the metadata from Reflection then populate metadataStorage and instanceStorage
const metadataList = Reflect.getMetadata('automap:properties', model);
const metadataList = Reflect.getMetadata(constants_1.AUTOMAP_PROPERTIES_METADATA_KEY, model);
// skip if no metadata

@@ -93,0 +94,0 @@ if (!core_1.isDefined(metadataList))

@@ -8,2 +8,2 @@ import type { Constructible } from '../types';

*/
export declare const AutoMap: (typeFn?: (() => Constructible) | undefined, depth?: number) => PropertyDecorator;
export declare const AutoMap: (typeFn?: () => Constructible, depth?: number) => PropertyDecorator;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AutoMap = void 0;
const constants_1 = require("../constants");
/**

@@ -11,9 +12,8 @@ * AutoMap decorator to decorate fields in classes to store metadata of that field

exports.AutoMap = (typeFn, depth = 0) => (target, propertyKey) => {
// get existing metadata
const existingMetadataList = Reflect.getMetadata(constants_1.AUTOMAP_PROPERTIES_METADATA_KEY, target.constructor) ||
[];
// If `typeFn` is provided, classes plugin does not have to guess with Reflect and just `defineMetadata`
if (typeFn) {
Reflect.defineMetadata('automap:properties', [
...(Reflect.getMetadata('automap:properties', target.constructor) ||
[]),
[propertyKey, { typeFn, depth }],
], target.constructor);
Reflect.defineMetadata(constants_1.AUTOMAP_PROPERTIES_METADATA_KEY, [...existingMetadataList, [propertyKey, { typeFn, depth }]], target.constructor);
}

@@ -23,7 +23,3 @@ else {

if (meta) {
Reflect.defineMetadata('automap:properties', [
...(Reflect.getMetadata('automap:properties', target.constructor) ||
[]),
[propertyKey, { typeFn: () => meta }],
], target.constructor);
Reflect.defineMetadata(constants_1.AUTOMAP_PROPERTIES_METADATA_KEY, [...existingMetadataList, [propertyKey, { typeFn: () => meta }]], target.constructor);
}

@@ -30,0 +26,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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