Skip to content
Prepend www to URLs
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
.travis.yml
LICENSE
index.js
package.json
readme.md
test.js

readme.md

prepend-www Travis (.org)

Prepend http://www. to URLs

Install

$ npm install prepend-www

or

$ yarn add prepend-www

Usage

const prependWWW = require('prepend-www');

prependWWW('http://demo.com');
//=> 'http://www.demo.com'

prependWWW('demo.com', {https: true});
//=> 'https://www.demo.com'

prependWWW('demo.com');
//=> 'http://www.demo.com'

prependWWW('localhost');
//=> 'http://www.localhost'

API

prependWWW(url, [options])

url

Type: string

URL to prepend http://www. on.

options

Type: Object

https

Type: boolean
Default: false

Prepend https://www. instead of http://www..

License

MIT © Jalal Azimi

You can’t perform that action at this time.