You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@xylabs/enum

Package Overview
Dependencies
Maintainers
5
Versions
248
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xylabs/enum - npm Package Compare versions

Comparing version
5.0.84
to
5.0.86
+3
-3
package.json
{
"name": "@xylabs/enum",
"version": "5.0.84",
"version": "5.0.86",
"description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",

@@ -38,4 +38,4 @@ "homepage": "https://xyo.network",

"devDependencies": {
"@xylabs/ts-scripts-yarn3": "~7.4.13",
"@xylabs/tsconfig": "~7.4.13",
"@xylabs/ts-scripts-yarn3": "~7.4.16",
"@xylabs/tsconfig": "~7.4.16",
"typescript": "~5.9.3",

@@ -42,0 +42,0 @@ "vitest": "^4.0.18"

+28
-34

@@ -18,2 +18,4 @@ # @xylabs/enum

## Reference

@@ -27,9 +29,13 @@

- [Enum](#type-aliases/Enum)
- [EnumKey](#type-aliases/EnumKey)
- [EnumValue](#type-aliases/EnumValue)
| Type Alias | Description |
| ------ | ------ |
| [Enum](#type-aliases/Enum) | A utility type that, given a `Record<string, unknown>`, returns a readonly version of that record. This results in a type where all properties of `T` are readonly. |
| [EnumKey](#type-aliases/EnumKey) | A utility type that, given an `Enum` object, returns the union of its keys. |
| [EnumValue](#type-aliases/EnumValue) | A utility type that, given an `Enum` object, returns the union of its values. |
## Functions
- [Enum](#functions/Enum)
| Function | Description |
| ------ | ------ |
| [Enum](#functions/Enum) | Transforms a given record object into a readonly "enum-like" structure while preserving the literal types of its values. This allows you to use the returned object both at runtime (for lookups) and at compile time (for strongly typed values). |

@@ -45,3 +51,3 @@ ### functions

```ts
function Enum<T>(obj): Enum<T>;
function Enum<T>(obj: Readonly<T>): Enum<T>;
```

@@ -58,16 +64,12 @@

### T
| Type Parameter | Description |
| ------ | ------ |
| `T` *extends* `Record`\<`string` \| `number` \| `symbol`, `unknown`\> | A record type with string keys and any kind of values. |
`T` *extends* `Record`\<`string` \| `number` \| `symbol`, `unknown`\>
A record type with string keys and any kind of values.
## Parameters
### obj
| Parameter | Type | Description |
| ------ | ------ | ------ |
| `obj` | `Readonly`\<`T`\> | A readonly record object annotated with `as const`. |
`Readonly`\<`T`\>
A readonly record object annotated with `as const`.
## Returns

@@ -132,8 +134,6 @@

### T
| Type Parameter | Description |
| ------ | ------ |
| `T` *extends* `Readonly`\<`Record`\<`string` \| `number` \| `symbol`, `unknown`\>\> | The record type to make readonly. |
`T` *extends* `Readonly`\<`Record`\<`string` \| `number` \| `symbol`, `unknown`\>\>
The record type to make readonly.
## Example

@@ -176,10 +176,7 @@

### T
| Type Parameter | Default type |
| ------ | ------ |
| `T` *extends* `Record`\<`string` \| `number` \| `symbol`, `unknown`\> | - |
| `K` | [`Enum`](#Enum)\<`T`\> |
`T` *extends* `Record`\<`string` \| `number` \| `symbol`, `unknown`\>
### K
`K` = [`Enum`](#Enum)\<`T`\>
### <a id="EnumValue"></a>EnumValue

@@ -199,11 +196,8 @@

### T
| Type Parameter | Default type |
| ------ | ------ |
| `T` *extends* `Record`\<`string` \| `number` \| `symbol`, `unknown`\> | - |
| `K` | [`Enum`](#Enum)\<`T`\> |
`T` *extends* `Record`\<`string` \| `number` \| `symbol`, `unknown`\>
### K
`K` = [`Enum`](#Enum)\<`T`\>
Part of [sdk-js](https://www.npmjs.com/package/@xyo-network/sdk-js)

@@ -210,0 +204,0 @@