This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 2 files changed +9
-4
lines changed
2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -975,7 +975,7 @@ function bind(self, fn) {
975
975
function toJsonReplacer ( key , value ) {
976
976
var val = value ;
977
977
978
- if ( typeof key === 'string' && key . charAt ( 0 ) === '$' ) {
978
+ if ( typeof key === 'string' && key . charAt ( 0 ) === '$' && key . charAt ( 1 ) === '$' ) {
979
979
val = undefined ;
980
980
} else if ( isWindow ( value ) ) {
981
981
val = '$WINDOW' ;
@@ -996,7 +996,7 @@ function toJsonReplacer(key, value) {
996
996
* @function
997
997
*
998
998
* @description
999
- * Serializes input into a JSON-formatted string. Properties with leading $ characters will be
999
+ * Serializes input into a JSON-formatted string. Properties with leading $$ characters will be
1000
1000
* stripped since angular uses this notation internally.
1001
1001
*
1002
1002
* @param {Object|Array|Date|string|number } obj Input to be serialized into JSON.
Original file line number Diff line number Diff line change @@ -1131,8 +1131,13 @@ describe('angular', function() {
1131
1131
} ) ;
1132
1132
1133
1133
1134
- it ( 'should not serialize properties starting with $' , function ( ) {
1135
- expect ( toJson ( { $few : 'v' , $$some :'value' } , false ) ) . toEqual ( '{}' ) ;
1134
+ it ( 'should not serialize properties starting with $$' , function ( ) {
1135
+ expect ( toJson ( { $$some :'value' } , false ) ) . toEqual ( '{}' ) ;
1136
+ } ) ;
1137
+
1138
+
1139
+ it ( 'should serialize properties starting with $' , function ( ) {
1140
+ expect ( toJson ( { $few : 'v' } , false ) ) . toEqual ( '{"$few":"v"}' ) ;
1136
1141
} ) ;
1137
1142
1138
1143
You can’t perform that action at this time.
0 commit comments