libs/toDeepMap.js
function toDeepMap(source) {
  const map = new Map();
  const keys = Object.keys(source);

  keys.forEach((key) => {
    const val = source[key];

    if (val !== null && typeof val === 'object' && !Array.isArray(val)) {
      return map.set(key, toDeepMap(val));
    }

    if (!isValidNode(val)) {
      throw new Error(`Could not add node at key "${key}", make sure it's a valid node`, val);
    }

    return map.set(key, Number(val));
  });

  return map;
}
function toDeepMap(source) {
  const map = new Map();
  const keys = Object.keys(source);

  keys.forEach((key) => {
    const val = source[key];

    if (val !== null && typeof val === 'object' && !Array.isArray(val)) {
      return map.set(key, toDeepMap(val));
    }

    if (!isValidNode(val)) {
      throw new Error(`Could not add node at key "${key}", make sure it's a valid node`, val);
    }

    return map.set(key, Number(val));
  });

  return map;
}
function toDeepMap ( source ) { const map = new Map ( ) ; const keys = Object . keys ( source ) ; keys . forEach ( ( key ) => { const val = source [ key ] ; if ( val !== null && typeof val === 'object' && ! Array . isArray ( val ) ) { return map . set ( key , toDeepMap ( val ) ) ; } if ( ! isValidNode ( val ) ) { throw new Error ( ` ${ key } ` , val ) ; } return map . set ( key , Number ( val ) ) ; } ) ; return map ; }
Creates a deep `Map` from the passed object.

@param  {Object} source - Object to populate the map with
@return {Map} New map with the passed object data
Creates a deep Map from the passed object .