Skip to content

Commit

Permalink
Merge pull request #13 from dhershman1/development
Browse files Browse the repository at this point in the history
v4.0.1
  • Loading branch information
dhershman1 authored Jan 28, 2024
2 parents 0d653c9 + 74caa40 commit 235eb6b
Show file tree
Hide file tree
Showing 8 changed files with 1,574 additions and 1,054 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/phone-fns.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
node-version: [18.x, 20.x]

steps:
- uses: actions/checkout@v2
Expand All @@ -37,7 +37,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
node-version: [18.x, 20.x]

steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@

A small modern, and functional phone number library which gathers inspiration from the fun [date-fns](https://github.com/date-fns/date-fns) library

> [!NOTE]
> Currently Phone-Fns is focused on US based phone numbers, I am happy to welcome contributions to internationalize the library!

- [Documentation](https://phone-fns.dusty.codes/)

## How-To
Expand Down
15 changes: 15 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## v4.0.1

### New

- Added more unit tests for `isValid` and `breakdown`

### Fixed

- Added warning into README that currently phone-fns is focused on US based phone number styles
- Updated github action to LTS of node

### Chore

- Updated dependencies

## v4.0.0

### Breaking Changes
Expand Down
2,559 changes: 1,515 additions & 1,044 deletions package-lock.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "phone-fns",
"version": "4.0.0",
"version": "4.0.1",
"description": "A small, modern, and functional phone library for javascript",
"main": "dist/phone-fns.min.js",
"module": "src/index.js",
Expand Down Expand Up @@ -63,20 +63,20 @@
"license": "MIT",
"private": false,
"devDependencies": {
"@babel/core": "7.22.10",
"@babel/preset-env": "7.22.10",
"@rollup/plugin-babel": "6.0.3",
"@rollup/plugin-node-resolve": "^15.2.0",
"@rollup/plugin-terser": "0.4.3",
"@babel/core": "7.23.9",
"@babel/preset-env": "7.23.9",
"@rollup/plugin-babel": "6.0.4",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-terser": "0.4.4",
"globby": "13.2.2",
"jsdoc": "4.0.2",
"npm-run-all": "4.1.5",
"pinet": "1.1.4",
"rollup": "3.28.0",
"rollup": "4.9.6",
"rollup-plugin-filesize": "10.0.0",
"standard": "17.1.0",
"tap-on": "0.3.1",
"tape": "5.6.6"
"tape": "5.7.4"
},
"dependencies": {
"kyanite": "2.0.1"
Expand Down
9 changes: 9 additions & 0 deletions tests/breakdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ test('Test breakdown normal', t => {
t.end()
})

test('Test breakdown with placeholder syntax', t => {
const results = breakdown('555-___-____')

t.is(results.areaCode, '555', 'The area code in results was 555')
t.is(results.localCode, '___', 'The local code in results was ___')
t.is(results.lineNumber, '____', 'The lineNumber in results was ____')
t.end()
})

test('Test breakdown extension', t => {
const results = breakdown('555-444-3333 x 8989')

Expand Down
14 changes: 14 additions & 0 deletions tests/format.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,20 @@ test('Is Curried', t => {
t.end()
})

test('Handle Djibouti numbers', t => {
const result = format('+CCC NN NN NNNN', '25311223333')

t.same(result, '+253 11 22 3333')
t.end()
})

test('Handle Morocco numbers', t => {
const result = format('+CC NN NN NN NN', '0711223333')

t.same(result, '+07 11 22 33 33')
t.end()
})

test('Handles numbers without area code', t => {
const results = format('NNN.NNNN', '555-6666')

Expand Down
7 changes: 7 additions & 0 deletions tests/isValid.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,15 @@ test('Test complex type', t => {
t.end()
})

test('Test Country Code', t => {
t.ok(isValid('1 (555) 444 3333'), 'Handles country code')
t.ok(isValid('+1 (555) 444 3333'), 'Handles country code with extra symbols')
t.end()
})

test('Test invalid type', t => {
t.notOk(isValid('555444666'), 'Handles invalid length')
t.notOk(isValid('(555)-444-666'), 'Handles invalid length')
t.notOk(isValid('89965'), 'Results returned back false')
t.notOk(isValid(''), 'Handles empty string')
t.end()
Expand Down

0 comments on commit 235eb6b

Please sign in to comment.