Repository navigation
Releases: tomas-light/mapper-js
Releases · tomas-light/mapper-js
Release list
2.5.1
2.3.0 - 2.5.0
2.5.0
🚀 implemented deleteMapFunctionFor method for deleting one specific map function. It may be useful, if you register map function in React useEffect, and want to clear dependency on effect clearing, like:
import { useEffect } from 'react';
import { Mapper, MapFunction } from '@tomas-light/mapper-js';
class Foo {
name?: string;
}
class Bar {
title?: string;
}
const Page = () => {
useEffect(() => {
Mapper.addMapFunctions(
new MapFunction(Foo, Bar, (foo) => ({
title: foo.name
}))
)
return () => {
Mapper.deleteMapFunctionFor(Foo, Bar);
}
}, []);
return (...)
}2.4.0
🚀 implemented clear method for clearing registered dependencies. It may be useful, if you register map function in React useEffect, and want to clear dependency on effect clearing, like:
import { useEffect } from 'react';
import { Mapper, MapFunction } from '@tomas-light/mapper-js';
class Foo {
name?: string;
}
class Bar {
title?: string;
}
const Page = () => {
useEffect(() => {
Mapper.addMapFunctions(
new MapFunction(Foo, Bar, (foo) => ({
title: foo.name
}))
)
Mapper.addMapFunctions(
new MapFunction(Bar, Foo, (foo) => ({
name: foo.title
}))
)
return () => {
Mapper.clear();
}
}, []);
return (...)
}🔨 updated typescript from 5.2.2 to 5.5.3
🔨🚧 MapFunction required both generic types now
import { MapFunction } from '@tomas-light/mapper-js';
// for example in case, when you define your own function that accepts map function arguments. You need now to explicitly specify both generics as `any` or `object`
// before
function myFunction(...mapFunctions: MapFunction[]) {}
// after
function myFunction(...mapFunctions: MapFunction<any, any>[]) {}2.3.0
🔨 updated typescript from 4.9.5 to 5.2.2
Release 2.2.0
Features
- 🚀 add
defaultValueIfNullanddefaultValueIfNullOrUndefinedproperties toautoMapconfig
Release 2.1.1
Bugfixes
- 🐛 fix "Type instantiation is excessively deep and possibly infinite." for any type passed to autoMap
Full Changelog: 2.1.0...2.1.1
Release 2.1.0
Release 2.0.1
- add tests coverage;
- remove unused code;
Release 2.0.0
Breaking Changes:
- removed mapping profiles. Now only
MapFunction's are available for mapping registration; - renamed methods of
MapperfromaddProfilestoaddMapFunctions; MapKeyreplaced withMapFunctionKey(changed name and type);
Features:
- added
autoMapfunction with strong types.