Socket
Socket
Sign inDemoInstall

decimal-type

Package Overview
Dependencies
1
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    decimal-type

[![npm version](https://img.shields.io/npm/v/decimal-type)](https://www.npmjs.com/package/decimal-type) [![npm downloads/month](https://img.shields.io/npm/dm/decimal-type)](https://www.npmjs.com/package/decimal-type) [![GitHub license](https://img.shields


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

decimal-type

npm version npm downloads/month GitHub license

A collection of helper functions for working with decimal numbers in various JS/TS environments.

Installation

# With Yarn
yarn add decimal-type

# or with npm
npm i decimal-type

Usage

As this is more like a bundle, you are free to combine the functions you need. Check the Examples section for some use cases.

Examples

Nest.js / GraphQL (code-first) / Prisma / class-transformer

import { DecimalScalar, DecimalType } from 'decimal-type';
import { Field, InputType } from '@nestjs/graphql';
import { Decimal } from '@prisma/client/runtime';

@InputType()
export class NewTransactionInput {
  @Field()
  name: string;

  @Field(() => DecimalScalar)
  @DecimalType()
  amount: Decimal;
}

NOTE: Don't forget to register the DecimalScalar scalar with Nest.js. See here for more information.

INFO: If the @DecimalType() decorator is not used, class-transformer will not know how to transform the Decimal type returned by the DecimalScalar scalar into a new Decimal instance.

Keywords

FAQs

Last updated on 24 Nov 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc