npm.io
2.0.0 • Published 2 years ago

@dbc-tech/http-kit

Licence
MIT
Version
2.0.0
Deps
2
Size
79 kB
Vulns
0
Weekly
0

http-kit

A Node.js package for managing HTTP client requests

Install

npm install @dbc-tech/http-kit

Utilities

plainToDto

This method converts a plain object to a DTO object using the provided DTO class. If the DTO class is not provided, it return the plain object as is:

import { Type } from 'class-transformer';
import { plainToDto } from './plain-to-dto';

class Dto {
  id: number;
  name: string;

  @Type(() => Date)
  createdAt: Date;

  @Type(() => Date)
  updatedAt: Date;

  @Type(() => Hit)
  hits: Hit[];
}

const dto = plainToDto(plain, Dto);