tests/contents/utils/patchSegmentWithTimeOffset.js
/**
 * Returns a Uint8Array from the arguments given, in order:
 *   - if the next argument given is a number N set the N next bytes to 0.
 *   - else set the next bytes to the argument given.
 * @param {...(Number|Uint8Array)} args
 * @returns {Uint8Array}
 */
Returns a Uint8Array from the arguments given, in order:
- if the next argument given is a number N set the N next bytes to 0.
- else set the next bytes to the argument given.
Returns a Uint8Array from the arguments given in order : - if the next argument given is a number N set the N next bytes to 0 . - else set the next bytes to the argument given .
function concat(...args) {
  const l = args.length;
  let i = -1;
  let len = 0;
  let arg;
  while (++i < l) {
    arg = args[i];
    len += (typeof arg === "number") ? arg : arg.length;
  }
  const arr = new Uint8Array(len);
  let offset = 0;
  i = -1;
  while (++i < l) {
    arg = args[i];
    if (typeof arg === "number") {
      offset += arg;
    }
    else if (arg.length > 0) {
      arr.set(arg, offset);
      offset += arg.length;
    }
  }
  return arr;
}
function concat ( ... args ) { const l = args . length ; let i = - 1 ; let len = 0 ; let arg ; while ( ++ i < l ) { arg = args [ i ] ; len += ( typeof arg === "number" ) ? arg : arg . length ; } const arr = new Uint8Array ( len ) ; let offset = 0 ; i = - 1 ; while ( ++ i < l ) { arg = args [ i ] ; if ( typeof arg === "number" ) { offset += arg ; } else if ( arg . length > 0 ) { arr . set ( arg , offset ) ; offset += arg . length ; } } return arr ; }
Returns a Uint8Array from the arguments given, in order:
   - if the next argument given is a number N set the N next bytes to 0.
Returns a Uint8Array from the arguments given in order : - if the next argument given is a number N set the N next bytes to 0 .