Skip to content

Commit a2908a4

Browse files
authored
Fixed object save method params documentation
The documentation for the params required for Object's save method describes 1 param (options), but you cannot actually pass just options as an object to the save method. The correct use of the save method is described with examples in the documentation, but the additional 2 params are not documented. As the save method does accept 3 arguments (in the code as value: function (arg1, arg2, arg3) {), these params need to be added to the documentation and not just mentioned in the examples.
1 parent 1a2abb0 commit a2908a4

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

src/ParseObject.js

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,6 +1081,8 @@ class ParseObject {
10811081
* You can either call it as:<pre>
10821082
* object.save();</pre>
10831083
* or<pre>
1084+
* object.save(attrs);</pre>
1085+
* or<pre>
10841086
* object.save(null, options);</pre>
10851087
* or<pre>
10861088
* object.save(attrs, options);</pre>
@@ -1097,13 +1099,36 @@ class ParseObject {
10971099
* // The save failed. Error is an instance of Parse.Error.
10981100
* });</pre>
10991101
*
1100-
* @param {Object} options
1102+
* @param {String|Object|null} [attrs]
11011103
* Valid options are:<ul>
1102-
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
1104+
* <li>`Object` - Key/value pairs to update on the object.</li>
1105+
* <li>`String` Key - Key of attribute to update (requires arg2 to also be string)</li>
1106+
* <li>`null` - Passing null for arg1 allows you to save the object with options passed in arg2.</li>
1107+
* </ul>
1108+
*
1109+
* @param {String|Object} [options]
1110+
* <ul>
1111+
* <li>`String` Value - If arg1 was passed as a key, arg2 is the value that should be set on that key.</li>
1112+
* <li>`Object` Options - Valid options are:
1113+
* <ul>
1114+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
11031115
* be used for this request.
1116+
* <li>sessionToken: A valid session token, used for making a request on
1117+
* behalf of a specific user.
1118+
* </ul>
1119+
* </li>
1120+
* </ul>
1121+
*
1122+
* @param {Object} [options]
1123+
* Used to pass option parameters to method if arg1 and arg2 were both passed as strings.
1124+
* Valid options are:
1125+
* <ul>
1126+
* <li>useMasterKey: In Cloud Code and Node only, causes the Master Key to
1127+
* be used for this request.
11041128
* <li>sessionToken: A valid session token, used for making a request on
11051129
* behalf of a specific user.
11061130
* </ul>
1131+
*
11071132
* @return {Promise} A promise that is fulfilled when the save
11081133
* completes.
11091134
*/

0 commit comments

Comments
 (0)