New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

optional-chain-proxy

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

optional-chain-proxy

Optional chain access implementation in TypeScript. Uses [Proxy API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy)

  • 0.1.2
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

optional-chain-proxy travis-ci

Optional chain access implementation in TypeScript.
Uses Proxy API

Install

npm install optional-chain-proxy

Usage

import { optional } from "optional-chain-proxy";

type User {
  name?: {
    first: string
  }
}
const user: User = getUser(); // { name: null }
const optionalUser = optional(user);
optionalUser.name.first; // undefined, does not throw an exception.

API

optional-chain-proxy exports optional function. optional function lets a target object or an array and return the object which does not throw an exception even if accessing to null or undefined values.

optional

optional<T>(object: T) :: T

License

MIT

FAQs

Package last updated on 16 Apr 2018

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc