0.5.1 • Published 10 months ago

@pertype/decimal.js v0.5.1

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

@pertype/decimal.js

pertype - /type - add-on for decimal.js

pertype is still in alpha. Expect bugs and api changes!

Installation

npm install @pertype/decimal.js       # npm
yarn add @pertype/decimal.js          # yarn
bun add @pertype/decimal.js           # bun
pnpm add @pertype/decimal.js          # pnpm

Basic Usage

import { decimal } from '@pertype/decimal.js'

// create decimal schema
const schema = decimal()

// type guard
if (schema.is(value)) {
  // ... value is inferred as `Decimal`
}

// decode value (coercion) to `Decimal`
schema.decode(value)

// encode value to Json compatible type
schema.encode(value)

Schema

pertype come with built-in schema you can immediately use

NameTypescriptFactory
decimalDecimaldecimal()
0.5.1

10 months ago

0.3.8

1 year ago

0.5.0

12 months ago

0.4.0

1 year ago

0.3.6

1 year ago

0.3.5

1 year ago

0.3.7

1 year ago

0.3.4

1 year ago

0.3.3

1 year ago

0.3.2

1 year ago

0.3.1

1 year ago

0.3.0

1 year ago