Skip to content

Escape the dreaded `Uncaught TypeError: Cannot read property 'a' of undefined`

License

Notifications You must be signed in to change notification settings

rabbishuki/get-n-log

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

npm npm bundle size (minified) License

get-n-log

Escaping the dreaded console error:

Uncaught TypeError: Cannot read property 'sourceTarget' of undefined

Because isn't this way much better?


Table of Contents


Features

  • No dependecies!
  • Your javascript won't fail if you are looking for something that doesn't exist.
  • You will be able to look at the stack trace and find the location of your error.

Example

In your project directory

# Install fron NPM
$ npm install -save get-n-log

In your code

import {get} from 'get-n-log';

...

// Use it like this:
getSafe(() => obj.a.lot.of.properties);

// or add an optional default value:
getSafe(() => obj.a.lot.of.properties, 'nothing');

Contributing

To get started...

Step 1

  • Option 1

    • 🍴 Fork this repo!
  • Option 2

    • 👯 Clone this repo to your local machine using https://github.com/rabbishuki/get-n-log.git

Step 2

  • HACK AWAY! 🔨🔨🔨

Step 3


About

Escape the dreaded `Uncaught TypeError: Cannot read property 'a' of undefined`

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published