code: function pickoutValue(target, str) {
    const strDepth = str.split('.');
    const newTarget = target[strDepth[0]];
    if (newTarget === undefined) throw new Error('Cannot find the value');
    if (strDepth.length === 1) return newTarget;
    return pickoutValue(newTarget, strDepth.splice(1).join('.'));
  }
docs: Giving an object and a string, pick out wanted data
  e.g. user { id: 'test' } and user.id => 'test'