-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add isuri to types #64
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution.
Some changes needed. Also, please update documentation.
src/is/types.js
Outdated
@@ -1,4 +1,5 @@ | |||
const { toString } = Object.prototype; | |||
const uriRegex = /^([a-z]+\:\/{2})(([a-zA-Z0-9]+([_ -]*[a-zA-Z0-9])*)(:[!#$%^&*\)(}{\[\]\\\|\/\~\`\;\"\'\?\>\<\+\-\.a-zA-Z0-9]*@)?)?([w]{3}\.)?([a-zA-Z0-9]+([_ -]*[a-zA-Z0-9])*\.[a-z]*)(\:[\d]*)?(\/[a-zA-Z0-9]+(\.[a-zA-Z]+)?)*((\?[a-zA-Z]+\=[a-zA-Z0-9]+)*)?((\#[a-zA-Z]+(\=[a-zA-Z0-9]+)?)*)?/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unreadable line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay i will update this
src/is/types.js
Outdated
* @param {*} value the value to check | ||
* @returns {Boolean} `true` if the value is a URI; otherwise, `false` | ||
*/ | ||
export function isURI(value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't be in this file, but rather regexp.js
as mentioned in the issue description.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it
test/is/types.test.js
Outdated
@@ -238,6 +238,25 @@ describe('isWindowObject', () => { | |||
testFalsyWithNullable(is.windowObject); | |||
}); | |||
|
|||
describe('isURI', () => { | |||
const uriFull = "http://abc:[email protected]/path1/path2?param1=value1?param2=value2#frag1=fragvalue1"; | |||
test('should return true on correct URI string', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow the same syntax as the existing tests
…nto isuriregex
No description provided.