OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How to convert boolean to string - NestJS / JS / Node

  • Thread starter Thread starter Bastian
  • Start date Start date
B

Bastian

Guest
I am new to NestJS as a server. I have a table in DB that I am querying, and the column name is precedence, and it is boolean meaning in DB just 0 or 1.
I have this code that I understood maps the data to DTO.

Code:
forMember(
          (destination) => destination.precedence,
          mapFrom((source) => source.precedence),
        ),

but instead of 1 I need it to be true and instead of 0 I need it to be false

Can it be done? in the mapper?

<p>I am new to NestJS as a server.
I have a table in DB that I am querying, and the column name is precedence, and it is boolean meaning in DB just 0 or 1.<br />
I have this code that I understood maps the data to DTO.</p>
<pre><code>forMember(
(destination) => destination.precedence,
mapFrom((source) => source.precedence),
),
</code></pre>
<p>but instead of 1 I need it to be true
and instead of 0 I need it to be false</p>
<p>Can it be done? in the mapper?</p>
 
Top