New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

get-object-property

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-object-property

Safely get javascript object property with fallback value and error reporting

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

get-object-property

Safely get javascript object property with fallback value and error reporting

API

get-object-property exposes only one function:

  getObjectProperty(executor, fallbackValue, logFunction);

Examples

  import getObjectProperty from 'get-object-property';

  const foo = {};

  const result = getObjectProperty(() => foo.bar.foo, 'default');

  // expect 'default'
  console.log(result);

In order to log failures in executor pass log function as a third argument:

  import getObjectProperty from 'get-object-property';

  logFn = (err) => { console.log(err); };

  const foo = {};

  const result = getObjectProperty(() => foo.bar.foo, 'default', logFn);
  // expect to see error in console

FAQs

Package last updated on 07 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts