Skip to content

Releases: tomas-light/mapper-js

2.5.1

Choose a tag to compare

@tomas-light tomas-light released this 17 Jul 11:53

🐛🔨 fixed esm imports

2.3.0 - 2.5.0

Choose a tag to compare

@tomas-light tomas-light released this 16 Jul 22:46

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

Choose a tag to compare

@tomas-light tomas-light released this 09 Mar 22:07

Features

  • 🚀 add defaultValueIfNull and defaultValueIfNullOrUndefined properties to autoMap config

Release 2.1.1

Choose a tag to compare

@tomas-light tomas-light released this 24 Feb 10:05
b1cc107

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

Choose a tag to compare

@tomas-light tomas-light released this 23 Feb 21:55
4f93b63

Features:

  • 🚀 add defaultValueIfUndefined property to autoMap config;

Full Changelog: 2.0.1...2.1.0

Release 2.0.1

Choose a tag to compare

@tomas-light tomas-light released this 17 Feb 08:48
  • add tests coverage;
  • remove unused code;

Release 2.0.0

Choose a tag to compare

@tomas-light tomas-light released this 16 Feb 23:07

Breaking Changes:

  • removed mapping profiles. Now only MapFunction's are available for mapping registration;
  • renamed methods of Mapper from addProfiles to addMapFunctions ;
  • MapKey replaced with MapFunctionKey (changed name and type);

Features:

  • added autoMap function with strong types.