/**
 * Copyright 2003-present Greg Hurrell. All rights reserved.
 * Licensed under the terms of the MIT license.
 *
 * @flow
 */

import React from 'react';
import convert from './convert';

export default function Size({value}) {
  let roundup = 1;
  let targetBase = 2;
  if (value.base === 16) {
    roundup = 4;
    targetBase = 16;
  }
  const bits = value ?
    convert(value.value, value.base, targetBase).length * roundup :
    0;
  const bytes = Math.ceil(bits / 8);
  return (
    <span>
      {bytes} byte{bytes === 1 ? '' : 's'},
      {' '}
      {bits} bits
    </span>
  );
}

@@ -228,118 +228,8 @@
 ) %7B%0A
-  let roundup = 1;%0A  let targetBase = 2;%0A  if (value.base === 16) %7B%0A    roundup = 4;%0A    targetBase = 16;%0A  %7D%0A
   co
@@ -246,20 +246,16 @@
  value ?
-%0A   
  convert
@@ -284,42 +284,18 @@
 se, 
-targetBase).length * roundup :%0A   
+2).length:
  0;%0A

put things back the way they were