lib/extension.js
function format(extensions) {
  return Object.keys(extensions)
    .map((extension) => {
      let configurations = extensions[extension];
      if (!Array.isArray(configurations)) configurations = [configurations];
      return configurations
        .map((params) => {
          return [extension]
            .concat(
              Object.keys(params).map((k) => {
                let values = params[k];
                if (!Array.isArray(values)) values = [values];
                return values
                  .map((v) => (v === true ? k : `${k}=${v}`))
                  .join('; ');
              })
            )
            .join('; ');
        })
        .join(', ');
    })
    .join(', ');
}
function format(extensions) {
  return Object.keys(extensions)
    .map((extension) => {
      let configurations = extensions[extension];
      if (!Array.isArray(configurations)) configurations = [configurations];
      return configurations
        .map((params) => {
          return [extension]
            .concat(
              Object.keys(params).map((k) => {
                let values = params[k];
                if (!Array.isArray(values)) values = [values];
                return values
                  .map((v) => (v === true ? k : `${k}=${v}`))
                  .join('; ');
              })
            )
            .join('; ');
        })
        .join(', ');
    })
    .join(', ');
}
function format ( extensions ) { return Object . keys ( extensions ) . map ( ( extension ) => { let configurations = extensions [ extension ] ; if ( ! Array . isArray ( configurations ) ) configurations = [ configurations ] ; return configurations . map ( ( params ) => { return [ extension ] . concat ( Object . keys ( params ) . map ( ( k ) => { let values = params [ k ] ; if ( ! Array . isArray ( values ) ) values = [ values ] ; return values . map ( ( v ) => ( v === true ? k : ` ${ k } ${ v } ` ) ) . join ( '; ' ) ; } ) ) . join ( '; ' ) ; } ) . join ( ', ' ) ; } ) . join ( ', ' ) ; }
Builds the `Sec-WebSocket-Extensions` header field value.

@param {Object} extensions The map of extensions and parameters to format
@return {String} A string representing the given object
@public
Builds the Sec - WebSocket - Extensions header field value .