Skip to content

Safely access a property for any sort of objects

Notifications You must be signed in to change notification settings

leopiney/safely

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Safely access properties of any sort of object!

Requirements

  • Node 6.0 or later

Usage

import safe, { either } from 'safely'

const dangerousObject = { data: [{ values: [] }]}

safe(dangerousObject).data[0].values[0].value // returns {}
either(safe(dangerousObject).data[0].values[0].value, 42) // returns 42

About

Safely access a property for any sort of objects

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published