/**
 * @author Christian Grete <webmaster@christiangrete.com>
 * @copyright &copy; 2015 Christian Grete
 * @file Provides the [instanceOf]{@link module:mout-lang-type.lang.instanceOf} utility
 * @license MIT
 */

define(
  function () {

    /**
     * Returns whether the passed value is an instance of the specified constructor
     * @author Christian Grete <webmaster@christiangrete.com>
     * @function module:mout-lang-type.lang.instanceOf
     * @license MIT
     * @param {mixed} $value The <code>object</code> or <code>primitive</code> whose prototype chain is to be checked
     * @param {function} $constructor The <code>function</code> whose prototype property is to be compared against
     * @returns {boolean} A <code>boolean</code> indicating the result of the prototypes comparison
     * @summary Checks whether a value is an instance of a constructor
     */

    function instanceOf ( $value, $constructor ) {
      if( $value == null )
        return false;

      if(
        typeof $value !== 'object'
          && typeof $value !== 'function'
      )
        $value = Object( $value );

      return (
          /*@cc_on@if(@_jscript_version<5.8)!@end@*/false
            && !$value.hasOwnProperty
          ?
            false :
              $value instanceof $constructor
        )
    }

    instanceOf.prototype = null;

    return instanceOf
  }
)

@@ -210,31 +210,195 @@
 */%0A%0A
-define(%0A  function () %7B
+// Annotations:%0A//   1. %60instanceof%60 on host objects causes memory leaks in MSIE %3C 9%0A%0Adefine(%0A  function () %7B%0A    var%0A      _objectHasNoCreateMethod = typeof Object.create !== 'function';
 %0A%0A  
@@ -1298,55 +1298,32 @@
     
-/*@cc_on@if(@_jscript_version%3C5.8)!@end@*/false
+_objectHasNoCreateMethod
 %0A   
@@ -1346,22 +1346,20 @@
 lue.
-hasOwnProperty
+valueOf // 1
 %0A   

annotate - add annotations - remove conditional comment - add feature check instead - use `valueOf` as it is shorter