# typer

> Simple type casting library

Latest version **1.1.0** (published 2016-02-23) · ISC license · 0 weekly downloads

## Install

```sh
npm install typer
pnpm add typer
yarn add typer
bun add typer
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2016-02-23 |
| First published | 2015-08-04 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | RWOverdijk |
| Maintainers | rwoverdijk |
| Keywords | type, casting |

## Links

- npm: https://www.npmjs.com/package/typer
- Repository: https://github.com/SpoonX/typer
- Homepage: https://github.com/SpoonX/typer#readme
- Issues: https://github.com/SpoonX/typer/issues
- npm.io page: https://npm.io/package/typer

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2016-02-23
- 1.0.0 — 2015-08-04

## README

# Typer
A small module that allows you to do simple type casting and detecting.

## Installation
`npm i --save typer`

## Usage
Usage is pretty simple. First, require typer and then use one of the documented methods.

### .detect(value)
Detect the type of `value`.

```javascript
var typer = require('typer');

console.log(typer.detect('12345.12')); // float
console.log(typer.detect('12345')); // integer
console.log(typer.detect('false')); // boolean
console.log(typer.detect('2016-02-22T18:00:00.000Z')); // datetime
```

You can find more examples in the tests.

### .cast(value, type='smart')
Cast `value` to `type`.

```javascript
var typer = require('typer');

console.log(typer.cast(23, 'string')); // '23'
console.log(typer.cast('23', 'integer')); // 23
console.log(typer.cast('23', 'float')); // 23.00
console.log(typer.cast('2016-02-22T18:00:00.000Z', 'date')); // Mon, 22 Feb 2016 18:00:00 GMT

---
_Source: https://npm.io/package/typer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
