From 7e96af0fdd9af8c479992363f68578305df0337e Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Mon, 19 Jul 2010 12:29:24 -0700 Subject: added equals method to angular.equals and $equals --- src/Angular.js | 28 +++++++++++++++++++++++++++- src/AngularPublic.js | 1 + src/apis.js | 3 ++- 3 files changed, 30 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Angular.js b/src/Angular.js index 07e9096b..e39e31c9 100644 --- a/src/Angular.js +++ b/src/Angular.js @@ -263,6 +263,32 @@ function copy(source, destination){ } } +function equals(o1, o2) { + if (o1 == o2) return true; + var t1 = typeof o1, t2 = typeof o2, length, key, keySet; + if (t1 == t2 && t1 == 'object') { + if (o1 instanceof Array) { + if ((length = o1.length) == o2.length) { + for(key=0; key