Skip to content

Commit

Permalink
initial commit + whole lib
Browse files Browse the repository at this point in the history
  • Loading branch information
ammichael committed Nov 19, 2020
1 parent fc9e103 commit a77f5f9
Show file tree
Hide file tree
Showing 20 changed files with 3,738 additions and 2,860 deletions.
3 changes: 2 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@

## Checklist 🚨

- [ ] Meu código segue o code style da Builders
- [ ] Testado usando Yalc
- [ ] Meu código segue o code style da Builders
- [ ] Meu código foi feito utilizando TDD (**testes unitários obrigatórios**)
61 changes: 57 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,60 @@
![check](https://github.com/platformbuilders/template-hooks/workflows/check/badge.svg)
# Welcome to Platform Builders `Validations`

# @platformbuilders/use-hooks
[![Build Status][check-badge]][workflows]
[![codecov][codecov]](https://codecov.io/gh/platformbuilders/validations)
[![npm][npm-badge]][npm]
[![MIT][license-badge]][license]

## Hooks Template
[npm-badge]: https://img.shields.io/npm/v/@platformbuilders/validations.svg
[npm]: https://www.npmjs.com/package/@platformbuilders/validations
[license-badge]: https://img.shields.io/dub/l/vibe-d.svg
[license]: https://raw.githubusercontent.com/platformbuilders/validations/master/LICENSE.md
[workflows]: https://github.com/platformbuilders/validations/actions
[check-badge]: https://github.com/platformbuilders/validations/workflows/check/badge.svg
[codecov]: https://codecov.io/gh/platformbuilders/validations/branch/master/graph/badge.svg

É só renomear o pacote, criar seu hooks e publicar para ser feliz 🙌
Welcome to the Platform Builder form `validations` package here you will find out all the helpers that we use on our projects

# Whats the idea of this repository

Easily apply validations to forms, specially using [yup](https://github.com/jquense/yup).

# How can i use the library?

Just add the library to your project and import it!

1. Depend on it:

```
yarn add @platformbuilders/validations
```

3. Import:

```
import { isValidFullName } from '@platformbuilders/validations'
```

# Validations

| Name | Returns | Arguments |
| ------------------------------------------------ | --------------- | ----------------- |
| [`isValidFullName`](./docs/isValidFullName.md) | truthy OR falsy | (string) |
| [`isValidCep`](./docs/isValidCep.md) | truthy OR falsy | (string) |
| [`isValidCurrency`](./docs/isValidCurrency.md) | truthy OR falsy | (string) |
| [`isValidDDD`](./docs/isValidDDD.md) | truthy OR falsy | (string) |
| [`isValidEmail`](./docs/isValidEmail.md) | truthy OR falsy | (string) |
| [`isValidCpf`](./docs/isValidCpf.md) | truthy OR falsy | (string) |
| [`isValidCnpj`](./docs/isValidCnpj.md) | truthy OR falsy | (string) |
| [`isValidPassword`](./docs/isValidPassword.md) | truthy OR falsy | (string) |
| [`isValidDocument`](./docs/isValidDocument.md) | truthy OR falsy | (string) |
| [`isValidPin`](./docs/isValidPin.md) | truthy OR falsy | (string, number?) |
| [`isBiggerThanZero`](./docs/isBiggerThanZero.md) | truthy OR falsy | (string) |

## React Native

| Name | Returns | Arguments |
| --------------------------------------------------- | ------- | ------------------ |
| [`isIOS`](./docs/native/isIOS.md) | boolean | |
| [`generateHaptic`](./docs/native/generateHaptic.md) | void | HapticFeedbackType |
17 changes: 17 additions & 0 deletions docs/isValidFullName.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# `isValidFullName`

Validate if string has at least two valid, non-numeric names.

## Arguments

- `name: string`: value to be validated

## Usage

```jsx
import { isValidFullName } from '@platformbuilders/helpers';

isValidFullName('Spada'); // return false

isValidFullName('Eduardo Spada'); // return true
```
59 changes: 35 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
{
"name": "@platformbuilders/use-hooks",
"name": "@platformbuilders/validations",
"version": "0.0.1",
"description": "",
"author": "Platform Builders <[email protected]>",
"repository": {
"type": "git",
"url": "git+https://github.com/platformbuilders/template-hooks.git"
"url": "git+https://github.com/platformbuilders/validations.git"
},
"keywords": [
"platformbuilders",
"validations"
],
"license": "MIT",
"private": false,
"main": "dist/index.js",
"module": "dist/index.es.js",
"types": "dist/index.d.ts",
"engines": {
"node": ">=8",
"npm": ">=5"
"node": ">=13",
"npm": ">=6"
},
"scripts": {
"test": "cross-env CI=1 react-scripts test --env=jsdom",
Expand All @@ -38,37 +44,42 @@
]
},
"peerDependencies": {
"react": "^16.13.1"
"@fnando/cnpj": "^1.0.2",
"@fnando/cpf": "^1.0.2",
"@platformbuilders/helpers": "^0.3.3",
"react": "^16.14.0"
},
"devDependencies": {
"@babel/core": "^7.11.4",
"@babel/runtime": "^7.11.2",
"@testing-library/react-hooks": "^3.4.1",
"@types/jest": "^26.0.10",
"@types/react": "^16.9.48",
"@typescript-eslint/eslint-plugin": "^3.10.1",
"@typescript-eslint/parser": "^3.10.1",
"@platformbuilders/helpers": "^0.3.3",
"@fnando/cnpj": "^1.0.2",
"@fnando/cpf": "^1.0.2",
"@babel/core": "^7.12.3",
"@babel/runtime": "^7.12.5",
"@testing-library/react-hooks": "^3.4.2",
"@types/jest": "^26.0.15",
"@types/react": "^16.9.56",
"@typescript-eslint/eslint-plugin": "^4.8.1",
"@typescript-eslint/parser": "^4.8.1",
"cross-env": "^7.0.2",
"eslint": "^7.7.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.22.0",
"eslint": "^7.13.0",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-sonarjs": "^0.5.0",
"eslint-plugin-typescript": "^0.14.0",
"gh-pages": "^3.1.0",
"husky": "^4.2.5",
"prettier": "^2.1.1",
"react": "^16.13.1",
"react-scripts": "^3.4.3",
"react-test-renderer": "^16.13.1",
"rollup": "^2.26.8",
"husky": "^4.3.0",
"prettier": "^2.1.2",
"react": "^17.0.1",
"react-scripts": "^4.0.0",
"rollup": "^2.33.3",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-peer-deps-external": "^2.2.3",
"rollup-plugin-typescript2": "^0.27.2",
"rollup-plugin-peer-deps-external": "^2.2.4",
"rollup-plugin-typescript2": "^0.29.0",
"rollup-plugin-url": "^3.0.1",
"typescript": "^4.0.2"
"typescript": "^4.0.5"
}
}
28 changes: 14 additions & 14 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
import typescript from 'rollup-plugin-typescript2'
import commonjs from 'rollup-plugin-commonjs'
import external from 'rollup-plugin-peer-deps-external'
import resolve from 'rollup-plugin-node-resolve'
import url from 'rollup-plugin-url'
import typescript from 'rollup-plugin-typescript2';
import commonjs from 'rollup-plugin-commonjs';
import external from 'rollup-plugin-peer-deps-external';
import resolve from 'rollup-plugin-node-resolve';
import url from 'rollup-plugin-url';

import pkg from './package.json'
import pkg from './package.json';

export default {
input: 'src/index.tsx',
input: 'src/index.ts',
output: [
{
file: pkg.main,
format: 'cjs',
exports: 'named',
sourcemap: true
sourcemap: true,
},
{
file: pkg.module,
format: 'es',
exports: 'named',
sourcemap: true
}
sourcemap: true,
},
],
plugins: [
external(),
url({ exclude: ['**/*.svg'] }),
resolve(),
typescript({
rollupCommonJSResolveHack: true,
clean: true
clean: true,
}),
commonjs()
]
}
commonjs(),
],
};
Loading

0 comments on commit a77f5f9

Please sign in to comment.