Tidak banyak tulisan pada artikel ini, saya hanya akan memberikan data yang akan membantu kamu untuk menentukan metode mana yang sebaiknya kamu pakai untuk accessing arbitrarily nested object pada projectmu.

Positive Case

const Benchmark = require("benchmark")
const idx = require("idx")
const R = require("ramda")
const _ = require("lodash")

const data = {
    details: {
        name: 'John Doe',
        school: {
            name: 'MIT',
            other: {
                other: {
                    other: 'eof other',
                }
            }
        }
    }
}

const suite = new Benchmark.Suite;
suite
    .add('ramda', function () {
        return R.pathOr(null, ['details', 'school', 'other', 'other', 'other'], data);
    })
    .add('lodash', function () {
        return _.get(data, ['details', 'school', 'other', 'other', 'other'], null)
    })
    .add('idx', function () {
        return idx(data, function(_) {
            return _.details.school.other.other.other;
        });
    })
    .add('vanilla with &&', function() {
        return data && data.details && data.details.school && data.details.school.other && data.details.school.other.other && data.details.school.other.other.other;
    })
    .add('vanilla with try catch', function() {
        try {
            return data.details.school.other.other.other;
        } catch (err) {
            return null;
        }
    })
    .on('cycle', function(event) {
      console.log(String(event.target));
    })
    .on('complete', function() {
      console.log('Fastest is ' + this.filter('fastest').map('name'));
    });

suite.run({async: true});
try catch an absolute winner

Negative Case

const Benchmark = require("benchmark")
const idx = require("idx")
const R = require("ramda")
const _ = require("lodash")

const data = {
    details: {
        name: 'John Doe',
        school: {
            name: 'MIT',
            other: {
                other: {
                    other: 'eof other',
                }
            }
        }
    }
}

const suite = new Benchmark.Suite;
suite
    .add('ramda', function () {
        return R.pathOr(null, ['detil', 'school', 'other', 'other', 'other'], data);
    })
    .add('lodash', function () {
        return _.get(data, ['detil', 'school', 'other', 'other', 'other'], null)
    })
    .add('idx', function () {
        return idx(data, function(_) {
            return _.detil.school.other.other.other;
        });
    })
    .add('vanilla with &&', function() {
        return data && data.detil && data.detil.school && data.detil.school.other && data.detil.school.other.other && data.detil.school.other.other.other;
    })
    .add('vanilla with try catch', function() {
        try {
            return data.detil.school.other.other.other;
        } catch (err) {
            return null;
        }
    })
    .on('cycle', function(event) {
      console.log(String(event.target));
    })
    .on('complete', function() {
      console.log('Fastest is ' + this.filter('fastest').map('name'));
    });

suite.run({async: true});