aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMarak Squires <[email protected]>2010-05-14 22:05:51 -0400
committerMarak Squires <[email protected]>2010-05-14 22:05:51 -0400
commitfd03bd4f2f67c445cc679d4c0fb7514c1a66f1a8 (patch)
tree0fb0c1aef7cd49a0ea7734b6c85b1f867d4bee87 /lib
parent8b965746930e1ed44e23bb2351eee99746e75300 (diff)
downloadfaker-fd03bd4f2f67c445cc679d4c0fb7514c1a66f1a8.tar.xz
faker-fd03bd4f2f67c445cc679d4c0fb7514c1a66f1a8.zip
got definitions working
Diffstat (limited to 'lib')
-rw-r--r--lib/definitions.js28
-rw-r--r--lib/name.js2
2 files changed, 27 insertions, 3 deletions
diff --git a/lib/definitions.js b/lib/definitions.js
index dc8c2679..14125519 100644
--- a/lib/definitions.js
+++ b/lib/definitions.js
@@ -1,4 +1,15 @@
-var definitions = {};
+(function (definitions) {
+
+// because the anonymous function is being called without a scope being set,
+// "this" will refer to the global scope. In a browser, that's the window, but
+// will be "undefined" in strict mode. In other JS platforms, it may be some
+// other thing.
+
+// my code here.
+// don't make accidental globals.
+// hang a small number of things on the "exports" object.
+
+
// name.js definitions
@@ -63,4 +74,17 @@ definitions.phone_formats = [
'(###)###-#### x#####',
'1-###-###-#### x#####',
'###.###.#### x#####'
-]; \ No newline at end of file
+];
+
+
+
+
+
+})(
+ // exports will be set in any commonjs platform; use it if it's available
+ typeof exports !== "undefined" ?
+ exports :
+ // otherwise construct a name space. outside the anonymous function,
+ // "this" will always be "window" in a browser, even in strict mode.
+ this.window = {}
+);
diff --git a/lib/name.js b/lib/name.js
index e1316a2e..22ff0bd2 100644
--- a/lib/name.js
+++ b/lib/name.js
@@ -1,4 +1,4 @@
-
+var definitions = require('./definitions');
var name = exports.first_name = function(){