Skip to content

using-jquery-core/utility-methods: add type checking section #597

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

Closed
wants to merge 1 commit into from

Conversation

arthurvr
Copy link
Member

This PR adds info about type checking utility methods to using-jquery-core/utility-methods. Would fix #404 on the while.

@RedWolves
Copy link
Member

@dmethvin can you give this a review?

$.type( new Date() ); // "date"
```

Since jQuery 1.9, `$.type()` will return `error` when calling it on error objects.
Copy link
Member

Choose a reason for hiding this comment

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

I would just let people read the docs for the details, to keep this simple.

@arthurvr
Copy link
Member Author

@RedWolves @dmethvin Updated my PR.

@dmethvin
Copy link
Member

👍

$.isNumeric(3.14); // true
```

Aditionally, there is `$.type()` which checks for the internal class used to create a value. You can see the method as a better alternative for the `typeof` operator.
Copy link
Member

Choose a reason for hiding this comment

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

Additionally is misspelled.

@@ -44,4 +44,4 @@ if ( Object.prototype.toString.call( myArray ) === "[object Array]" ) {
}
```

jQuery also offers utility methods to help determine the type of an arbitrary value.
jQuery also offers [utility methods](../using-jquery-core/utility-methods.md#testing-type) to help determine the type of an arbitrary value.
Copy link
Member

Choose a reason for hiding this comment

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

The link doesn't work it goes to /javascript-101/using-jquery-core/utility-methods.md#testing-type

You don't need the ../

You also don't need the .md

Copy link
Member

Choose a reason for hiding this comment

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

you do need a leading /

this will work /using-jquery-core/utility-methods#testing-type

Copy link
Member Author

Choose a reason for hiding this comment

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

@RedWolves fixed.

@arthurvr
Copy link
Member Author

@RedWolves Any more review on this?

@RedWolves
Copy link
Member

nope looks good. Want to go ahead and land this? You have access now it looks like.

@arthurvr arthurvr closed this in 01d432d Jan 20, 2015
@arthurvr arthurvr deleted the custom-filters branch January 20, 2015 05:56
Krinkle pushed a commit that referenced this pull request Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Cross-reference jQuery.is*() methods from Testing Types
3 participants