Learn more about a lead.
$ npm install ivolo/leader
var Leader = require('leader');
var leader = Leader()
.use(fullContact())
.use(facebook()))
.use(twitter())
.use(linkedin())
.use(github());
.populate({ email: '[email protected]' }, function (err, person) {
// ..
});
Each leader plugin provides additional information about the person. This example plugin figures out if the person's email domain is interesting:
function domain (person, context, next) {
var tokens = person.email.split('@');
person.domain = tokens[1];
person.interesting = tokens[1].indexOf('gmail') === -1;
next();
}
You can tell leader to wait to run your plugin until you know something about the person:
function hasEmail (person) {
return person.email != null;
}
var leader = Leader()
.when(hasEmail, domain);
Existing plugins for leader can:
- leader-crunchbase-api - search for a company name and find its employee count, funding, etc on CrunchBase
- leader-domain - determine if an email is personal, disposable, or company
- leader-google-domain - google an email's domain to find its company link
- leader-google-linkedin-company - google an email's domain to find its LinkedIn company profile
Ånd we'd love plugins to:
- query LinkedIn for the company domain
- query Full Contact or Rapleaf for demographic information
- search Google for their personal twitter
- search Google for the person's domain
- search Google for the person's personal blog or site
Create a new Leader instance.
Add a leader plugin
which is an object that contains a fn
plugin and a wait
function, like so { wait: hasEmail, fn: domain }
Execute the leader plugin fn
when the wait
function returns true. Read more about wait functions in parallel-ware.
Populate more information about the person
.
Set the max
amount of plugin running concurrently.
WWWWWW||WWWWWW
W W W||W W W
||
( OO )__________
/ | \
/o o| MIT \
\___/||_||__||_|| *
|| || || ||
_||_|| _||_||
(__|__|(__|__|