Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@jsiebern/get_in_ppx

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jsiebern/get_in_ppx

get_in ppx for option chaining in reason

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

get_in ppx

An exploration of the "safe call operators" pull-request, implemented as a ppx.

Installation

npm i get_in_ppx

bsconfig.json

"ppx-flags": ["get_in_ppx/ppx"]

Operators

This ppx includes two operators, that are valid within the [%get_in ] form.

  • #?? is to be used when both sides are optional. E.g. the object on the left is optional, and the attribute you're getting out is also optional. e.g. option({. "attr": option(int)})
  • #? is to be used when only the object is optional, but the attribute you're getting out is not. e.g. option({. "attr": int})

Usage

/* some data with optional attributes in javascript objects (e.g. from graphql) */
let one = Some({"two": Some({"three": 4})});

let x: option(int) = [%get_in one#??two#?three];

Keywords

FAQs

Package last updated on 18 Nov 2019

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