Commit 679e0e9a authored by Aaron Tidwell's avatar Aaron Tidwell

removign console

parent 3750a92d
...@@ -68,22 +68,18 @@ function UnderscoreToCamel(str) { ...@@ -68,22 +68,18 @@ function UnderscoreToCamel(str) {
function convertProperties(obj, converionFunction) { function convertProperties(obj, converionFunction) {
//determine which we want to check with to see if we should convert //determine which we want to check with to see if we should convert
var checkRegex = converionFunction === UnderscoreToCamel ? /_/ : /[A-Z]/; var checkRegex = converionFunction === UnderscoreToCamel ? /_/ : /[A-Z]/;
console.log(checkRegex);
for (var prop in obj) { for (var prop in obj) {
if (obj.hasOwnProperty(prop)) { if (obj.hasOwnProperty(prop)) {
//objects recurse //objects recurse
if (typeof obj[prop] === 'object' && obj[prop] !== null) { if (typeof obj[prop] === 'object' && obj[prop] !== null) {
console.log('recursing', prop)
obj[converionFunction(prop)] = convertProperties(obj[prop], converionFunction); obj[converionFunction(prop)] = convertProperties(obj[prop], converionFunction);
} }
else if (prop.search(checkRegex) > -1) { else if (prop.search(checkRegex) > -1) {
obj[converionFunction(prop)] = obj[prop]; obj[converionFunction(prop)] = obj[prop];
//remove it //remove it
console.log('removing ', prop)
delete obj[prop]; delete obj[prop];
} }
console.log('failed', prop, prop.search(checkRegex))
//otherwise leave it alone //otherwise leave it alone
} }
} }
...@@ -113,8 +109,6 @@ Client.prototype.makeRequest = function(obj) { ...@@ -113,8 +109,6 @@ Client.prototype.makeRequest = function(obj) {
// Add on the api key // Add on the api key
obj.api_key = this.options.get('apiKey'); //convert for url obj.api_key = this.options.get('apiKey'); //convert for url
console.log(obj)
//serialize the properties //serialize the properties
var serialized = serializeProperties(obj); var serialized = serializeProperties(obj);
var compiledParams = serialized.serialized; var compiledParams = serialized.serialized;
...@@ -159,7 +153,6 @@ Client.prototype.makeRequest = function(obj) { ...@@ -159,7 +153,6 @@ Client.prototype.makeRequest = function(obj) {
if (self.options.get('format') == 'json') { if (self.options.get('format') == 'json') {
resData = JSON.parse(resData); resData = JSON.parse(resData);
if (self.options.get('massageProperties')) { if (self.options.get('massageProperties')) {
console.log('converting', resData);
resData = convertProperties(resData,UnderscoreToCamel); resData = convertProperties(resData,UnderscoreToCamel);
} }
} }
......
{ {
"name": "node-challonge", "name": "challonge",
"description": "Wrapper for the challong api", "description": "Wrapper for the challong api",
"author": "Aaron Tiwell <aaron.tidwell@gmail.com>", "author": "Aaron Tiwell <aaron.tidwell@gmail.com>",
"main": "./lib/challonge.js", "main": "./lib/challonge.js",
......
...@@ -56,7 +56,7 @@ _createClient_ takes one argument for configuration and returns an instance of t ...@@ -56,7 +56,7 @@ _createClient_ takes one argument for configuration and returns an instance of t
The wrapper is organized into resource.method to match the API The wrapper is organized into resource.method to match the API
For API calls that require nested params (eg: http://api.challonge.com/v1/documents/tournaments/create) properties should be specified as a nested config option: For API calls that require nested params (eg: http://api.challonge.com/v1/documents/tournaments/create) properties should be specified as a nested object:
``` ```
{ {
tournament: { tournament: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment