Skip to content
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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Conversation

beast911
Copy link

No description provided.

Copy link
Owner

@joeltankam joeltankam left a 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]+)?)*)?/
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unreadable line

Copy link
Author

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) {
Copy link
Owner

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it

@@ -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', () => {
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants