code: function registerExtension(extension) {
      try {
          var ext; // Actual extension
  
          if (is(extension, 'buildCore', 'function')) {
              // If extension has buildCore function then give it an instance of the core.
              extension.buildCore(self);
              addOne(extensions, extension);
              return; // No need to extend as that will be handled in buildCore
          }
  
          if (is(extension, 'function')) {
              // If extension is a function then give it an instance of the core.
              ext = extension(self);
          } else if (has(extension, 'core')) {
              // If extension has `core` property then extend core with it.
              ext = extension.core;
          } else {
              // Otherwise extend core with the extension itself.
              ext = extension;
          }
  
          if (ext) {
              extend(self, ext);
              addOne(extensions, extension);
          }
      } catch (ex) {
          error('Fatal error during application initialization. ', 'Failed to build core with extension "', extension, 'See following exception for more details.', ex);
      }
  
      return extension;
  }
docs: Registers an extension to the sandbox
  
  @param {Function|Object} extension function to create the extension or
  object representing the extension
  @memberOf core
   
  Provides core functionality of scalejs
  @namespace scalejs.core
  @module core
   /*global define