phone-fns
Advanced tools
Comparing version 1.0.0 to 1.0.1
# Changelog | ||
## v1.0.1 | ||
### New | ||
- Rebuilt the architecture of the main source (has no effect on usage) | ||
- Added in CDN info to documentation | ||
- Building using Rollup now instead of webpack decreasing the overall file size of our main file to 1.86kb (vs 3.83kb with webpack) and 970B gzipped | ||
- This also benefits each individual functions build so they're also much smaller | ||
- Converting testing to latest babel versions | ||
- Convert linter from `eslint` to `standardjs` | ||
- Created an uncompressed build along with the compressed one which you can use in dev for easier debugging | ||
### Fixed | ||
- For some reason I didn't realize the package.json main was looking at a index.js file | ||
- Re built automated documentation script so it performs faster | ||
## v1.0.0 | ||
@@ -4,0 +21,0 @@ |
@@ -1,1 +0,1 @@ | ||
module.exports = [{"title":"breakdown","since":"v0.1.0","category":"Function","syntax":"breakdown(countryCode, phone)","usage":{"commonjs":{"title":"CommonJs","code":"const breakdown = require('phone-fns/breakdown');"},"standard":{"title":"Standard","code":"import breakdown from 'phone-fns/breakdown';"},"browser":{"title":"Browser","code":"<script src=\"path/to/node_modules/phone-fns/breakdown/index.js\"></script>"}},"desc":"Takes a provided phone string and breaks it down into an object of codes","examples":["breakdown('', '111-222-3333');\r// => { countryCode: '', areaCode: '111', localCode: '222', lineNumber: '3333', extension: '' }\r\rbreakdown('1787', '5554441111');\r// => { countryCode: 1787, areaCode: '555', localCode: '444', lineNumber: '1111', extension: '' }\r\rbreakdown('', '555-444-3333 x 8989');\r// => { countryCode: '', areaCode: '555', localCode: '444', lineNumber: '3333', extension: 8989 }\r\r// Breakdown is curried\rconst breaker = breakdown('');\r\rbreaker('222-333-4444'); // => { areaCode: '222', localCode: '333', lineNumber: '4444' }"],"params":[{"type":{"names":["String"]},"description":"The provided country code for the number","name":"countryCode"},{"type":{"names":["String"]},"description":"The phone number to breakdown","name":"phone"}],"returns":[{"type":{"names":["Object"]},"description":"Returns an object of the broken down phone number"}]},{"title":"find","since":"v0.1.0","category":"Function","syntax":"find(phone, type)","usage":{"commonjs":{"title":"CommonJs","code":"const find = require('phone-fns/find');"},"standard":{"title":"Standard","code":"import find from 'phone-fns/find';"},"browser":{"title":"Browser","code":"<script src=\"path/to/node_modules/phone-fns/find/index.js\"></script>"}},"desc":"Find a piece of the phone number and return it","examples":["find('areaCode', '555-444-1111'); // => '555'\nfind('localCode', '555-444-1111'); // => '444'\nfind('lineNumber', '555-444-1111'); // => '1111'\nfind('countryCode', '1555-444-1111'); // => '1'\nfind('extension', '555-444-1111 8989'); // => '8989'\n\n// find is also curried\n\nconst finder = find('areaCode');\n\nfinder('555-444-1111'); // => '555'"],"params":[{"type":{"names":["String"]},"description":"The phone number to breakdown","name":"phone"},{"type":{"names":["String"]},"description":"The piece of the phone to look for","name":"type"}],"returns":[{"type":{"names":["String"]},"description":"Returns a string from the desired part of the phone number"}]},{"title":"replaceLayout","since":"Unknown","syntax":"replaceLayout()","usage":{"commonjs":{"title":"CommonJs","code":"const replaceLayout = require('phone-fns/replaceLayout');"},"standard":{"title":"Standard","code":"import replaceLayout from 'phone-fns/replaceLayout';"},"browser":{"title":"Browser","code":"<script src=\"path/to/node_modules/phone-fns/replaceLayout/index.js\"></script>"}},"desc":"L = Local Code\rA = Area Code\rN = Line Number\rE = Extension\rC = Country Code\rExample:\r\rformat(phone, '(AAA)-LLL-NNNN');","params":[]},{"title":"isValid","since":"v0.1.0","category":"Function","syntax":"isValid(phone, country)","usage":{"commonjs":{"title":"CommonJs","code":"const isValid = require('phone-fns/isValid');"},"standard":{"title":"Standard","code":"import isValid from 'phone-fns/isValid';"},"browser":{"title":"Browser","code":"<script src=\"path/to/node_modules/phone-fns/isValid/index.js\"></script>"}},"desc":"Validates the base number, does not take the country code or extension into consideration for this validation","examples":["isValid('555-444-3333'); // => true"],"params":[{"type":{"names":["String"]},"description":"The phone number to breakdown","name":"phone"},{"type":{"names":["String"]},"description":"The country name to validate with","name":"country"}],"returns":[{"type":{"names":["Boolean"]},"description":"Returns a boolean if the number provided is valid or not\rphone && (/^\\+?([0-9]{2})\\)?[-. ]?([0-9]{4})[-. ]?([0-9]{4})$/).test(uglify(phone));"}]},{"title":"match","since":"v1.0.0","category":"Function","syntax":"match(x, y)","usage":{"commonjs":{"title":"CommonJs","code":"const match = require('phone-fns/match');"},"standard":{"title":"Standard","code":"import match from 'phone-fns/match';"},"browser":{"title":"Browser","code":"<script src=\"path/to/node_modules/phone-fns/match/index.js\"></script>"}},"desc":"Checks if the two provided numbers are matching or not","examples":["match('5554443333', '5554443333'); // => true\nmatch('5554443333', '555-444-3333'); // => true\nmatch('555-444-3333', '555-444-3333'); // => true\nmatch('555.444.3333', '555-444-3333'); // => true\n\n// Or use it as a curried function\n\nconst matcher = match('5554443333');\n\nmatcher('555-444-3333'); // => true\nmatcher('555.444.3333'); // => true\nmatcher('555.444.2222'); // => false"],"params":[{"type":{"names":["String"]},"description":"The number to validate against","name":"x"},{"type":{"names":["String"]},"description":"The number to validate","name":"y"}],"returns":[{"type":{"names":["Boolean"]},"description":"Returns a boolean if the numbers provided to match"}]},{"title":"uglify","since":"v0.1.0","category":"Function","syntax":"uglify(phone)","usage":{"commonjs":{"title":"CommonJs","code":"const uglify = require('phone-fns/uglify');"},"standard":{"title":"Standard","code":"import uglify from 'phone-fns/uglify';"},"browser":{"title":"Browser","code":"<script src=\"path/to/node_modules/phone-fns/uglify/index.js\"></script>"}},"desc":"Strips all of the special characters from the given string","examples":["const results = uglify('555-444-3333'); // => '5554443333'"],"params":[{"type":{"names":["String"]},"description":"The phone number to trim and strip down","name":"phone"}],"returns":[{"type":{"names":["String"]},"description":"Returns the newly created phone number string"}]}] | ||
module.exports = [{"since":"v0.1.0","category":"Function","title":"breakdown","desc":"Takes a provided phone string and breaks it down into an object of codes","examples":["breakdown('', '111-222-3333');\r// => { countryCode: '', areaCode: '111', localCode: '222', lineNumber: '3333', extension: '' }\r\rbreakdown('1787', '5554441111');\r// => { countryCode: 1787, areaCode: '555', localCode: '444', lineNumber: '1111', extension: '' }\r\rbreakdown('', '555-444-3333 x 8989');\r// => { countryCode: '', areaCode: '555', localCode: '444', lineNumber: '3333', extension: 8989 }\r\r// Breakdown is curried\rconst breaker = breakdown('');\r\rbreaker('222-333-4444'); // => { areaCode: '222', localCode: '333', lineNumber: '4444' }"],"returns":[{"type":{"names":["Object"]},"description":"Returns an object of the broken down phone number"}],"params":[{"type":{"names":["String"]},"description":"The provided country code for the number","name":"countryCode"},{"type":{"names":["String"]},"description":"The phone number to breakdown","name":"phone"}],"syntax":"breakdown(countryCode, phone)","usage":{"commonjs":{"title":"CommonJs","code":"const breakdown = require('phone-fns/breakdown');"},"standard":{"title":"Standard","code":"import breakdown from 'phone-fns/breakdown';"},"cdn":{"title":"CDN","code":"<script src=\"https://cdn.jsdelivr.net/npm/phone-fns@1.0.1/breakdown.js\"></script>"},"browser":{"title":"Browser","code":"<script src=\"path/to/node_modules/phone-fns/breakdown.js\"></script>"}}},{"since":"v0.1.0","category":"Function","title":"find","desc":"Find a piece of the phone number and return it","examples":["find('areaCode', '555-444-1111'); // => '555'\rfind('localCode', '555-444-1111'); // => '444'\rfind('lineNumber', '555-444-1111'); // => '1111'\rfind('countryCode', '1555-444-1111'); // => '1'\rfind('extension', '555-444-1111 8989'); // => '8989'\r\r// find is also curried\r\rconst finder = find('areaCode');\r\rfinder('555-444-1111'); // => '555'"],"returns":[{"type":{"names":["String"]},"description":"Returns a string from the desired part of the phone number"}],"params":[{"type":{"names":["String"]},"description":"The phone number to breakdown","name":"phone"},{"type":{"names":["String"]},"description":"The piece of the phone to look for","name":"type"}],"syntax":"find(phone, type)","usage":{"commonjs":{"title":"CommonJs","code":"const find = require('phone-fns/find');"},"standard":{"title":"Standard","code":"import find from 'phone-fns/find';"},"cdn":{"title":"CDN","code":"<script src=\"https://cdn.jsdelivr.net/npm/phone-fns@1.0.1/find.js\"></script>"},"browser":{"title":"Browser","code":"<script src=\"path/to/node_modules/phone-fns/find.js\"></script>"}}},{"since":"v0.1.0","category":"Function","title":"format","desc":"Allows you to format phone numbers however you desire\rL = Local Code\rA = Area Code\rN = Line Number\rE = Extension\rC = Country Code","examples":["format('444-555-6666', '(AAA) LLL.NNNN'); // => '(444) 555.6666'\rformat('1444-555-6666', 'C + (AAA) LLL.NNNN', true); // => '1 + (444) 555.6666'\rformat('444-555-66668989', '(AAA) LLL.NNNN x EEEE'); // => '(444) 555.6666 x 8989'\r\r// Format is also curried\rconst noCC = format('');\rconst withLayout = format('', 'AAA.LLL.NNNN');\r\rnoCC('AAA-LLL-NNNN', '4445556666'); // => '444-555-6666'\rwithLayout('4445556666'); // => '444.555.6666'"],"returns":[{"type":{"names":["String"]},"description":"Returns a string which is the formatted phone number"}],"params":[{"type":{"names":["String"]},"description":"The provided country code for the number","name":"countryCode"},{"type":{"names":["String"]},"description":"The desired layout of the phone number","name":"layout"},{"type":{"names":["String"]},"description":"The phone number to breakdown","name":"phone"}],"syntax":"format(countryCode, layout, phone)","usage":{"commonjs":{"title":"CommonJs","code":"const format = require('phone-fns/format');"},"standard":{"title":"Standard","code":"import format from 'phone-fns/format';"},"cdn":{"title":"CDN","code":"<script src=\"https://cdn.jsdelivr.net/npm/phone-fns@1.0.1/format.js\"></script>"},"browser":{"title":"Browser","code":"<script src=\"path/to/node_modules/phone-fns/format.js\"></script>"}}},{"since":"v0.1.0","category":"Function","title":"isValid","desc":"Validates the base number, does not take the country code or extension into consideration for this validation","examples":["isValid('555-444-3333'); // => true"],"returns":[{"type":{"names":["Boolean"]},"description":"Returns a boolean if the number provided is valid or not\rphone && (/^\\+?([0-9]{2})\\)?[-. ]?([0-9]{4})[-. ]?([0-9]{4})$/).test(uglify(phone));"}],"params":[{"type":{"names":["String"]},"description":"The phone number to breakdown","name":"phone"},{"type":{"names":["String"]},"description":"The country name to validate with","name":"country"}],"syntax":"isValid(phone, country)","usage":{"commonjs":{"title":"CommonJs","code":"const isValid = require('phone-fns/isValid');"},"standard":{"title":"Standard","code":"import isValid from 'phone-fns/isValid';"},"cdn":{"title":"CDN","code":"<script src=\"https://cdn.jsdelivr.net/npm/phone-fns@1.0.1/isValid.js\"></script>"},"browser":{"title":"Browser","code":"<script src=\"path/to/node_modules/phone-fns/isValid.js\"></script>"}}},{"since":"v1.0.0","category":"Function","title":"match","desc":"Checks if the two provided numbers are matching or not","examples":["match('5554443333', '5554443333'); // => true\rmatch('5554443333', '555-444-3333'); // => true\rmatch('555-444-3333', '555-444-3333'); // => true\rmatch('555.444.3333', '555-444-3333'); // => true\r\r// Or use it as a curried function\r\rconst matcher = match('5554443333');\r\rmatcher('555-444-3333'); // => true\rmatcher('555.444.3333'); // => true\rmatcher('555.444.2222'); // => false"],"returns":[{"type":{"names":["Boolean"]},"description":"Returns a boolean if the numbers provided to match"}],"params":[{"type":{"names":["String"]},"description":"The number to validate against","name":"x"},{"type":{"names":["String"]},"description":"The number to validate","name":"y"}],"syntax":"match(x, y)","usage":{"commonjs":{"title":"CommonJs","code":"const match = require('phone-fns/match');"},"standard":{"title":"Standard","code":"import match from 'phone-fns/match';"},"cdn":{"title":"CDN","code":"<script src=\"https://cdn.jsdelivr.net/npm/phone-fns@1.0.1/match.js\"></script>"},"browser":{"title":"Browser","code":"<script src=\"path/to/node_modules/phone-fns/match.js\"></script>"}}},{"since":"v0.1.0","category":"Function","title":"uglify","desc":"Strips all of the special characters from the given string","examples":["const results = uglify('555-444-3333'); // => '5554443333'"],"returns":[{"type":{"names":["String"]},"description":"Returns the newly created phone number string"}],"params":[{"type":{"names":["String"]},"description":"The phone number to trim and strip down","name":"phone"}],"syntax":"uglify(phone)","usage":{"commonjs":{"title":"CommonJs","code":"const uglify = require('phone-fns/uglify');"},"standard":{"title":"Standard","code":"import uglify from 'phone-fns/uglify';"},"cdn":{"title":"CDN","code":"<script src=\"https://cdn.jsdelivr.net/npm/phone-fns@1.0.1/uglify.js\"></script>"},"browser":{"title":"Browser","code":"<script src=\"path/to/node_modules/phone-fns/uglify.js\"></script>"}}}] |
{ | ||
"name": "phone-fns", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Small and simple functional phone library", | ||
"main": "index.js", | ||
"main": "dist/phone-fns.min.js", | ||
"scripts": { | ||
"prepack": "webpack && webpack --config webpack.dist.js && node scripts/docs.js", | ||
"prepack": "rollup -c && rollup -c rollup.split.js && node scripts/docs.js", | ||
"clean": "node scripts/clean.js", | ||
"build": "webpack", | ||
"build:dist": "webpack --config webpack.dist.js", | ||
"build": "rollup -c", | ||
"build:split": "rollup -c rollup.split.js", | ||
"postpublish": "node scripts/clean.js", | ||
"lint": "eslint ./src", | ||
"lint": "standard src/**/*.js", | ||
"test:watch": "ava --watch", | ||
"test": "ava" | ||
}, | ||
"babel": { | ||
"presets": [ | ||
"env", | ||
"@ava/stage-4", | ||
"@ava/transform-test-files" | ||
] | ||
}, | ||
"ava": { | ||
"files": [ | ||
"src/**/tests.js" | ||
"test/*.js" | ||
], | ||
"source": [ | ||
"src/**/*.js" | ||
"require": [ | ||
"@babel/register" | ||
], | ||
"failFast": true, | ||
"concurrency": 5, | ||
"require": [ | ||
"babel-register" | ||
], | ||
"babel": "inherit", | ||
"failFast": true | ||
"babel": { | ||
"testOptions": { | ||
"presets": [ | ||
"@ava/transform-test-files", | ||
"@ava/stage-4" | ||
] | ||
} | ||
} | ||
}, | ||
"standard": { | ||
"ignore": [ | ||
"docs.js", | ||
"dist/*" | ||
] | ||
}, | ||
"repository": { | ||
@@ -58,14 +61,23 @@ "type": "git", | ||
"devDependencies": { | ||
"ava": "0.25.0", | ||
"babel": "6.23.0", | ||
"babel-loader": "7.1.2", | ||
"babel-preset-env": "1.6.1", | ||
"babel-register": "6.26.0", | ||
"@babel/core": "7.0.0-beta.46", | ||
"@babel/preset-env": "7.0.0-beta.46", | ||
"@babel/preset-stage-0": "7.0.0-beta.46", | ||
"@babel/preset-stage-2": "7.0.0-beta.46", | ||
"@babel/register": "7.0.0-beta.46", | ||
"ava": "1.0.0-beta.4", | ||
"del": "3.0.0", | ||
"eslint": "4.14.0", | ||
"globby": "8.0.1", | ||
"jsdoc-to-markdown": "4.0.1", | ||
"webpack": "4.0.1", | ||
"webpack-cli": "2.0.9" | ||
"rollup": "0.58.1", | ||
"rollup-plugin-babel": "4.0.0-beta.4", | ||
"rollup-plugin-cleanup": "2.0.1", | ||
"rollup-plugin-filesize": "1.5.0", | ||
"rollup-plugin-uglify": "3.0.0", | ||
"standard": "11.0.1" | ||
}, | ||
"config": { | ||
"commitizen": { | ||
"path": "./node_modules/cz-conventional-changelog" | ||
} | ||
} | ||
} |
@@ -1,2 +0,4 @@ | ||
[![npm](https://img.shields.io/npm/v/phone-fns.svg?style=for-the-badge)](https://www.npmjs.com/package/phone-fns) [![David](https://img.shields.io/david/dhershman1/phone-fns.svg?style=for-the-badge)](https://david-dm.org/dhershman1/phone-fns) [![Travis](https://img.shields.io/travis/dhershman1/phone-fns.svg?style=for-the-badge)](https://travis-ci.org/dhershman1/phone-fns) | ||
[![npm](https://img.shields.io/npm/v/phone-fns.svg?style=for-the-badge)](https://www.npmjs.com/package/phone-fns) | ||
[![David](https://img.shields.io/david/dhershman1/phone-fns.svg?style=for-the-badge)](https://david-dm.org/dhershman1/phone-fns) | ||
[![Travis](https://img.shields.io/travis/dhershman1/phone-fns.svg?style=for-the-badge)](https://travis-ci.org/dhershman1/phone-fns) | ||
@@ -7,3 +9,3 @@ # phone-fns | ||
- [Documentation](https://dusty-demos.herokuapp.com/phone-fns) | ||
- [Documentation](https://www.dusty.codes/phone-fns) | ||
@@ -32,3 +34,3 @@ ## How-To | ||
In v2.0.0 of Phone-Fns the main import is used to create separate instances in order to make usage easier as well as the library smaller. | ||
In v1.0.0 of Phone-Fns the main import is used to create separate instances in order to make usage easier as well as the library smaller. | ||
@@ -35,0 +37,0 @@ Basic usage can be done like so, this is without setting a country code for the instance we create. |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Empty package
Supply chain riskPackage does not contain any code. It may be removed, is name squatting, or the result of a faulty package publish.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
44169
23
452
259
1
15