Socket
Socket
Sign inDemoInstall

fullcontact

Package Overview
Dependencies
47
Maintainers
3
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.0 to 1.0.0

.eslintrc

4

endpoints/email.js

@@ -13,3 +13,3 @@ 'use strict';

this.endpoint = 'https://api.fullcontact.com/'+ api.version +'/email/';
this.endpoint = 'https://api.fullcontact.com/' + api.version + '/email/';
this.send = api.process.bind(api, this);

@@ -34,3 +34,3 @@ }

//
args.endpoint = this.endpoint +'disposable.json';
args.endpoint = this.endpoint + 'disposable.json';

@@ -37,0 +37,0 @@ this.send({ email: args.value }, args);

@@ -13,3 +13,3 @@ 'use strict';

this.endpoint = 'https://api.fullcontact.com/'+ api.version +'/address/';
this.endpoint = 'https://api.fullcontact.com/' + api.version + '/address/';
this.send = api.process.bind(api, this);

@@ -34,3 +34,3 @@ }

//
args.endpoint = this.endpoint +'locationNormalizer.json';
args.endpoint = this.endpoint + 'locationNormalizer.json';

@@ -57,3 +57,3 @@ this.send({ place: args.value }, args);

//
args.endpoint = this.endpoint +'locationEnrichment.json';
args.endpoint = this.endpoint + 'locationEnrichment.json';

@@ -60,0 +60,0 @@ this.send({ place: args.value }, args);

@@ -13,3 +13,3 @@ 'use strict';

this.endpoint = 'https://api.fullcontact.com/'+ api.version +'/name/';
this.endpoint = 'https://api.fullcontact.com/' + api.version + '/name/';
this.send = api.process.bind(api, this);

@@ -34,3 +34,3 @@ }

//
args.endpoint = this.endpoint +'normalizer.json';
args.endpoint = this.endpoint + 'normalizer.json';

@@ -58,3 +58,3 @@ this.send({ q: args.value }, args);

//
args.endpoint = this.endpoint +'deducer.json';
args.endpoint = this.endpoint + 'deducer.json';

@@ -81,3 +81,3 @@ this.send(args.value, args);

//
args.endpoint = this.endpoint +'similarity.json';
args.endpoint = this.endpoint + 'similarity.json';

@@ -107,3 +107,3 @@ this.send({ q1: args.value, q2: args.q2 }, args);

//
args.endpoint = this.endpoint +'stats.json';
args.endpoint = this.endpoint + 'stats.json';

@@ -130,3 +130,3 @@ this.send(args.value, args);

//
args.endpoint = this.endpoint +'parser.json';
args.endpoint = this.endpoint + 'parser.json';

@@ -133,0 +133,0 @@ this.send({ q: args.value }, args);

@@ -13,3 +13,3 @@ 'use strict';

this.endpoint = 'https://api.fullcontact.com/'+ api.version +'/person.json';
this.endpoint = 'https://api.fullcontact.com/' + api.version + '/person.json';
this.send = api.process.bind(api, this);

@@ -22,3 +22,3 @@ }

* ```js
* fullcontact.person.email('opensource@observe.it', [queue], fn);
* fullcontact.person.email('opensource@observe.it', [queue], [webhookUrl], [webhookId], fn);
* ```

@@ -25,0 +25,0 @@ *

'use strict';
var request = require('request')
, qs = require('qs');
, qs = require('qs');

@@ -16,3 +16,5 @@ var slice = Array.prototype.slice;

function FullContact(api) {
if (!(this instanceof FullContact)) return new FullContact(api);
if (!(this instanceof FullContact)) {
return new FullContact(api);
}

@@ -29,3 +31,5 @@ this.key = api; // API key

if (!this.key) throw new Error('Missing API key');
if (!this.key) {
throw new Error('Missing API key');
}
}

@@ -47,8 +51,19 @@

//
if (args.queue) query.queue = args.queue;
if (args.casing) query.casing = args.casing;
if (args.population) query.includeZeroPopulation = !!args.population;
if (args.webhookUrl) query.webhookUrl = args.webhookUrl;
if (args.webhookId) query.webhookId = args.webhookId;
if (args.queue) {
query.queue = args.queue;
}
if (args.casing) {
query.casing = args.casing;
}
if (args.population) {
query.includeZeroPopulation = !!args.population;
}
if (args.webhookUrl) {
query.webhookUrl = args.webhookUrl;
}
if (args.webhookId) {
query.webhookId = args.webhookId;
}
//

@@ -59,8 +74,11 @@ // The packet that is send to the server or queued when we are in queuing

var packet = {
method: 'GET',
uri: args.endpoint || api.endpoint,
qs: query
method: 'GET',
uri: args.endpoint || api.endpoint,
qs: query
};
if (this.queueing) return this.queue(packet, args);
if (this.queueing) {
return this.queue(packet, args);
}
return this.request(packet, args);

@@ -78,6 +96,8 @@ };

var fn = args.fn
, self = this;
, self = this;
request(packet, function requested(err, res, body) {
if (err) return fn(err);
if (err) {
return fn(err);
}

@@ -91,6 +111,6 @@ self.ratereset = +res.headers['x-rate-limit-reset'] || self.ratereset;

//
if ('string' === typeof body) {
if (typeof body === 'string') {
try { body = JSON.parse(body); }
catch (e) {
return fn(new Error('Failed to parse API response ('+ e.message +')'));
return fn(new Error('Failed to parse API response (' + e.message + ')'));
}

@@ -142,3 +162,3 @@ }

this.requests.push({
url: packet.uri +'?'+ qs.stringify(packet.qs),
url: packet.uri + '?' + qs.stringify(packet.qs),
fn: args.fn

@@ -169,3 +189,5 @@ });

requests.forEach(function cb(data) {
if (data.fn) data.fn(err);
if (data.fn) {
data.fn(err);
}
});

@@ -183,3 +205,3 @@

method: 'POST',
uri: 'https://api.fullcontact.com/'+ this.version +'/batch.json',
uri: 'https://api.fullcontact.com/' + this.version + '/batch.json',
qs: { apiKey: this.key },

@@ -192,3 +214,5 @@ json: {

}, function requested(err, res, body) {
if (err) return bailout(err);
if (err) {
return bailout(err);
}

@@ -256,5 +280,6 @@ fn(err, body.responses);

FullContact.Location = require('./endpoints/location');
FullContact.Person = require('./endpoints/person');
FullContact.Email = require('./endpoints/email');
FullContact.Name = require('./endpoints/name');
FullContact.Person = require('./endpoints/person');
FullContact.Email = require('./endpoints/email');
FullContact.Name = require('./endpoints/name');
FullContact.Company = require('./endpoints/company');

@@ -281,2 +306,6 @@ //

FullContact.define(FullContact.prototype, 'company', function define() {
return new FullContact.Company(this);
});
//

@@ -283,0 +312,0 @@ // Expose the FullContact API.

{
"name": "fullcontact",
"version": "0.2.0",
"version": "1.0.0",
"description": "Fullcontact API bindings",

@@ -8,3 +8,4 @@ "main": "index.js",

"scripts": {
"test": "API_KEY=506d9c8a7aafae5a NODE_ENV=testing ./node_modules/.bin/mocha $(find test -name '*.test.js')"
"test": "NODE_ENV=testing ./node_modules/.bin/mocha $(find test -name '*.test.js')",
"test-travis": "API_KEY=506d9c8a7aafae5a NODE_ENV=testing ./node_modules/.bin/mocha $(find test -name '*.test.js')"
},

@@ -18,10 +19,10 @@ "repository": {

"dependencies": {
"request": "~2.25.0",
"qs": "~2.3.3"
"request": "2.x.x",
"qs": "2.x.x"
},
"devDependencies": {
"mocha": "2.1.x",
"chai": "1.10.x",
"pre-commit": "0.0.x"
"mocha": "2.x.x",
"chai": "2.x.x",
"pre-commit": "1.x.x"
}
}

@@ -122,4 +122,4 @@ # fullcontact

The `Person` endpoint is confidently namespaced as a `.person` property. Each
person API has an optional `queue` argument which you can use to indicate that
The `Person` endpoint is confidently namespaced as a `.person` property.
Each person API has an optional `queue` argument which you can use to indicate that
this request will should be pre-processed by FullContact and that you want to

@@ -131,5 +131,6 @@ fetch the details later. According to the API it should to receive the value `1`

#### person.email(address, [queue], fn);
#### person.email(address, [queue], [webhookUrl], [webhookId], fn);
Retrieves contact information by e-mail address.
Supports the use of webhooks by providing an url and id.

@@ -142,2 +143,8 @@ ```js

```js
fullcontact.person.email('foo@bar.com', null, 'https://mycallbackurl.com', 'webhooktracker', function (err, data) {
..
});
```
#### person.md5(address, [queue], fn);

@@ -278,11 +285,7 @@

```
npm test
API_KEY=<key> npm test
```
If you want to test with your own API key please run:
Don't worry if you forget it, we'll throw an error and let you know ;-).
```
API_KEY=<key> ./node_modules/.bin/mocha $(find test -name '*.test.js')
```
## License

@@ -289,0 +292,0 @@

describe('FullContact.Email', function () {
'use strict';
var FullContact = require('../')
, chai = require('chai')
, expect = chai.expect;
var FullContact = require('../');
var chai = require('chai');
chai.Assertion.includeStack = true;
chai.config.includeStack = true;

@@ -14,2 +13,5 @@ //

var key = process.env.API_KEY;
if (!key) {
throw new Error('Please provide your API using the API_KEY env variable.');
}

@@ -16,0 +18,0 @@ //

describe('FullContact', function () {
'use strict';
var FullContact = require('../')
, chai = require('chai')
, expect = chai.expect;
var FullContact = require('../');
var chai = require('chai');
var expect = chai.expect;
chai.Assertion.includeStack = true;
chai.config.includeStack = true;

@@ -14,2 +14,5 @@ //

var key = process.env.API_KEY;
if (!key) {
throw new Error('Please provide your API using the API_KEY env variable.');
}

@@ -58,3 +61,3 @@ //

it('errors when an invalid API key is given', function (done) {
var client = new FullContact(key +'adfasfdsfadsfas');
var client = new FullContact(key + 'adfasfdsfadsfas');

@@ -75,4 +78,6 @@ client.person.email('arnout@observe.it', function (err) {

api.person.email('arnout@observe.it', function email(err, data) {
if (err) return done(err);
api.person.email('arnout@observe.it', function email(err) {
if (err) {
return done(err);
}

@@ -92,3 +97,5 @@ ['remaining', 'ratelimit', 'ratereset'].forEach(function (prop) {

api.person.email('arnout@observe.it', function email(err) {
if (err) return done(err);
if (err) {
return done(err);
}

@@ -95,0 +102,0 @@ //

describe('FullContact.Location', function () {
'use strict';
var FullContact = require('../')
, chai = require('chai')
, expect = chai.expect;
var FullContact = require('../');
var chai = require('chai');
chai.Assertion.includeStack = true;
chai.config.includeStack = true;

@@ -14,2 +13,5 @@ //

var key = process.env.API_KEY;
if (!key) {
throw new Error('Please provide your API using the API_KEY env variable.');
}

@@ -16,0 +18,0 @@ //

describe('FullContact.Name', function () {
'use strict';
var FullContact = require('../')
, chai = require('chai')
, expect = chai.expect;
var FullContact = require('../');
var chai = require('chai');
chai.Assertion.includeStack = true;
chai.config.includeStack = true;

@@ -14,2 +13,5 @@ //

var key = process.env.API_KEY;
if (!key) {
throw new Error('Please provide your API using the API_KEY env variable.');
}

@@ -16,0 +18,0 @@ //

describe('FullContact.Person', function () {
'use strict';
var FullContact = require('../')
, chai = require('chai')
, expect = chai.expect;
var FullContact = require('../');
var chai = require('chai');
chai.Assertion.includeStack = true;
chai.config.includeStack = true;

@@ -14,2 +13,5 @@ //

var key = process.env.API_KEY;
if (!key) {
throw new Error('Please provide your API using the API_KEY env variable.');
}

@@ -33,3 +35,3 @@ //

});
describe('#email with webhook url/id', function () {

@@ -45,5 +47,5 @@ it('retrieves data by e-mail and sets up a webhook with the right url and id', function (done) {

var md5 = require('crypto').createHash('md5')
.update('arnout@observe.it')
.digest('hex')
.toString();
.update('arnout@observe.it')
.digest('hex')
.toString();

@@ -73,3 +75,3 @@ it('retrieves data by md5 e-mail', function (done) {

describe('#facebookId', function () {
describe('#facebookId', function () {
it('retrieves data by facebook id', function (done) {

@@ -76,0 +78,0 @@ api.person.facebookId('1844599060', done);

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc