# commodo-fields-int

> A simple integer field, used with the Commodo "withFields" higher order function.

Latest version **1.0.3** (published 2020-04-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install commodo-fields-int
pnpm add commodo-fields-int
yarn add commodo-fields-int
bun add commodo-fields-int
```

## 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.0.3 |
| Published | 2020-04-18 |
| First published | 2020-02-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 17 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Adrian Smijulj |
| Maintainers | adrian1210 |
| Keywords | commodo, fields, int |

## Links

- npm: https://www.npmjs.com/package/commodo-fields-int
- Repository: https://github.com/doitadrian/commodo-fields-int
- Homepage: https://github.com/doitadrian/commodo-fields-int#readme
- Issues: https://github.com/doitadrian/commodo-fields-int/issues
- npm.io page: https://npm.io/package/commodo-fields-int

## Dependencies (2)

- [repropose](https://npm.io/package/repropose.md) ^1.0.2
- [@commodo/fields](https://npm.io/package/@commodo/fields.md) ^1.0.0

## Alternatives

- [eslint-plugin-sonarjs](https://npm.io/package/eslint-plugin-sonarjs.md) — 2.9M weekly downloads
- [eslint-config-expo](https://npm.io/package/eslint-config-expo.md) — 1.5M weekly downloads
- [@matter/protocol](https://npm.io/package/@matter/protocol.md) — 63.5K weekly downloads
- [@eventcatalog/linter](https://npm.io/package/@eventcatalog/linter.md) — 24.8K weekly downloads
- [@pandacss/eslint-plugin](https://npm.io/package/@pandacss/eslint-plugin.md) — 18.7K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2020-04-18
- 1.0.2 — 2020-04-18
- 1.0.1 — 2020-02-10
- 1.0.0 — 2020-02-10

## README

# commodo-fields-int
[![Build Status](https://travis-ci.org/doitadrian/commodo-fields-int.svg?branch=master)](https://travis-ci.org/doitadrian/commodo-fields-int)
[![Coverage Status](https://coveralls.io/repos/github/doitadrian/commodo-fields-int/badge.svg?branch=master)](https://coveralls.io/github/doitadrian/commodo-fields-int?branch=master)
[![](https://img.shields.io/npm/dw/commodo-fields-int.svg)](https://www.npmjs.com/package/commodo-fields-int) 
[![](https://img.shields.io/npm/v/commodo-fields-int.svg)](https://www.npmjs.com/package/commodo-fields-int)
[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
  
A simple integer field, used with the [Commodo `withFields`](https://github.com/webiny/commodo/tree/master/packages/fields) higher order function. 

## Install
```
npm install --save commodo-fields-int
```

Or if you prefer yarn: 
```
yarn add commodo-fields-int
```

## Quick Example:
 
```javascript
import { compose } from "ramda";
import { withFields, string } from "@commodo/fields";
import { int } from "commodo-fields-int";

const Company = compose(
  withFields({
    name: string(),
    age: int(), // Use it to store a single integer value.
    topYears: int({ list: true }) // Or use it to store a list of integer values.
    // Other fields you might need...
  }),
  // Other higher order functions (HOFs) you might need...
)();

const company = new Company();
company.name = "Acme Corporation";

// The int field can only accepts integers. 
company.age = 17;
company.topYears = [2000, 2005, 2010];

// The following will throw the WithFieldsError error.
company.age =  "17";
company.age =  16.2;
company.topYears = [2000, "2005", 2010];
```

Note: alternatively, you could've also used the [`populate`](https://github.com/webiny/commodo/tree/master/packages/fields#populatedata-object-void) method to assign the data:

```javascript
const company = new Company();
company.populate = { age: 17, topYears: [2000, 2005, 2010] };
```

## Contributors

Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore -->
| [<img src="https://avatars0.githubusercontent.com/u/5121148?v=4" width="100px;"/><br /><sub><b>Adrian Smijulj</b></sub>](https://github.com/doitadrian)<br />[💻](https://github.com/doitadrian/commodo-fields-int/commits?author=doitadrian "Code") [📖](https://github.com/doitadrian/commodo-fields-int/commits?author=doitadrian "Documentation") [💡](#example-doitadrian "Examples") [👀](#review-doitadrian "Reviewed Pull Requests") [⚠️](https://github.com/doitadrian/commodo-fields-int/commits?author=doitadrian "Tests") |
| :---: |
<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!

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