src/page.js
function parseLinkHeader(header) {
    if (!header) {
        return {};
    }

    // Split parts by comma
    const parts = header.split(',');
    const links = {};

    // Parse each part into a named link
    parts.forEach((p) => {
        const section = p.split(';');
        if (section.length != 2) {
            throw new Error('section could not be split on ";"');
        }
        const url = section[0].replace(/<(.*)>/, '$1').trim();
        const name = section[1].replace(/rel="(.*)"/, '$1').trim();
        links[name] = url;
    });

    return links;
}
function parseLinkHeader(header) {
    if (!header) {
        return {};
    }

    // Split parts by comma
    const parts = header.split(',');
    const links = {};

    // Parse each part into a named link
    parts.forEach((p) => {
        const section = p.split(';');
        if (section.length != 2) {
            throw new Error('section could not be split on ";"');
        }
        const url = section[0].replace(/<(.*)>/, '$1').trim();
        const name = section[1].replace(/rel="(.*)"/, '$1').trim();
        links[name] = url;
    });

    return links;
}
function parseLinkHeader ( header ) { if ( ! header ) { return { } ; } // Split parts by comma const parts = header . split ( ',' ) ; const links = { } ; // Parse each part into a named link parts . forEach ( ( p ) => { const section = p . split ( ';' ) ; if ( section . length != 2 ) { throw new Error ( 'section could not be split on ";"' ) ; } const url = section [ 0 ] . replace ( / <(.*)> / , '$1' ) . trim ( ) ; const name = section [ 1 ] . replace ( / rel="(.*)" / , '$1' ) . trim ( ) ; links [ name ] = url ; } ) ; return links ; }
Extract next and prev from link header
@param  {String} header
@return {Object}
Extract next and prev from link header