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

utilium

Package Overview
Dependencies
Maintainers
0
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

utilium - npm Package Compare versions

Comparing version 1.1.3 to 1.2.0

dist/buffer.d.ts

2

dist/fs.d.ts

@@ -12,3 +12,3 @@ export declare abstract class FileMap<V> implements Map<string, V> {

get size(): number;
get [Symbol.iterator](): () => IterableIterator<[string, V]>;
get [Symbol.iterator](): () => MapIterator<[string, V]>;
get keys(): typeof this._map.keys;

@@ -15,0 +15,0 @@ get values(): typeof this._map.values;

@@ -0,1 +1,3 @@

// This file should not be added to
// For better tree shaking, import from whichever file is actually needed
export * from './list.js';

@@ -2,0 +4,0 @@ export * from './misc.js';

@@ -22,2 +22,3 @@ import type { ClassLike } from '../types.js';

bigEndian: boolean;
isUnion: boolean;
}

@@ -24,0 +25,0 @@ export interface Member {

export declare function wait(time: number): Promise<unknown>;
export declare const greekLetterNames: string[];
export declare function isHex(str: string): boolean;
/** Prevent infinite loops */
export declare function canary(error?: Error): () => void;
/**
* A wrapper for throwing things in an expression context.
* You will likely want to remove this if you can just use `throw` in expressions.
* @see https://github.com/tc39/proposal-throw-expressions
*/
export declare function _throw(e: unknown): never;

@@ -34,1 +34,16 @@ export function wait(time) {

}
/** Prevent infinite loops */
export function canary(error = new Error()) {
const timeout = setTimeout(() => {
throw error;
}, 5000);
return () => clearTimeout(timeout);
}
/**
* A wrapper for throwing things in an expression context.
* You will likely want to remove this if you can just use `throw` in expressions.
* @see https://github.com/tc39/proposal-throw-expressions
*/
export function _throw(e) {
throw e;
}

@@ -39,7 +39,8 @@ import * as primitive from './internal/primitives.js';

members.set(name, {
offset: size,
offset: options.isUnion ? 0 : size,
type: primitive.isValid(type) ? primitive.normalize(type) : type,
length,
});
size += sizeof(type) * (length || 1);
const memberSize = sizeof(type) * (length || 1);
size = options.isUnion ? Math.max(size, memberSize) : size + memberSize;
size = align(size, options.align || 1);

@@ -78,2 +79,3 @@ }

const view = new DataView(buffer.buffer);
// for unions we should write members in ascending last modified order, but we don't have that info.
for (const [name, { type, length, offset }] of members) {

@@ -80,0 +82,0 @@ for (let i = 0; i < (length || 1); i++) {

@@ -195,2 +195,12 @@ /**

export type WithOptional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
/**
* Nothing in T
*/
export type Never<T> = {
[K in keyof T]?: never;
};
/**
* All of the properties in T or none of them
*/
export type AllOrNone<T> = T | Never<T>;
export {};
{
"name": "utilium",
"version": "1.1.3",
"version": "1.2.0",
"description": "Typescript utilities",

@@ -45,4 +45,2 @@ "funding": {

"@eslint/js": "^9.12.0",
"@stylistic/eslint-plugin": "^2.9.0",
"@types/eslint__js": "^8.42.3",
"@types/node": "^20.12.7",

@@ -53,4 +51,4 @@ "eslint": "^9.12.0",

"tsx": "^4.19.1",
"typedoc": "^0.26.6",
"typescript": "^5.5.4",
"typedoc": "^0.27.6",
"typescript": "^5.7.2",
"typescript-eslint": "^8.8.0"

@@ -57,0 +55,0 @@ },

@@ -5,10 +5,12 @@ # Utilium

- Structs (using decorators)
- Compile-time math types
- Debugging types
- Convenience types and functions for strings and objects
- RNG functions
- `List`, a class that combines the best aspects of `Set` and arrays
- `JSONFileMap` and `FolderMap`
- Version utilities
- Xterm.js shell handling (arrows, home/end, prompting, etc.)
- Structs (using decorators)
- Compile-time math types
- Debugging types and functions
- Utilities for using `fetch` with [HTTP range requests](https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests)
- Extending buffers easier with `extendBuffer`
- Convenience types and functions for strings and objects
- RNG functions
- `List`, a class that combines the best aspects of `Set` and arrays
- `JSONFileMap` and `FolderMap`
- Version utilities
- Xterm.js shell handling (arrows, home/end, prompting, etc.)

@@ -0,1 +1,4 @@

// This file should not be added to
// For better tree shaking, import from whichever file is actually needed
export * from './list.js';

@@ -2,0 +5,0 @@ export * from './misc.js';

@@ -32,2 +32,3 @@ import type { ClassLike } from '../types.js';

bigEndian: boolean;
isUnion: boolean;
}

@@ -34,0 +35,0 @@

@@ -37,1 +37,19 @@ export function wait(time: number) {

}
/** Prevent infinite loops */
export function canary(error: Error = new Error()) {
const timeout = setTimeout(() => {
throw error;
}, 5000);
return () => clearTimeout(timeout);
}
/**
* A wrapper for throwing things in an expression context.
* You will likely want to remove this if you can just use `throw` in expressions.
* @see https://github.com/tc39/proposal-throw-expressions
*/
export function _throw(e: unknown): never {
throw e;
}

@@ -48,7 +48,8 @@ import * as primitive from './internal/primitives.js';

members.set(name, {
offset: size,
offset: options.isUnion ? 0 : size,
type: primitive.isValid(type) ? primitive.normalize(type) : type,
length,
});
size += sizeof(type) * (length || 1);
const memberSize = sizeof(type) * (length || 1);
size = options.isUnion ? Math.max(size, memberSize) : size + memberSize;
size = align(size, options.align || 1);

@@ -94,2 +95,3 @@ }

// for unions we should write members in ascending last modified order, but we don't have that info.
for (const [name, { type, length, offset }] of members) {

@@ -96,0 +98,0 @@ for (let i = 0; i < (length || 1); i++) {

@@ -235,1 +235,11 @@ /**

export type WithOptional<T, K extends keyof T> = Pick<Partial<T>, K> & Omit<T, K>;
/**
* Nothing in T
*/
export type Never<T> = { [K in keyof T]?: never };
/**
* All of the properties in T or none of them
*/
export type AllOrNone<T> = T | Never<T>;
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