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

@helios-lang/type-utils

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@helios-lang/type-utils - npm Package Compare versions

Comparing version 0.1.5 to 0.1.6

2

package.json
{
"name": "@helios-lang/type-utils",
"version": "0.1.5",
"version": "0.1.6",
"description": "Global utility types",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -7,3 +7,4 @@ declare global {

export const None: null
export function expectSome<T>(option: Option<T>, msg?: string): T
export function isNone<T>(option: Option<T>): option is null | undefined
export function isSome<T>(option: Option<T>): option is T

@@ -8,7 +8,21 @@ /**

* @template T
* @param {Option<T>} opt
* @param {Option<T>} option
* @param {string} msg
* @returns {T}
*/
export function expectSome(option, msg = `unexpected ${option}`) {
if (option !== null && option !== undefined) {
return option
} else {
throw new Error(msg)
}
}
/**
* @template T
* @param {Option<T>} option
* @returns {opt is T}
*/
export function isSome(opt) {
return opt !== null && opt !== undefined
export function isSome(option) {
return option !== null && option !== undefined
}

@@ -18,7 +32,7 @@

* @template T
* @param {Option<T>} opt
* @param {Option<T>} option
* @returns {opt is (null | undefined)}
*/
export function isNone(opt) {
return opt === null || opt === undefined
export function isNone(option) {
return option === null || option === undefined
}
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