Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reduced bundle size (used libphonenumber-js) #823

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,6 @@ updates:
versions:
- 2.2.0
- 2.2.1
- dependency-name: google-libphonenumber
- dependency-name: libphonenumber-js
versions:
- 3.2.17
- 1.10.30
27 changes: 13 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
[![Coverage Status](https://coveralls.io/repos/github/abhisekp/yup-phone/badge.svg?branch=master)](https://coveralls.io/github/abhisekp/yup-phone?branch=master)
-->

> Adds a phone number validation check to yup validator using [**google-libphonenumber**](https://www.npmjs.com/package/google-libphonenumber) which gives accurate validation checks.
_Read more about the **core library** here_ [*libphonenumber*](https://github.com/googlei18n/libphonenumber/blob/master/README.md#readme).
> Adds a phone number validation check to yup validator using [**libphonenumber-js**](https://www.npmjs.com/package/libphonenumber-js) which gives accurate validation checks.
_Read more about **yup** validator here_ [*yup*](https://www.npmjs.com/package/yup)

## Install
Expand Down Expand Up @@ -128,30 +127,30 @@ For more examples, check [yup-phone.test.ts](src/yup-phone.test.ts) file.

```
Destination: dist/yup-phone.umd.js
Bundle Size: 544.08 KB
Minified Size: 537.41 KB
Gzipped Size: 107.04 KB
Bundle Size: 220.83 KB
Minified Size: 114.36 KB
Gzipped Size: 27.88 KB
```

```
Destination: dist/yup-phone.umd.min.js
Bundle Size: 508.65 KB
Minified Size: 506.46 KB
Gzipped Size: 105.73 KB
Bundle Size: 113.55 KB
Minified Size: 112.38 KB
Gzipped Size: 28 KB
```

```
Destination: dist/yup-phone.esm.js
Bundle Size: 648 B
Minified Size: 646 B
Gzipped Size: 370 B
Bundle Size: 481 B
Minified Size: 483 B
Gzipped Size: 299 B
```

```
Destination: dist/yup-phone.cjs.js
Bundle Size: 1.35 KB
Minified Size: 1.34 KB
Gzipped Size: 662 B
Bundle Size: 912 B
Minified Size: 914 B
Gzipped Size: 496 B
```

### Contributing
Expand Down
26 changes: 13 additions & 13 deletions dist/yup-phone.cjs.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
declare module "yup" {
interface StringSchema {
/**
* Check for phone number validity.
*
* @param {String} [countryCode=IN] The country code to check against.
* @param {Boolean} [strict=false] How strictly should it check.
* @param {String} [errorMessage=DEFAULT_MESSAGE] The error message to return if the validation fails.
*/
phone(countryCode?: string, strict?: boolean, errorMessage?: string): StringSchema;
}
}
export {};
import { CountryCode } from "libphonenumber-js";
declare module "yup" {
interface StringSchema {
/**
* Check for phone number validity.
*
* @param {CountryCode} [countryCode] The country code to check against.
* @param {Boolean} [strict=false] How strictly should it check.
* @param {String} [errorMessage=DEFAULT_MESSAGE] The error message to return if the validation fails.
*/
phone(countryCode?: CountryCode, strict?: boolean, errorMessage?: string): StringSchema;
}
}
6 changes: 2 additions & 4 deletions dist/yup-phone.cjs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/yup-phone.cjs.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions dist/yup-phone.esm.d.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
declare module "yup" {
interface StringSchema {
/**
* Check for phone number validity.
*
* @param {String} [countryCode=IN] The country code to check against.
* @param {Boolean} [strict=false] How strictly should it check.
* @param {String} [errorMessage=DEFAULT_MESSAGE] The error message to return if the validation fails.
*/
phone(countryCode?: string, strict?: boolean, errorMessage?: string): StringSchema;
}
}
export {};
import { CountryCode } from "libphonenumber-js";
declare module "yup" {
interface StringSchema {
/**
* Check for phone number validity.
*
* @param {CountryCode} [countryCode] The country code to check against.
* @param {Boolean} [strict=false] How strictly should it check.
* @param {String} [errorMessage=DEFAULT_MESSAGE] The error message to return if the validation fails.
*/
phone(countryCode?: CountryCode, strict?: boolean, errorMessage?: string): StringSchema;
}
}