# @doxa-code/utils

> Funções úteis para o desenvolvimento de aplicações

Latest version **0.1.8** (published 2022-03-04) · 0 weekly downloads

## Install

```sh
npm install @doxa-code/utils
pnpm add @doxa-code/utils
yarn add @doxa-code/utils
bun add @doxa-code/utils
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.8 |
| Published | 2022-03-04 |
| First published | 2022-02-06 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 5.3 KB |
| Known vulnerabilities | 0 (+15 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | nandosouza12 |

## Links

- npm: https://www.npmjs.com/package/@doxa-code/utils
- npm.io page: https://npm.io/package/@doxa-code/utils

## Dependencies (7)

- [next](https://npm.io/package/next.md) ^12.1.0
- [react](https://npm.io/package/react.md) ^17.0.2
- [react-dom](https://npm.io/package/react-dom.md) ^17.0.2
- [sweetalert](https://npm.io/package/sweetalert.md) ^2.1.2
- [@types/react-dom](https://npm.io/package/@types/react-dom.md) ^17.0.13
- [form-serialization](https://npm.io/package/form-serialization.md) ^0.11.0
- [@sweetalert/with-react](https://npm.io/package/@sweetalert/with-react.md) ^0.1.1

## Recent versions

- 0.1.8 (latest) — 2022-03-04
- 0.1.7 — 2022-03-04
- 0.1.6 — 2022-03-04
- 0.1.5 — 2022-03-01
- 0.1.4 — 2022-03-01
- 0.1.3 — 2022-02-28
- 0.1.2 — 2022-02-28
- 0.1.1 — 2022-02-08
- 0.1.0 — 2022-02-08
- 0.0.9 — 2022-02-08
- 0.0.8 — 2022-02-06
- 0.0.7 — 2022-02-06
- 0.0.6 — 2022-02-06
- 0.0.5 — 2022-02-06
- 0.0.4 — 2022-02-06
- … 3 more at https://npm.io/package/@doxa-code/utils/versions

## README

# DOXA CODE - UTILS

# Format Money

```javascript
  import { formatMoney } from '@doxa-code/utils'

  formatMoney("0.43") // R$ 0,43
```

# Set Fields Value

This function sets the value of all inputs in its components, following the Object inserted as a parameter

```javascript
  import { setFieldsValue } from '@doxa-code/utils'
  import { useEffect } from 'react'

  const values = {
    name: "John Mayer",
    age: 35
  }

  useEffect(() => {
    if(values) {
      setFieldsValue(values)
    }
  }, [values])

  /*
    <input name="name"/>
    <input name="age" type="number">
  */

```

# Set Fields Value

This function gets the value of all inputs, selects and textares in its components, following the parameter

```javascript
  import { getFieldsValue } from '@doxa-code/utils'
  import { useEffect } from 'react'

  async function handleSubmit(e) {
    const fields = getFieldsValue(e) 
    console.log(fields)
    /*
      {
        name: "John Mayer",
        age: 35
      }
    */
  }

  /*
    <form onSubmit={handleSubmit}>
      <input name="name"/>
      <input name="age" type="number">
    </form>
  */

```

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