
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
@nartc/automapper
Advanced tools
An object-to-object mapper by convention for TypeScript.
initialize()
has been deprecated in v6
. Please use createMap()
, addProfile()
, and/or withGlobalSettings()
directlymapping configurations
to use those// before
Mapper.createMap(Source, Destination)
.forMember(d => d.destMember, opts => opts.mapFrom(s => s.sourceMember);
// after
Mapper.createMap(Source, Destination)
.forMember(d => d.destMember, mapFrom(s => s.sourceMember))
preCondition()
is also a separate function. Use in v6 as follow// before
Mapper.createMap(Source, Destination).forMember(
d => d.destMember,
opts => opts.preCondition(predicate).mapFrom(s => s.sourceMember)
);
// after
Mapper.createMap(Source, Destination).forMember(
d => d.destMember,
preCondition(predicate),
mapFrom(s => s.sourceMember)
);
automapper-nartc
The only migration step you need is to modify forMember()
method.
In automapper-nartc
, forMember()
takes in a property string
as the first argument. Now, forMember()
in @nartc/automapper
takes in a selector
instead. This wil allow reverseMap()
to work better.
// Before
Mapper.createMap(User, UserVm)
.forMember('fullName', opts => opts.mapFrom(...));
// Now
Mapper.createMap(User, UserVm)
.forMember(dest => dest.fullName, opts => opts.mapFrom(...));
@Expose()
and @ExposedType()
to @AutoMap()
// Before
class User {
@Expose()
firstName: string;
@ExposedType(() => Profile)
profile: Profile;
}
// v3
class User {
@AutoMap()
firstName: string;
@AutoMap(() => Profile)
profile: Profile;
}
So far, the following is supported:
Basic Mapping between two classes
Basic Mapping for nested classes
Mapping Inheritance - with caveats regarding typings.
Array/List Mapping
Flattening
ReverseMap
Value Converters
Value Resolvers
Async (Read more at Async Support)
Before/After Callback
Naming Conventions
Null Substitution - @lqmanh pointed out the difference in fromValue()
and nullSubstitution()
use-case, and that difference is totally valid. Hence, nullSubstitution
is now supported.
Circular Dependencies
Tree-shakable
Please check out the Circular Dependencies Documentations
Check out the AutoMapper TypeScript Documentations
Contribution of any kind is always welcomed.
FAQs
An object-to-object mapper by convention for TypeScript.
The npm package @nartc/automapper receives a total of 415 weekly downloads. As such, @nartc/automapper popularity was classified as not popular.
We found that @nartc/automapper demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.