File tree Expand file tree Collapse file tree 3 files changed +19
-4
lines changed
Expand file tree Collapse file tree 3 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -248,6 +248,18 @@ module.exports = function(AV) {
248248 return this . _toFullJSON ( seenObjects , false ) ;
249249 } ,
250250
251+ /**
252+ * Gets a Pointer referencing this file.
253+ * @private
254+ */
255+ _toPointer ( ) {
256+ return {
257+ __type : 'Pointer' ,
258+ className : this . className ,
259+ objectId : this . id ,
260+ } ;
261+ } ,
262+
251263 /**
252264 * Returns the ACL for this file.
253265 * @returns {AV.ACL } An instance of AV.ACL.
Original file line number Diff line number Diff line change @@ -7,14 +7,13 @@ const {
77 transformFetchOptions,
88 setValue,
99 findValue,
10+ isPlainObject,
1011} = require ( './utils' ) ;
1112
1213const recursiveToPointer = value => {
1314 if ( _ . isArray ( value ) ) return value . map ( recursiveToPointer ) ;
14- if ( _ . isObject ( value ) ) {
15- if ( value . _toPointer ) return value . _toPointer ( ) ;
16- return _ . mapObject ( value , recursiveToPointer ) ;
17- }
15+ if ( isPlainObject ( value ) ) return _ . mapObject ( value , recursiveToPointer ) ;
16+ if ( _ . isObject ( value ) && value . _toPointer ) return value . _toPointer ( ) ;
1817 return value ;
1918} ;
2019
Original file line number Diff line number Diff line change @@ -221,6 +221,9 @@ const findValue = (target, key) => {
221221 return [ value , currentTarget , lastSeg , firstSeg ] ;
222222} ;
223223
224+ const isPlainObject = obj =>
225+ _ . isObject ( obj ) && Object . getPrototypeOf ( obj ) === Object . prototype ;
226+
224227module . exports = {
225228 ajax,
226229 isNullOrUndefined,
@@ -232,4 +235,5 @@ module.exports = {
232235 parseDate,
233236 setValue,
234237 findValue,
238+ isPlainObject,
235239} ;
You can’t perform that action at this time.
0 commit comments