<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -3,6 +3,16 @@ Object.extend(Object, (function() {
     return object &amp;&amp; Object.isFunction(object[property]);
   }
   
+  return {
+    hasMethod: hasMethod
+  };
+})());
+
+Object.extend(Object, (function() {
+  function hasMethod(object, property) {
+    return object &amp;&amp; Object.isFunction(object[property]);
+  }
+  
   function equal(object, other) {
     if (object === other) return true;
     if (hasMethod(object, &quot;equals&quot;)) return object.equals(other);
@@ -82,7 +92,7 @@ var Comparable = (function() {
 (function() {
   function nativelyComparable(constructor) {
     function equals(other) {
-      return this === other;
+      return !!other &amp;&amp; other.valueOf() === this.valueOf();
     }
     
     function compareTo(other) {
@@ -108,12 +118,12 @@ var Comparable = (function() {
 Object.extend(Array.prototype, (function() {
   function equals(other) {
     if (this === other) return true;
-    if (!Object.isArray(other) || this.length !== other.length) {
-      return false;
+    if (Object.isArray(other) &amp;&amp; this.length === other.length) {
+      return this.all(function(value, index) {
+        return Object.equal(value, other[index]);
+      });
     }
-    return this.all(function(value, index) {
-      return Object.equal(value, other[index]);
-    });
+    return false;
   }
   
   return {
@@ -121,8 +131,8 @@ Object.extend(Array.prototype, (function() {
   };
 })());
 
-Object.extend(Enumerable, function() {
+Object.extend(Enumerable, {
   sort: function() {
     return this.toArray().sort(Object.compare);
   }
-});
\ No newline at end of file
+});</diff>
      <filename>src/comparable.js</filename>
    </modified>
    <modified>
      <diff>@@ -31,5 +31,9 @@ new Test.Unit.Runner({
   },
   testArrayComparison: function() {
     this.assert([1,2,3].equals([1,2,3]));
+  },
+  testNativesWrappersComparison: function() {
+    this.assert(&quot;salut&quot;.equals(new String(&quot;salut&quot;)));
+    this.assert(new String(&quot;salut&quot;).equals(&quot;salut&quot;));
   }
 });</diff>
      <filename>test/comparable_test.js</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>7340552687c11d6007fd6a36f0a1517d28082fbc</id>
    </parent>
  </parents>
  <author>
    <name>Samuel Lebeau</name>
    <email>samuel.lebeau@gmail.com</email>
  </author>
  <url>http://github.com/samleb/prototype-fruits/commit/f1032a859f0f54318d1c04c9683e7c5b6a3322b1</url>
  <id>f1032a859f0f54318d1c04c9683e7c5b6a3322b1</id>
  <committed-date>2009-05-23T12:44:43-07:00</committed-date>
  <authored-date>2009-05-23T12:44:43-07:00</authored-date>
  <message>Ensure `equals` behaves correctly with native/wrapper types</message>
  <tree>11204f0bb2f6fcf2a80d20b1719ac87fb88df4ab</tree>
  <committer>
    <name>Samuel Lebeau</name>
    <email>samuel.lebeau@gmail.com</email>
  </committer>
</commit>
