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

typescript-optional

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typescript-optional - npm Package Compare versions

Comparing version 1.6.1 to 1.7.0

8

dist/lib/index.d.ts

@@ -12,8 +12,8 @@ export default abstract class Optional<T> {

abstract orElse(another: T): T;
abstract orElseGet(another: () => T): T;
abstract orElseThrow<U>(exception: () => U): T;
abstract orElseGet(supplier: () => T): T;
abstract orElseThrow<U>(errorSupplier: () => U): T;
static of<T>(value: T): Optional<T>;
static ofNonNull<T>(value: T): Optional<T>;
static ofNullable<T>(nullable: T | null | undefined): Optional<T>;
static ofNonNull<T>(payload: T): Optional<T>;
static of<T>(payload: T): Optional<T>;
static empty<T>(): Optional<T>;
}

@@ -23,2 +23,11 @@ "use strict";

});
Optional.of = function (value) {
if (value !== null && value !== undefined)
return new PresentOptional(value);
else
throw new TypeError("The passed value was null or undefined.");
};
Optional.ofNonNull = function (value) {
return Optional.of(value);
};
Optional.ofNullable = function (nullable) {

@@ -30,11 +39,2 @@ if (nullable !== null && nullable !== undefined)

};
Optional.ofNonNull = function (payload) {
return Optional.of(payload);
};
Optional.of = function (payload) {
if (payload !== null && payload !== undefined)
return new PresentOptional(payload);
else
throw new TypeError("The passed value was null or undefined.");
};
Optional.empty = function () {

@@ -41,0 +41,0 @@ return new EmptyOptional();

{
"name": "typescript-optional",
"version": "1.6.1",
"version": "1.7.0",
"description": "Optional (like Java) implementation in TypeScript",

@@ -5,0 +5,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

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