Additional code cleanup, changed cyclo helper function
diff --git a/lib/client.js b/lib/client.js
index d484c64..ceea224 100644
--- a/lib/client.js
+++ b/lib/client.js
@@ -17,16 +17,16 @@
self.orgId = arguments[0]
self.appId = arguments[1]
} else {
- self.orgId = ok(opts).getIfExists('orgId') || ok(config).getIfExists('usergrid.orgId')
- self.appId = ok(opts).getIfExists('appId') || ok(config).getIfExists('usergrid.appId')
+ self.orgId = getValue(opts, 'orgId')
+ self.appId = getValue(opts, 'appId')
}
// optional initializer properites
- self.baseUrl = getProperty(opts, 'baseUrl', 'https://api.usergrid.com') // default: https://api.usergrid.com
- self.clientId = getProperty(opts, 'clientId')
- self.clientSecret = getProperty(opts, 'clientSecret')
- self.tokenTtl = getProperty(opts, 'tokenTtl') // token ttl in seconds, server default: 3600
- self.authFallback = getProperty(opts, 'authFallback', 'none') // ('none'|'app') default: 'none'
+ self.baseUrl = getValue(opts, 'baseUrl', 'https://api.usergrid.com') // default: https://api.usergrid.com
+ self.clientId = getValue(opts, 'clientId')
+ self.clientSecret = getValue(opts, 'clientSecret')
+ self.tokenTtl = getValue(opts, 'tokenTtl') // token ttl in seconds, server default: 3600
+ self.authFallback = getValue(opts, 'authFallback', 'none') // ('none'|'app') default: 'none'
// optional post-init properties
self.paginationPreloadPages = 0 // number of pages to preload
@@ -40,7 +40,7 @@
}
}
-function getProperty(opts, name, defaultValue) {
+function getValue(opts, name, defaultValue) {
return ok(opts).getIfExists(name) || ok(config).getIfExists(util.format('usergrid.%s', name)) || defaultValue
}