# @blinkmobile/cast-property-types

> coerce properties within an Object to other types

Latest version **1.0.0** (published 2015-06-19) · BSD-3-Clause license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @blinkmobile/cast-property-types
pnpm add @blinkmobile/cast-property-types
yarn add @blinkmobile/cast-property-types
bun add @blinkmobile/cast-property-types
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2015-06-19 |
| First published | 2015-06-19 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ron Waldon |
| Maintainers | blinkmobile |
| Keywords | coerce, cast, types |

## Links

- npm: https://www.npmjs.com/package/@blinkmobile/cast-property-types
- Repository: https://github.com/blinkmobile/cast-property-types.js
- Homepage: https://github.com/blinkmobile/cast-property-types.js#readme
- Issues: https://github.com/blinkmobile/cast-property-types.js/issues
- npm.io page: https://npm.io/package/@blinkmobile/cast-property-types

## 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.0.0 (latest) — 2015-06-19

## README

# cast-property-types.js

coerce properties within an Object to other types

[![npm module](https://img.shields.io/npm/v/blinkmobile/cast-property-types.svg)](https://www.npmjs.com/package/blinkmobile/cast-property-types)

[![travis-ci](https://img.shields.io/travis/blinkmobile/cast-property-types.js.svg)](https://travis-ci.org/blinkmobile/cast-property-types.js)


## What is this?

This is a utility function to take an Object that has properties with String
values, and cast those Strings to other type (e.g. Booleans and Numbers).


## API

### `castPropertyTypes()`

- @param {Object} input key-value pairs to cast
- @param {Object} example key-value pairs where values are of desired types
- @returns {Object} a new Object with same properties as input but with cast values

`castPropertyTypes()` will take the values from the first parameter, and cast
those values using the types found in the second parameter.

For example, `castPropertyTypes({ value: '123' }, { value: 0 })` will return:

```json
{
  "value": 123
}
```

We use the built-in `parseFloat()` method to cast values to a Number, so be
aware that values that are not numeric may have unexpected results.

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