Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 301647b

Browse files
just-borispetebacondarwin
authored andcommitted
refactor(angular.toJson): use charAt instead of regexp
Provides a performance improvement when serializing to JSON strings. Closes angular#4093
1 parent 1c03a1b commit 301647b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Angular.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ function bind(self, fn) {
758758
function toJsonReplacer(key, value) {
759759
var val = value;
760760

761-
if (/^\$+/.test(key)) {
761+
if (typeof key === 'string' && key.charAt(0) === '$') {
762762
val = undefined;
763763
} else if (isWindow(value)) {
764764
val = '$WINDOW';

0 commit comments

Comments
 (0)