var $ = obj => new Proxy({}, { get: (_, key) => key=='$' ? obj : $((obj||{})[key]) })
var hoge = { fuga: { piyo: 'boo', puyo: 123 } }
var $hoge = $(hoge)
x = $hoge.fuga.piyo.$ // 'boo'
x = $hoge.fuga2.payo.$ // undefined
x = $hoge.fuga.puyo.$ // 123
x = $hoge.fuga2.poyo.$ // undefined
if (hoge && hoge.fuga && hoge.fuga.puyo === 123) {}
//↓
if ($hoge.fuga.puyo.$ === 123) {}
if (hoge && hoge.fuga && hoge.fuga.piyo && hoge.fuga.piyo.length > 2) {}
//↓
if ($hoge.fuga.piyo.length.$ > 2) {}
dmFyICQgPSBvYmogPT4gbmV3IFByb3h5KHt9LCB7IGdldDogKF8sIGtleSkgPT4ga2V5PT0nJCcgPyBvYmogOiAkKChvYmp8fHt9KVtrZXldKSB9KQoKCnZhciBob2dlID0geyBmdWdhOiB7IHBpeW86ICdib28nLCBwdXlvOiAxMjMgfSB9Cgp2YXIgJGhvZ2UgPSAkKGhvZ2UpCgoKeCA9ICRob2dlLmZ1Z2EucGl5by4kICAgLy8gJ2JvbycKeCA9ICRob2dlLmZ1Z2EyLnBheW8uJCAgLy8gdW5kZWZpbmVkIAoKeCA9ICRob2dlLmZ1Z2EucHV5by4kICAgICAvLyAxMjMKeCA9ICRob2dlLmZ1Z2EyLnBveW8uJCAgICAvLyB1bmRlZmluZWQKCmlmIChob2dlICYmIGhvZ2UuZnVnYSAmJiBob2dlLmZ1Z2EucHV5byA9PT0gMTIzKSB7fQovL+KGkwppZiAoJGhvZ2UuZnVnYS5wdXlvLiQgPT09IDEyMykge30KCmlmIChob2dlICYmIGhvZ2UuZnVnYSAmJiBob2dlLmZ1Z2EucGl5byAmJiBob2dlLmZ1Z2EucGl5by5sZW5ndGggPiAyKSB7fQovL+KGkwppZiAoJGhvZ2UuZnVnYS5waXlvLmxlbmd0aC4kID4gMikge30=