protocols

Get the protocols of an input url.

protocols

Get the protocols of an input url.

$ npm i protocols
// Dependencies 
var Protocols = require("protocols");
 
console.log(Protocols("git+ssh://git@some-host.com/and-the-path/name"));
// => ["git", "ssh"] 
 
console.log(Protocols("http://ionicabizau.net", true));
// => "http" 
 

Returns the protocols of an input url.

  • String input: The input url.
  • Boolean|Number first: If true, the first protocol will be returned. If number, it will represent the zero-based index of the protocols array.
  • Array|String The array of protocols or the specified protocol.

Have an idea? Found a bug? See how to contribute.

KINDLY © Ionică Bizău–The LICENSE file contains a copy of the license.