Browse files

whitespace cleanup and removal of smart apostrophes

  • Loading branch information...
1 parent 985525d commit 36c171ffadd709ff3667c25b3e023f813d7b3525 @paulirish paulirish committed May 23, 2012
Showing with 69 additions and 69 deletions.
  1. +34 −34 dist/es6-module-loader.js
  2. +2 −2 dist/es6-module-loader.min.js
  3. +33 −33 lib/es6-module-loader.js
View
68 dist/es6-module-loader.js
@@ -1,17 +1,17 @@
-/*! es6-module-loader - v0.1.0 - 5/20/2012
+/*! es6-module-loader - v0.1.0 - 5/22/2012
* https://github.com/addyosmani/es6-module-loader
* Copyright (c) 2012 Luke Hogan, Addy Osmani; Licensed MIT */
(function (global) {
// new Loader( parent [, options ] ) - Module loader constructor
- // The Loader constructor creates a new loader. The first argument is the
- // parent loader. The second is an options object
+ // The Loader constructor creates a new loader. The first argument is the
+ // parent loader. The second is an options object
//
- // options.global - The loaders global object
- // options.baseURL - The loaders base URL
- // options.linkedTo - The source of the loaders intrinsics (not impl)
+ // options.global - The loader's global object
+ // options.baseURL - The loader's base URL
+ // options.linkedTo - The source of the loader's intrinsics (not impl)
// options.strict - should code evaluated in the loader be in strict mode?
// options.resolve( relURL, baseURL ) - The URL resolution hook
// options.fetch( relURL, baseURL, request, resolved ) - The module loading hook
@@ -52,11 +52,11 @@
// Loader.prototype.load( url, callback, errback )
- //
- // The load method takes a string representing a module URL and a
- // callback that receives the result of loading, compiling, and
- // executing the module at that URL. The compiled code is statically
- // associated with this loader, and its URL is the given URL. The
+ //
+ // The load method takes a string representing a module URL and a
+ // callback that receives the result of loading, compiling, and
+ // executing the module at that URL. The compiled code is statically
+ // associated with this loader, and its URL is the given URL. The
// additional callback is used if an error occurs.
Loader.prototype.load = function (url, callback, errback) {
var key = this._resolve(url, this._baseURL);
@@ -73,7 +73,7 @@
if (self._strict) {
actualSrc = "'use strict';\n" + actualSrc;
}
-
+
evalSrc = eval(actualSrc);
self.set(url, evalSrc);
callback(self._mios[key]);
@@ -89,7 +89,7 @@
};
// Loader.prototype.eval( src )
- // The eval method takes a string representing a Program and returns
+ // The eval method takes a string representing a Program and returns
// the result of compiling and executing the program.
Loader.prototype.eval = function (sourceText) {
with(this._global) {
@@ -100,10 +100,10 @@
// Loader.prototype.evalAsync( src, callback, errback )
//
- // The evalAsync method takes a string representing a Program and a
- // callback that receives the result of compiling and executing the
- // program. The compiled code is statically associated with this loader,
- // and its URL is the base URL of this loader. The additional callback
+ // The evalAsync method takes a string representing a Program and a
+ // callback that receives the result of compiling and executing the
+ // program. The compiled code is statically associated with this loader,
+ // and its URL is the base URL of this loader. The additional callback
// is used if an error occurs.
Loader.prototype.evalAsync = function () {
@@ -113,19 +113,19 @@
// Loader.prototype.get( url )
//
- // The get method looks up a module in the loaders module instance table.
- // The URL is resolved to a key by calling the loaders resolve operation.
+ // The get method looks up a module in the loader's module instance table.
+ // The URL is resolved to a key by calling the loader's resolve operation.
Loader.prototype.get = function (url) {
var key = this._resolve(url, this._baseURL);
return this._mios[key];
};
// Loader.prototype.set( urlOrMods[, mod ] )
- //
- // The set method stores a module or set of modules in the loader’s
- // module instance table. Each URL is resolved to a key by calling
- // the loaders resolve operation.
+ //
+ // The set method stores a module or set of modules in the loader's
+ // module instance table. Each URL is resolved to a key by calling
+ // the loader's resolve operation.
Loader.prototype.set = function (url, mio) {
var key = this._resolve(url, this._baseURL);
if (typeof url === "string") {
@@ -139,9 +139,9 @@
// Loader.prototype.defineBuiltins( [ obj ] )
//
- // The defineBuiltins method takes an object and defines all the built-in
- // objects and functions of the ES6 standard library associated with this
- // loaders intrinsics as properties on the object.
+ // The defineBuiltins method takes an object and defines all the built-in
+ // objects and functions of the ES6 standard library associated with this
+ // loader's intrinsics as properties on the object.
Loader.prototype.defineBuiltins = function (o) {
if (typeof o != "object") throw new Error("Expected object");
for (var globalProp in global) {
@@ -152,15 +152,15 @@
function Module(o) {
-
+
if (o === null) throw new TypeError("Expected object");
- var obj = Object(o);
+ var obj = Object(o);
if (obj instanceof Module) {
- return obj;
+ return obj;
} else {
- var mio = Object.create(null);
-
+ var mio = Object.create(null);
+
for (var key in obj) {
(function (key) {
Object.defineProperty(mio, key, {
@@ -172,7 +172,7 @@
});
})(key);
}
-
+
return mio;
}
};
@@ -215,5 +215,5 @@
// Export the System object
global.System = defaultSystemLoader;
-
-})(window);
+
+})(window);
View
4 dist/es6-module-loader.min.js
@@ -1,4 +1,4 @@
-/*! es6-module-loader - v0.1.0 - 5/20/2012
+/*! es6-module-loader - v0.1.0 - 5/22/2012
* https://github.com/addyosmani/es6-module-loader
* Copyright (c) 2012 Luke Hogan, Addy Osmani; Licensed MIT */
-(function(global){function Loader(a,b){this._global=b.global||Object.create(null),this._baseURL=b.baseURL||this.global&&this.global.baseURL;if(b.linkedTo===null||b.linkedTo)throw new Error("Setting 'linkedTo' not yet supported.");this._strict=b.string===undefined?!1:!!b.string,this._resolve=b.resolve||a.resolve,this._fetch=b.fetch||a.fetch,this._translate=b.translate||a.translate,this._mios={}}function Module(a){if(a===null)throw new TypeError("Expected object");var b=Object(a);if(b instanceof Module)return b;var c=Object.create(null);for(var d in b)(function(a){Object.defineProperty(c,a,{configurable:!1,enumerable:!0,get:function(){return b[a]}})})(d);return c}Object.defineProperty(Loader.prototype,"global",{configurable:!0,enumerable:!0,get:function(){return this._global}}),Object.defineProperty(Loader.prototype,"baseURL",{configurable:!0,enumerable:!0,get:function(){return this._baseURL}}),Loader.prototype.load=function(url,callback,errback){var key=this._resolve(url,this._baseURL);if(this._mios[key])callback(this._mios[key]);else{var self=this;this._fetch(url,this._baseURL,{fulfill:function(src){var actualSrc,evalSrc;actualSrc=self._translate(src,url,self._baseURL,key),self._strict&&(actualSrc="'use strict';\n"+actualSrc),evalSrc=eval(actualSrc),self.set(url,evalSrc),callback(self._mios[key])},redirect:function(a,b){throw new Error("'redirect' not yet implemented")},reject:function(a){errback(a)}},key)}},Loader.prototype.eval=function(sourceText){with(this._global)eval(sourceText)},Loader.prototype.evalAsync=function(){throw new Error("'evalAsync' is not yet implemented. Its not required until module syntax is natively available.")},Loader.prototype.get=function(a){var b=this._resolve(a,this._baseURL);return this._mios[b]},Loader.prototype.set=function(a,b){var c=this._resolve(a,this._baseURL);if(typeof a=="string")this._mios[c]=Module(b);else for(var d in c)this._mios[d]=Module(c[d])},Loader.prototype.defineBuiltins=function(a){if(typeof a!="object")throw new Error("Expected object");for(var b in global)a[b]=global;return a};var defaultSystemLoader=new Loader(null,{global:window,baseURL:document.URL.substring(0,document.URL.lastIndexOf("/")+1),strict:!1,resolve:function(a,b){var c=b+a;return c},fetch:function(a,b,c,d){var e=b+a,f=new XMLHttpRequest;f.onreadystatechange=function(){f.readyState===4&&(f.status===200?c.fulfill(f.responseText):c.reject(f.statusText))},f.open("GET",e,!0),f.send(null)},translate:function(a,b,c,d){return a}});global.Loader=Loader,global.Module=Module,global.System=defaultSystemLoader})(window)
+(function(global){function Loader(a,b){this._global=b.global||Object.create(null),this._baseURL=b.baseURL||this.global&&this.global.baseURL;if(b.linkedTo===null||b.linkedTo)throw new Error("Setting 'linkedTo' not yet supported.");this._strict=b.string===undefined?!1:!!b.string,this._resolve=b.resolve||a.resolve,this._fetch=b.fetch||a.fetch,this._translate=b.translate||a.translate,this._mios={}}function Module(a){if(a===null)throw new TypeError("Expected object");var b=Object(a);if(b instanceof Module)return b;var c=Object.create(null);for(var d in b)(function(a){Object.defineProperty(c,a,{configurable:!1,enumerable:!0,get:function(){return b[a]}})})(d);return c}Object.defineProperty(Loader.prototype,"global",{configurable:!0,enumerable:!0,get:function(){return this._global}}),Object.defineProperty(Loader.prototype,"baseURL",{configurable:!0,enumerable:!0,get:function(){return this._baseURL}}),Loader.prototype.load=function(url,callback,errback){var key=this._resolve(url,this._baseURL);if(this._mios[key])callback(this._mios[key]);else{var self=this;this._fetch(url,this._baseURL,{fulfill:function(src){var actualSrc,evalSrc;actualSrc=self._translate(src,url,self._baseURL,key),self._strict&&(actualSrc="'use strict';\n"+actualSrc),evalSrc=eval(actualSrc),self.set(url,evalSrc),callback(self._mios[key])},redirect:function(a,b){throw new Error("'redirect' not yet implemented")},reject:function(a){errback(a)}},key)}},Loader.prototype.eval=function(sourceText){with(this._global)eval(sourceText)},Loader.prototype.evalAsync=function(){throw new Error("'evalAsync' is not yet implemented. Its not required until module syntax is natively available.")},Loader.prototype.get=function(a){var b=this._resolve(a,this._baseURL);return this._mios[b]},Loader.prototype.set=function(a,b){var c=this._resolve(a,this._baseURL);if(typeof a=="string")this._mios[c]=Module(b);else for(var d in c)this._mios[d]=Module(c[d])},Loader.prototype.defineBuiltins=function(a){if(typeof a!="object")throw new Error("Expected object");for(var b in global)a[b]=global;return a};var defaultSystemLoader=new Loader(null,{global:window,baseURL:document.URL.substring(0,document.URL.lastIndexOf("/")+1),strict:!1,resolve:function(a,b){var c=b+a;return c},fetch:function(a,b,c,d){var e=b+a,f=new XMLHttpRequest;f.onreadystatechange=function(){f.readyState===4&&(f.status===200?c.fulfill(f.responseText):c.reject(f.statusText))},f.open("GET",e,!0),f.send(null)},translate:function(a,b,c,d){return a}});global.Loader=Loader,global.Module=Module,global.System=defaultSystemLoader})(window);
View
66 lib/es6-module-loader.js
@@ -10,12 +10,12 @@
// new Loader( parent [, options ] ) - Module loader constructor
- // The Loader constructor creates a new loader. The first argument is the
- // parent loader. The second is an options object
+ // The Loader constructor creates a new loader. The first argument is the
+ // parent loader. The second is an options object
//
- // options.global - The loaders global object
- // options.baseURL - The loaders base URL
- // options.linkedTo - The source of the loaders intrinsics (not impl)
+ // options.global - The loader's global object
+ // options.baseURL - The loader's base URL
+ // options.linkedTo - The source of the loader's intrinsics (not impl)
// options.strict - should code evaluated in the loader be in strict mode?
// options.resolve( relURL, baseURL ) - The URL resolution hook
// options.fetch( relURL, baseURL, request, resolved ) - The module loading hook
@@ -56,11 +56,11 @@
// Loader.prototype.load( url, callback, errback )
- //
- // The load method takes a string representing a module URL and a
- // callback that receives the result of loading, compiling, and
- // executing the module at that URL. The compiled code is statically
- // associated with this loader, and its URL is the given URL. The
+ //
+ // The load method takes a string representing a module URL and a
+ // callback that receives the result of loading, compiling, and
+ // executing the module at that URL. The compiled code is statically
+ // associated with this loader, and its URL is the given URL. The
// additional callback is used if an error occurs.
Loader.prototype.load = function (url, callback, errback) {
var key = this._resolve(url, this._baseURL);
@@ -77,7 +77,7 @@
if (self._strict) {
actualSrc = "'use strict';\n" + actualSrc;
}
-
+
evalSrc = eval(actualSrc);
self.set(url, evalSrc);
callback(self._mios[key]);
@@ -93,7 +93,7 @@
};
// Loader.prototype.eval( src )
- // The eval method takes a string representing a Program and returns
+ // The eval method takes a string representing a Program and returns
// the result of compiling and executing the program.
Loader.prototype.eval = function (sourceText) {
with(this._global) {
@@ -104,10 +104,10 @@
// Loader.prototype.evalAsync( src, callback, errback )
//
- // The evalAsync method takes a string representing a Program and a
- // callback that receives the result of compiling and executing the
- // program. The compiled code is statically associated with this loader,
- // and its URL is the base URL of this loader. The additional callback
+ // The evalAsync method takes a string representing a Program and a
+ // callback that receives the result of compiling and executing the
+ // program. The compiled code is statically associated with this loader,
+ // and its URL is the base URL of this loader. The additional callback
// is used if an error occurs.
Loader.prototype.evalAsync = function () {
@@ -117,19 +117,19 @@
// Loader.prototype.get( url )
//
- // The get method looks up a module in the loaders module instance table.
- // The URL is resolved to a key by calling the loaders resolve operation.
+ // The get method looks up a module in the loader's module instance table.
+ // The URL is resolved to a key by calling the loader's resolve operation.
Loader.prototype.get = function (url) {
var key = this._resolve(url, this._baseURL);
return this._mios[key];
};
// Loader.prototype.set( urlOrMods[, mod ] )
- //
- // The set method stores a module or set of modules in the loader’s
- // module instance table. Each URL is resolved to a key by calling
- // the loaders resolve operation.
+ //
+ // The set method stores a module or set of modules in the loader's
+ // module instance table. Each URL is resolved to a key by calling
+ // the loader's resolve operation.
Loader.prototype.set = function (url, mio) {
var key = this._resolve(url, this._baseURL);
if (typeof url === "string") {
@@ -143,9 +143,9 @@
// Loader.prototype.defineBuiltins( [ obj ] )
//
- // The defineBuiltins method takes an object and defines all the built-in
- // objects and functions of the ES6 standard library associated with this
- // loaders intrinsics as properties on the object.
+ // The defineBuiltins method takes an object and defines all the built-in
+ // objects and functions of the ES6 standard library associated with this
+ // loader's intrinsics as properties on the object.
Loader.prototype.defineBuiltins = function (o) {
if (typeof o != "object") throw new Error("Expected object");
for (var globalProp in global) {
@@ -156,15 +156,15 @@
function Module(o) {
-
+
if (o === null) throw new TypeError("Expected object");
- var obj = Object(o);
+ var obj = Object(o);
if (obj instanceof Module) {
- return obj;
+ return obj;
} else {
- var mio = Object.create(null);
-
+ var mio = Object.create(null);
+
for (var key in obj) {
(function (key) {
Object.defineProperty(mio, key, {
@@ -176,7 +176,7 @@
});
})(key);
}
-
+
return mio;
}
};
@@ -219,5 +219,5 @@
// Export the System object
global.System = defaultSystemLoader;
-
-})(window);
+
+})(window);

0 comments on commit 36c171f

Please sign in to comment.