From 6c59e770084912d2345e7f83f983092a2d305ae3 Mon Sep 17 00:00:00 2001 From: Boris Serdyuk Date: Sat, 21 Sep 2013 12:38:09 +0400 Subject: refactor(angular.toJson): use charAt instead of regexp Provides a performance improvement when serializing to JSON strings. Closes #4093 --- src/Angular.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/Angular.js b/src/Angular.js index bf10fe34..740cd691 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -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'; -- cgit v1.2.3