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

Commit 6c59e77

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 e275129 commit 6c59e77

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
@@ -781,7 +781,7 @@ function bind(self, fn) {
781781
function toJsonReplacer(key, value) {
782782
var val = value;
783783

784-
if (/^\$+/.test(key)) {
784+
if (typeof key === 'string' && key.charAt(0) === '$') {
785785
val = undefined;
786786
} else if (isWindow(value)) {
787787
val = '$WINDOW';

0 commit comments

Comments
 (0)