Bug:Fix file validation issue
[vnfsdk/refrepo.git] / vnfmarket / src / main / webapp / vnfmarket / node_modules / redis / examples / extend.js
1 var redis = require("redis"),
2     client = redis.createClient();
3
4 // Extend the RedisClient prototype to add a custom method
5 // This one converts the results from "INFO" into a JavaScript Object
6
7 redis.RedisClient.prototype.parse_info = function (callback) {
8     this.info(function (err, res) {
9         var lines = res.toString().split("\r\n").sort();
10         var obj = {};
11         lines.forEach(function (line) {
12             var parts = line.split(':');
13             if (parts[1]) {
14                 obj[parts[0]] = parts[1];
15             }
16         });
17         callback(obj)
18     });
19 };
20
21 client.parse_info(function (info) {
22     console.dir(info);
23     client.quit();
24 });