Comparing version 0.2.1 to 0.3.0
{ | ||
"name": "phonedb", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"description": "Contact list storage and management for Node", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -7,5 +7,2 @@ /** | ||
const debug = require('debug')('phonedb'); | ||
const redis = require('redis'); | ||
const phoneUtil = require('google-libphonenumber').PhoneNumberUtil.getInstance(); | ||
@@ -17,7 +14,6 @@ | ||
/** | ||
* Initializes a new PhoneDB object. | ||
* Optionally takes in a Redis config (https://github.com/NodeRedis/node_redis#rediscreateclient). | ||
* Initializes a new PhoneDB object with a Redis client (https://github.com/NodeRedis/node_redis). | ||
*/ | ||
constructor(config = null) { | ||
this.client = (config != null) ? redis.createClient(config) : redis.createClient(); | ||
constructor(redis) { | ||
this.client = redis; | ||
} | ||
@@ -24,0 +20,0 @@ |
@@ -38,12 +38,7 @@ # PhoneDB | ||
Initialize PhoneDB, connecting to a local Redis server running on the default port: | ||
Initialize PhoneDB, connecting to a [Redis client](https://github.com/NodeRedis): | ||
```js | ||
const phoneDB = new PhoneDB(); | ||
const phoneDB = new PhoneDB(redisClient); | ||
``` | ||
Optionally pass in a [Redis configuration](https://github.com/NodeRedis/node_redis#rediscreateclient) to connect to a remote server. | ||
```js | ||
const phoneDB = new PhoneDB(REDIS_CLOUD_URL); | ||
``` | ||
Register a user's phone number with PhoneDB: | ||
@@ -50,0 +45,0 @@ ```js |
const assert = require('assert'); | ||
const redis = require('redis'); | ||
@@ -14,3 +13,3 @@ | ||
describe('PhoneDB', () => { | ||
const phoneDB = new PhoneDB(); | ||
const phoneDB = new PhoneDB(client); | ||
@@ -17,0 +16,0 @@ beforeEach(() => { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
63705
233
92