Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

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 #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

+1-1
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)