createPageMeta(data) {
    let meta = {};

    Object.keys(data).forEach(type => {
      const link = data[type];
      meta[type] = {};

      let a = document.createElement('a');
      a.href = link;
      let query = a.search.slice(1);

      query.split('&').forEach(pairs => {
        const [param, value] = pairs.split('=');

        if (decodeURIComponent(param) === 'page[number]') {
          meta[type].number = parseInt(value);
        } else if (decodeURIComponent(param) === 'page[size]') {
          meta[type].size = parseInt(value);
        }

      });
      a = null;
    });

    return meta;
  }
/**
     Transforms link URLs to objects containing metadata
     E.g.
     {
         previous: '/streets?page[number]=1&page[size]=10&sort=name
         next: '/streets?page[number]=3&page[size]=10&sort=name
     }

     will be converted to

     {
         previous: { number: 1, size: 10 },
         next: { number: 3, size: 10 }
     }
   */
Transforms link URLs to objects containing metadata
E.g.

will be converted to


Transforms link URLs to objects containing metadata E . g . will be converted to
createPageMeta(data) {
    let meta = {};
    Object.keys(data).forEach(type => {
      const link = data[type];
      meta[type] = {};
      let a = document.createElement('a');
      a.href = link;
      let query = a.search.slice(1);
      query.split('&').forEach(pairs => {
        const [param, value] = pairs.split('=');
        if (decodeURIComponent(param) === 'page[number]') {
          meta[type].number = parseInt(value);
        } else if (decodeURIComponent(param) === 'page[size]') {
          meta[type].size = parseInt(value);
        }
      });
      a = null;
    });
    return meta;
  }
createPageMeta ( data ) { let meta = { } ; Object . keys ( data ) . forEach ( type => { const link = data [ type ] ; meta [ type ] = { } ; let a = document . createElement ( 'a' ) ; a . href = link ; let query = a . search . slice ( 1 ) ; query . split ( '&' ) . forEach ( pairs => { const [ param , value ] = pairs . split ( '=' ) ; if ( decodeURIComponent ( param ) === 'page[number]' ) { meta [ type ] . number = parseInt ( value ) ; } else if ( decodeURIComponent ( param ) === 'page[size]' ) { meta [ type ] . size = parseInt ( value ) ; } } ) ; a = null ; } ) ; return meta ; }
Transforms link URLs to objects containing metadata
E.g.
Transforms link URLs to objects containing metadata E . g .