index.js
function insert(argh, key, value, option) {
  //
  // Automatic value conversion. This makes sure we store the correct "type"
  //
  if ('string' === typeof value && !isNaN(+value)) value = +value;
  if (value === 'true' || value === 'false') value = value === 'true';

  var single = option.charAt(1) !== '-'
    , properties = key.split('.')
    , position = argh;

  if (single && key.length > 1) return key.split('').forEach(function short(char) {
    insert(argh, char, value, option);
  });

  //
  // We don't have any deeply nested properties, so we should just bail out
  // early enough so we don't have to do any processing
  //
  if (!properties.length) return argh[key] = value;

  while (properties.length) {
    var property = properties.shift();

    if (properties.length) {
      if ('object' !== typeof position[property] && !Array.isArray(position[property])) {
        position[property] = Object.create(null);
      }
    } else {
      position[property] = value;
    }

    position = position[property];
  }
}
function insert(argh, key, value, option) {
  //
  // Automatic value conversion. This makes sure we store the correct "type"
  //
  if ('string' === typeof value && !isNaN(+value)) value = +value;
  if (value === 'true' || value === 'false') value = value === 'true';

  var single = option.charAt(1) !== '-'
    , properties = key.split('.')
    , position = argh;

  if (single && key.length > 1) return key.split('').forEach(function short(char) {
    insert(argh, char, value, option);
  });

  //
  // We don't have any deeply nested properties, so we should just bail out
  // early enough so we don't have to do any processing
  //
  if (!properties.length) return argh[key] = value;

  while (properties.length) {
    var property = properties.shift();

    if (properties.length) {
      if ('object' !== typeof position[property] && !Array.isArray(position[property])) {
        position[property] = Object.create(null);
      }
    } else {
      position[property] = value;
    }

    position = position[property];
  }
}
function insert ( argh , key , value , option ) { // // Automatic value conversion. This makes sure we store the correct "type" // if ( 'string' === typeof value && ! isNaN ( + value ) ) value = + value ; if ( value === 'true' || value === 'false' ) value = value === 'true' ; var single = option . charAt ( 1 ) !== '-' , properties = key . split ( '.' ) , position = argh ; if ( single && key . length > 1 ) return key . split ( '' ) . forEach ( function short ( char ) { insert ( argh , char , value , option ) ; } ) ; // // We don't have any deeply nested properties, so we should just bail out // early enough so we don't have to do any processing // if ( ! properties . length ) return argh [ key ] = value ; while ( properties . length ) { var property = properties . shift ( ) ; if ( properties . length ) { if ( 'object' !== typeof position [ property ] && ! Array . isArray ( position [ property ] ) ) { position [ property ] = Object . create ( null ) ; } } else { position [ property ] = value ; } position = position [ property ] ; } }
Inserts the value in the argh object

@param {Object} argh The object where we store the values
@param {String} key The received command line flag
@param {String} value The command line flag's value
@param {String} option The actual option
@api private
Inserts the value in the argh object