Get started with just-safe-get CDN

MIT licensed

The just-safe-get library is a utility for accessing nested properties in an object without throwing a TypeError when the property is undefined.

Tags:
  • object
  • safe
  • get
  • no-dependencies
  • just

Stable version

Copied!

How to start using just-safe-get CDN


// Import just-safe-get
const safeGet = require('just-safe-get');

// Define an object with nested properties
const obj = {
  a: {
    b: {
      c: 'Hello'
    }
  }
};

// Use safeGet to access nested properties
const value = safeGet(obj, 'a.b.c');

console.log(value); // Output: 'Hello'
Copied!

All versions