@@ -24,25 +24,6 @@ function lookupDottedPath(obj, path) {
24
24
return obj ;
25
25
}
26
26
27
- /**
28
- * Create a shallow copy of an object and clear other fields from the destination
29
- */
30
- function shallowClearAndCopy ( src , dst ) {
31
- dst = dst || { } ;
32
-
33
- angular . forEach ( dst , function ( value , key ) {
34
- delete dst [ key ] ;
35
- } ) ;
36
-
37
- for ( var key in src ) {
38
- if ( src . hasOwnProperty ( key ) && key . substr ( 0 , 2 ) !== '$$' ) {
39
- dst [ key ] = src [ key ] ;
40
- }
41
- }
42
-
43
- return dst ;
44
- }
45
-
46
27
/**
47
28
* @ngdoc overview
48
29
* @name ngResource
@@ -412,7 +393,7 @@ angular.module('ngResource', ['ng']).
412
393
}
413
394
414
395
function Resource ( value ) {
415
- shallowClearAndCopy ( value || { } , this ) ;
396
+ copy ( value || { } , this ) ;
416
397
}
417
398
418
399
forEach ( actions , function ( action , name ) {
@@ -484,7 +465,7 @@ angular.module('ngResource', ['ng']).
484
465
if ( data ) {
485
466
// Need to convert action.isArray to boolean in case it is undefined
486
467
// jshint -W018
487
- if ( angular . isArray ( data ) !== ( ! ! action . isArray ) ) {
468
+ if ( angular . isArray ( data ) !== ( ! ! action . isArray ) ) {
488
469
throw $resourceMinErr ( 'badcfg' , 'Error in resource configuration. Expected ' +
489
470
'response to contain an {0} but got an {1}' ,
490
471
action . isArray ?'array' :'object' , angular . isArray ( data ) ?'array' :'object' ) ;
@@ -496,7 +477,7 @@ angular.module('ngResource', ['ng']).
496
477
value . push ( new Resource ( item ) ) ;
497
478
} ) ;
498
479
} else {
499
- shallowClearAndCopy ( data , value ) ;
480
+ copy ( data , value ) ;
500
481
value . $promise = promise ;
501
482
}
502
483
}
0 commit comments