Gathering detailed insights and metrics for @ttshivers/automapper-classes
Gathering detailed insights and metrics for @ttshivers/automapper-classes
Gathering detailed insights and metrics for @ttshivers/automapper-classes
Gathering detailed insights and metrics for @ttshivers/automapper-classes
🔥 An Object-Object AutoMapper for TypeScript 🔥
npm install @ttshivers/automapper-classes
Typescript
Module System
Min. Node Version
Node Version
NPM Version
TypeScript (76.41%)
MDX (18.84%)
JavaScript (4.4%)
CSS (0.36%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
1,007 Stars
785 Commits
94 Forks
9 Watchers
17 Branches
20 Contributors
Updated on Jul 11, 2025
Latest Version
8.8.3
Package Id
@ttshivers/automapper-classes@8.8.3
Unpacked Size
68.42 kB
Size
13.30 kB
File Count
30
NPM Version
9.7.1
Node Version
20.2.0
Published on
Jul 22, 2023
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
2
This is the official strategy from @automapper
to work with TS/ES6 Class
1npm i @ttshivers/automapper-classes
or with yarn
:
1yarn add @ttshivers/automapper-classes
peerDependencies
@ttshivers/automapper-classes
depends on @ttshivers/automapper-core
and reflect-metadata
.
1npm i @ttshivers/automapper-core reflect-metadata
or with yarn
:
1yarn add @ttshivers/automapper-core reflect-metadata
@ttshivers/automapper-classes
provides classes
as a MappingStrategyInitializer
. Pass classes()
to createMapper
to create
a Mapper
that uses classes
strategy.
1import { classes, AutoMap } from '@ttshivers/automapper-classes';
2import { createMapper, createMap, forMember, mapFrom } from '@ttshivers/automapper-core';
3
4const mapper = createMapper({
5 ...,
6 strategyInitializer: classes()
7});
8
9class User {
10 @AutoMap()
11 firstName: string;
12 @AutoMap()
13 lastName: string;
14
15 constructor(firstName: string, lastName: string) {
16 this.firstName = firstName;
17 this.lastName = lastName;
18 }
19}
20
21class UserDto {
22 @AutoMap()
23 firstName: string;
24 @AutoMap()
25 lastName: string;
26 @AutoMap()
27 fullName: string;
28}
29
30createMap(
31 mapper,
32 User,
33 UserDto,
34 forMember(
35 d => d.fullName,
36 mapFrom(s => s.firstName + ' ' + s.lastName)
37 )
38);
39mapper.map(new User('Auto', 'Mapper'), User, UserDto);
40// UserDto { firstName: 'Auto', lastName: 'Mapper', fullName: 'Auto Mapper' }
classes()
accepts two optional parameters:
destinationConstructor
: how to construct the Destination
. This is the default destinationConstructor
that will be used on mapper.mapXXXX()
operations. DestinationConstructor
is a function with the following signature:
1export type DestinationConstructor< 2 TSource extends Dictionary<TSource> = any, 3 TDestination extends Dictionary<TDestination> = any 4> = ( 5 sourceObject: TSource, // the sourceObject used to map to the Destination 6 destinationIdentifier: MetadataIdentifier<TDestination> // the Destination model 7) => TDestination; 8 9// example 10mapper.map(user, User, UserDto); 11// sourceObject will be "user" 12// destinationIdentifier will be "UserDto" 13// This allows you to provide a default constructor that can be based on the Source object data
destinationConstructor
to any given Mapping
when you run createMap
. Read more about constructUsingapplyMetadata
: how the strategy should apply the metadata to a model. The default should work for most cases but if you would like to customize this, you can. ApplyMetadata
is a function with the following signature:
1export type ApplyMetadataFn = <TModel extends Dictionary<TModel>>( 2 model: MetadataIdentifier<TModel> 3) => TModel; 4 5export type ApplyMetadata = ( 6 strategy: MappingStrategy<MetadataIdentifier> 7) => ApplyMetadataFn; 8 9// for example 10const customApplyMetadata: ApplyMetadata = (strategy: MappingStrategy) => { 11 // strategy contains the Mapper which stores all the models' metadata 12 return (model) => { 13 // based on this model, you can extract the metadata and do as you like 14 15 return anObjectThatHasTheMetadataApplied; // { foo: undefined, bar: undefined } 16 }; 17};
Read more about this strategy on classes documentation
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
no binaries found in the repo
Reason
Found 9/30 approved changesets -- score normalized to 3
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
project is not fuzzed
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
75 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More