This package has been deprecated

Author message:

Moved to @empathyco/x-utils: https://github.com/empathyco/x/blob/main/packages/x-utils/src/get-safe-property-chain.ts

@empathyco/x-get-safe-property-chain
TypeScript icon, indicating that this package has built-in type declarations

1.3.0-alpha.4 • Public • Published

x-get-safe-property-chain

A utility for safely retrieving nested values.

Installation

You can install the package using npm

npm install @empathyco/x-get-safe-property-chain --save-dev

Usage

import { getSafePropertyChain } from '@empathyco/x-get-safe-property-chain';

const obj = { nestedObject: { anotherNestedObject: { message: 'Hell yeah!' } } }; 
const message = getSafePropertyChain(obj, 'nestedObject.anotherNestedObject.message');
console.log(message); // 'Hell yeah!'

Readme

Keywords

Package Sidebar

Install

npm i @empathyco/x-get-safe-property-chain

Weekly Downloads

1

Version

1.3.0-alpha.4

License

Apache-2.0

Unpacked Size

23.1 kB

Total Files

8

Last publish

Collaborators

  • empathy-support
  • guillermotti
  • ivantajes
  • javieri-empathy
  • roberd