Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Sep 17, 2018
0 parents commit 5d768d6
Show file tree
Hide file tree
Showing 11 changed files with 247 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .bumpedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
files:
- package.json
plugins:
prerelease:
Adding authors:
plugin: bumped-terminal
command: npx git-authors-cli
Linting config files:
plugin: bumped-finepack
postrelease:
Generating CHANGELOG file:
plugin: bumped-changelog
Committing new version:
plugin: bumped-terminal
command: 'git add CHANGELOG.md package.json && git commit -m "Release $newVersion"'
Detecting problems before publish:
plugin: bumped-terminal
command: 'git-dirty && npm test'
Publishing tag to GitHub:
plugin: bumped-terminal
command: 'git tag $newVersion && git push && git push --tags'
Publishing to NPM:
plugin: bumped-terminal
command: npm publish
22 changes: 22 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# http://editorconfig.org

root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 100
indent_brace_style = 1TBS
spaces_around_operators = true
quote_type = auto

[package.json]
indent_style = space
indent_size = 2

[*.md]
trim_trailing_whitespace = false
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
############################
# npm
############################
node_modules
npm-debug.log
.node_history
yarn.lock
package-lock.json

############################
# tmp, editor & OS files
############################
.tmp
*.swo
*.swp
*.swn
*.swm
.DS_Store
*#
*~
.idea
*sublime*
nbproject

############################
# Tests
############################
testApp
coverage
.nyc_output

############################
# Other
############################
4 changes: 4 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
unsafe-perm=true
save-prefix=~
shrinkwrap=false
save=false
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
language: node_js
node_js:
- "node"
- "lts/*"
after_success: npm run coveralls
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright © 2018 Kiko Beats <josefrancisco.verdu@gmail.com> (kikobeats.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# is-url-http


![Last version](https://img.shields.io/github/tag/Kikobeats/is-url-http.svg?style=flat-square)
[![Build Status](https://img.shields.io/travis/Kikobeats/is-url-http/master.svg?style=flat-square)](https://travis-ci.org/Kikobeats/is-url-http)
[![Coverage Status](https://img.shields.io/coveralls/Kikobeats/is-url-http.svg?style=flat-square)](https://coveralls.io/github/Kikobeats/is-url-http)
[![Dependency status](https://img.shields.io/david/Kikobeats/is-url-http.svg?style=flat-square)](https://david-dm.org/Kikobeats/is-url-http)
[![Dev Dependencies Status](https://img.shields.io/david/dev/Kikobeats/is-url-http.svg?style=flat-square)](https://david-dm.org/Kikobeats/is-url-http#info=devDependencies)
[![NPM Status](https://img.shields.io/npm/dm/is-url-http.svg?style=flat-square)](https://www.npmjs.org/package/is-url-http)


> Check if an URL is a valid HTTP URL.
## Install

```bash
$ npm install is-url-http --save
```

## Usage

```js
const isUrlHttp = require('is-url-http')

isUrlHttp('https://kikobeats.com') // ==> true
isUrlHttp('https://kikobeats.com') // ==> true
isUrlHttp('mailto://kiko@beats.com') // ==> false
isUrlHttp('callto:192.168.103.77+type=ip') // ==> false
```

## License

**is-url-http** © [Kiko Beats](https://kikobeats.com), released under the [MIT](https://github.com/Kikobeats/is-url-http/blob/master/LICENSE.md) License.<br>
Authored and maintained by Kiko Beats with help from [contributors](https://github.com/Kikobeats/is-url-http/contributors).

> [kikobeats.com](https://kikobeats.com) · GitHub [Kiko Beats](https://github.com/Kikobeats) · Twitter [@Kikobeats](https://twitter.com/Kikobeats)
11 changes: 11 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
'use strict'

const REGEX_HTTP_PROTOCOL = /https?/i

module.exports = url => {
try {
return REGEX_HTTP_PROTOCOL.test(new URL(url).protocol)
} catch (err) {
return false
}
}
71 changes: 71 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
{
"name": "is-url-http",
"description": "Check if an URL is a valid HTTP URL.",
"homepage": "https://documentup.com/Kikobeats/is-url-http",
"version": "0.0.0",
"main": "index.js",
"author": {
"email": "josefrancisco.verdu@gmail.com",
"name": "Kiko Beats",
"url": "https://kikobeats.com"
},
"repository": {
"type": "git",
"url": "git+https://github.com/Kikobeats/is-url-http.git"
},
"bugs": {
"url": "https://github.com/Kikobeats/is-url-http/issues"
},
"keywords": [
"boolean",
"check",
"http",
"https",
"is",
"url",
"whatwg"
],
"devDependencies": {
"ava": "latest",
"coveralls": "latest",
"finepack": "latest",
"git-authors-cli": "latest",
"git-dirty": "latest",
"husky": "latest",
"lint-staged": "latest",
"nyc": "latest",
"prettier-standard": "latest",
"standard": "11",
"standard-markdown": "latest"
},
"engines": {
"node": ">= 8"
},
"files": [
"index.js"
],
"scripts": {
"clean": "rm -rf node_modules",
"coveralls": "nyc report --reporter=text-lcov | coveralls",
"lint": "standard-markdown README.md && standard",
"precommit": "lint-staged",
"pretest": "npm run lint",
"pretty": "prettier-standard index.js {core,test,bin,scripts}/**/*.js --single-quote --print-width 100",
"test": "nyc ava"
},
"license": "MIT",
"lint-staged": {
"package.json": [
"finepack",
"git add"
],
"*.js": [
"prettier-standard",
"git add"
],
"*.md": [
"standard-markdown",
"git add"
]
}
}
18 changes: 18 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
'use strict'

const test = require('ava')

const isHttpUrl = require('./')

test('true', t => {
t.is(isHttpUrl('http://kikobeats.com'), true)
t.is(isHttpUrl('https://kikobeats.com'), true)
t.is(isHttpUrl('https://www.kikobeats.com'), true)
t.is(isHttpUrl('http://www.kikobeats.com'), true)
})

test('false', t => {
t.is(isHttpUrl(), false)
t.is(isHttpUrl('callto://'), false)
t.is(isHttpUrl('mailto://'), false)
})

0 comments on commit 5d768d6

Please sign in to comment.