Skip to content

Commit

Permalink
Deal with null and undefined in mapType documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthiasKunnen authored and Neos3452 committed Jan 26, 2021
1 parent 015088b commit 62aa57a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ import {jsonObject, jsonMember, TypedJSON} from 'typedjson';
import * as Decimal from 'decimal.js'; // Or any other library your type originates from

TypedJSON.mapType(BigInt, {
deserializer: json => new BigInt(json),
serializer: value => value.toString(),
deserializer: json => value == null ? value : new BigInt(json),
serializer: value => value == null ? value : value.toString(),
});

TypedJSON.mapType(Decimal, {
deserializer: json => new Decimal(json),
serializer: value => value.toString(),
deserializer: json => value == null ? value : new Decimal(json),
serializer: value => value == null ? value : value.toString(),
});

@jsonObject
Expand Down

0 comments on commit 62aa57a

Please sign in to comment.