Closed sholladay closed 6 years ago
Do you mean something like this:
const check = require('check-npm-dependents');
const request = require('got');
request('https://www.npmjs.com/package/lodash')
.then(check.parse)
.then(console.log);
// for ex. 68195
Right?
Yep, exactly. Currently, the HTTP client used to fetch the page is a blackbox that I cannot control, customize, or replace. Having a .parse()
method that only does the parsing would allow me to compose the important part of this package with my own HTTP client.
There are two closely related, but separate steps that this package currently performs all in one go:
The latter is what I am most interested in having an abstraction for. HTTP requests, on the other hand, are unfortunately a very leaky abstraction. I would prefer to have control over retries, caching semantics, etc. BYOC (Bring Your Own Client), if you will.
I imagine this being implemented as a
.parse(html)
method or similar.