summaryrefslogtreecommitdiff
path: root/node_modules/prompt/examples/add-properties.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/prompt/examples/add-properties.js')
-rw-r--r--node_modules/prompt/examples/add-properties.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/node_modules/prompt/examples/add-properties.js b/node_modules/prompt/examples/add-properties.js
new file mode 100644
index 0000000..1a56176
--- /dev/null
+++ b/node_modules/prompt/examples/add-properties.js
@@ -0,0 +1,35 @@
+/*
+ * add-properties.js: Example of how to add properties to an object using prompt.
+ *
+ * (C) 2010, Nodejitsu Inc.
+ *
+ */
+
+var prompt = require('../lib/prompt');
+
+//
+// Start the prompt
+//
+prompt.start();
+
+var obj = {
+ password: 'lamepassword',
+ mindset: 'NY'
+}
+
+//
+// Log the initial object.
+//
+console.log('Initial object to be extended:');
+console.dir(obj);
+
+//
+// Add two properties to the empty object: username and email
+//
+prompt.addProperties(obj, ['username', 'email'], function (err) {
+ //
+ // Log the results.
+ //
+ console.log('Updated object received:');
+ console.dir(obj);
+}); \ No newline at end of file