Skip to content
This repository has been archived by the owner on Jan 5, 2024. It is now read-only.

Commit

Permalink
refactor(angular.toJson): use charAt instead of regexp
Browse files Browse the repository at this point in the history
Provides a performance improvement when serializing to JSON strings.

Closes angular#4093
  • Loading branch information
just-boris authored and petebacondarwin committed Sep 23, 2013
1 parent e275129 commit 6c59e77
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Angular.js
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ function bind(self, fn) {
function toJsonReplacer(key, value) {
var val = value;

if (/^\$+/.test(key)) {
if (typeof key === 'string' && key.charAt(0) === '$') {
val = undefined;
} else if (isWindow(value)) {
val = '$WINDOW';
Expand Down

0 comments on commit 6c59e77

Please sign in to comment.