felixgirault/essence.js

View on GitHub
src/extract.js

Summary

Maintainability
A
0 mins
Test Coverage
import createRequest from './createRequest';
import createResponse from './createResponse';



/**
 *    Extracts info from the given URL using a reducer.
 *
 *    @param function reduce Reducer function.
 *    @param string url URL.
 *    @return object Payload.
 */
export default async function extract(reduce, url) {
    const {res} = await reduce({
        req: createRequest(url),
        res: createResponse()
    });

    return res;
}