import { factory } from '../../utils/factory.js';
var name = 'bin';
var dependencies = ['typed', 'format'];

/**
 * Format a number as binary.
 *
 * Syntax:
 *
 *    math.bin(value)
 *
 * Examples:
 *
 *    //the following outputs "0b10"
 *    math.bin(2)
 *
 * See also:
 *
 *    oct
 *    hex
 *
 * @param {number | BigNumber} value    Value to be stringified
 * @param {number | BigNumber} wordSize Optional word size (see `format`)
 * @return {string}         The formatted value
 */
export var createBin = factory(name, dependencies, _ref => {
  var {
    typed,
    format
  } = _ref;
  return typed(name, {
    'number | BigNumber': function number__BigNumber(n) {
      return format(n, {
        notation: 'bin'
      });
    },
    'number | BigNumber, number | BigNumber': function number__BigNumber_number__BigNumber(n, wordSize) {
      return format(n, {
        notation: 'bin',
        wordSize
      });
    }
  });
});