-
-
Notifications
You must be signed in to change notification settings - Fork 600
Support object.exists() #898
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -933,6 +933,27 @@ class ParseObject { | |
| return false; | ||
| } | ||
|
|
||
| /** | ||
| * Returns true if this object exists on the Server | ||
| * | ||
| * @param {Object} options | ||
| * Valid options are:<ul> | ||
| * <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to | ||
| * be used for this request. | ||
| * <li>sessionToken: A valid session token, used for making a request on | ||
| * behalf of a specific user. | ||
| * </ul> | ||
| * @return {Promise<boolean>} A boolean promise that is fulfilled if object exists. | ||
| */ | ||
| async exists(options?: RequestOptions): Promise<boolean> { | ||
| try { | ||
| await this.fetch(options); | ||
| return true; | ||
| } catch (e) { | ||
| return false; | ||
|
||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Checks if the model is currently in a valid state. | ||
| * @return {Boolean} | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.