Comparing version 1.4.8 to 2.0.0
@@ -9,3 +9,3 @@ "use strict"; | ||
* @function | ||
* @param {String} input The input url. | ||
* @param {String|URL} input The input url (string or `URL` instance) | ||
* @param {Boolean|Number} first If `true`, the first protocol will be returned. If number, it will represent the zero-based index of the protocols array. | ||
@@ -20,5 +20,13 @@ * @return {Array|String} The array of protocols or the specified protocol. | ||
var index = input.indexOf("://"), | ||
splits = input.substring(0, index).split("+").filter(Boolean); | ||
var prots = ""; | ||
if (typeof input === "string") { | ||
try { | ||
prots = new URL(input).protocol; | ||
} catch (e) {} | ||
} else if (input && input.constructor === URL) { | ||
prots = input.protocol; | ||
} | ||
var splits = prots.split(/\:|\+/).filter(Boolean); | ||
if (typeof first === "number") { | ||
@@ -25,0 +33,0 @@ return splits[first]; |
{ | ||
"name": "protocols", | ||
"version": "1.4.8", | ||
"version": "2.0.0", | ||
"description": "Get the protocols of an input url.", | ||
@@ -31,3 +31,3 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"tester": "^1.3.1" | ||
"tester": "^1.4.5" | ||
}, | ||
@@ -49,2 +49,2 @@ "files": [ | ||
] | ||
} | ||
} |
@@ -119,3 +119,3 @@ <!-- Please do not edit this file. Edit the `blah` field in the `package.json` instead. If in doubt, open an issue. --> | ||
- **String** `input`: The input url. | ||
- **String|URL** `input`: The input url (string or `URL` instance) | ||
- **Boolean|Number** `first`: If `true`, the first protocol will be returned. If number, it will represent the zero-based index of the protocols array. | ||
@@ -182,8 +182,63 @@ | ||
- `is-ssh` | ||
- `@enkeledi/react-native-week-month-date-picker` | ||
- `bb-parse-url` | ||
- `@hemith/react-native-tnk` | ||
- `miguelcostero-ng2-toasty` | ||
- `native-kakao-login` | ||
- `react-native-my-first-try-arun-ramya` | ||
- `react-native-kakao-maps` | ||
- `react-native-is7` | ||
- `react-native-ytximkit` | ||
- `react-native-payu-payment-testing` | ||
- `npm_one_1_2_3` | ||
- `react-native-biometric-authenticate` | ||
- `react-native-arunmeena1987` | ||
- `react-native-contact-list` | ||
- `rn-adyen-dropin` | ||
- `@positionex/position-sdk` | ||
- `@corelmax/react-native-my2c2p-sdk` | ||
- `@felipesimmi/react-native-datalogic-module` | ||
- `@hawkingnetwork/react-native-tab-view` | ||
- `miguelcostero-ng2-toasty` | ||
- `react-native-cplus` | ||
- `npm_qwerty` | ||
- `native-apple-login` | ||
- `drowl-base-theme-iconset` | ||
- `react-native-arunjeyam1987` | ||
- `react-native-bubble-chart` | ||
- `react-native-flyy` | ||
- `@apardellass/react-native-audio-stream` | ||
- `@geeky-apo/react-native-advanced-clipboard` | ||
- `candlelabssdk` | ||
- `@saad27/react-native-bottom-tab-tour` | ||
- `generator-bootstrap-boilerplate-template` | ||
- `react-feedback-sdk` | ||
- `npm_one_12_34_1_` | ||
- `npm_one_2_2` | ||
- `payutesting` | ||
- `react-native-dsphoto-module` | ||
- `react-native-sayhello-module` | ||
- `react-native-responsive-size` | ||
- `@con-test/react-native-concent-common` | ||
- `luojia-cli-dev` | ||
- `birken-react-native-community-image-editor` | ||
- `reac-native-arun-ramya-test` | ||
- `react-native-arun-ramya-test` | ||
- `react-native-arunramya151` | ||
- `react-native-pulsator-native` | ||
- `react-native-plugpag-wrapper` | ||
- `react-native-transtracker-library` | ||
- `@screeb/react-native` | ||
- `@buganto/client` | ||
- `astra-ufo-sdk` | ||
- `angularvezba` | ||
- `react-native-syan-photo-picker` | ||
- `@wecraftapps/react-native-use-keyboard` | ||
- `l2forlerna` | ||
- `react-native-plugpag-wrapper` | ||
- `native-google-login` | ||
- `raact-native-arunramya151` | ||
- `react-native-modal-progress-bar` | ||
- `react-native-test-module-hhh` | ||
- `react-native-jsi-device-info` | ||
- `react-native-badge-control` | ||
- `rn-tm-notify` | ||
@@ -190,0 +245,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9293
28
273