npm.io
1.0.3 • Published 7 years ago

hasprotocol

Licence
MIT
Version
1.0.3
Deps
0
Size
4 kB
Vulns
0
Weekly
0

hasprotocol

Returns true/false if string starts with a protocol such as http

hasProtocol('http://') //true
hasProtocol('http://hello') //true
hasProtocol('helloworldhttp://hello') //false


hasProtocol('https://') //true
hasProtocol('https://hello') //true
hasProtocol('helloworldhttps://hello') //false


hasProtocol('localhost://') //true
hasProtocol('localhost://hello') //true
hasProtocol('helloworldlocalhost://hello') //false


hasProtocol('file:///') //true
hasProtocol('file:///') //true
hasProtocol('helloworldfile:///') //false

Keywords