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

@trezor/type-utils

Package Overview
Dependencies
Maintainers
4
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trezor/type-utils - npm Package Compare versions

Comparing version 1.1.1-beta.1 to 1.1.1-beta.2

2

package.json
{
"name": "@trezor/type-utils",
"version": "1.1.1-beta.1",
"version": "1.1.1-beta.2",
"license": "See LICENSE.md in repo root",

@@ -5,0 +5,0 @@ "sideEffects": false,

@@ -61,15 +61,1 @@ // make key required

export type DefinedUnionMember<T> = T extends string ? T : never;
/**
* Type-guard if a value is a subset of an array.
* Useful to narrow down a union type `value` to a subset of the union (typeof `arr`).
*
* Example:
* type Variant = 'a' | 'b' | 'c' | 'd';
* const skippedVariants = ['a', 'b'] satisfies Variant[];
* if(isArrayMember(variant, skippedVariants)) // variant is 'a' | 'b', else 'c' | 'd'
*/
export const isArrayMember = <Value extends string, Subset extends Value>(
value: Value,
arr: Subset[],
): value is Subset => arr.some(v => v === value);
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