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

option-js

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

option-js

This project is a Naive representation of Scala's `Option[T]`

  • 1.0.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

OptionJS Build Status

This project is a Naive representation of Scala's Option[T]

Examples

const Option = require('option-js');
const DefaultValue = 50;

const value = Option.of(10);
const valueNull = Option.of(null);

console.log(value.getOrElse(DefaultValue)); // 10
console.log(valueNull.getOrElse(DefaultValue)); // 50

function user(name) {
    return {
        username: 'username', //Required
        name: Option.of(name)
    };
}

const withName = user("John");
const withoutName = user();
console.log(withName.name.getOrElse('Anonymous')); // John
console.log(withoutName.name.getOrElse('Anonymous')); // Anonymous

FAQs

Package last updated on 30 Jul 2016

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