Socket
Socket
Sign inDemoInstall

@metamask/utils

Package Overview
Dependencies
Maintainers
7
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@metamask/utils - npm Package Compare versions

Comparing version 3.0.3 to 3.1.0

dist/assert.d.ts

3

dist/index.d.ts

@@ -0,2 +1,5 @@

export * from './assert';
export * from './bytes';
export * from './collections';
export * from './hex';
export * from './json';

@@ -3,0 +6,0 @@ export * from './logging';

@@ -17,3 +17,6 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./assert"), exports);
__exportStar(require("./bytes"), exports);
__exportStar(require("./collections"), exports);
__exportStar(require("./hex"), exports);
__exportStar(require("./json"), exports);

@@ -20,0 +23,0 @@ __exportStar(require("./logging"), exports);

42

dist/json.d.ts

@@ -36,4 +36,4 @@ import { Infer, Struct } from 'superstruct';

code: number;
data: unknown;
message: string;
data: unknown;
stack?: string | undefined;

@@ -47,5 +47,13 @@ }, {

/**
* Mark a certain key of a type as optional.
*/
export declare type OptionalField<Type extends Record<string, unknown>, Key extends keyof Type> = Omit<Type, Key> & Partial<Pick<Type, Key>>;
/**
* A JSON-RPC error object.
*
* Note that TypeScript infers `unknown | undefined` as `unknown`, meaning that
* the `data` field is not optional. To make it optional, we use the
* `OptionalField` helper, to explicitly make it optional.
*/
export declare type JsonRpcError = Infer<typeof JsonRpcErrorStruct>;
export declare type JsonRpcError = OptionalField<Infer<typeof JsonRpcErrorStruct>, 'data'>;
export declare const JsonRpcParamsStruct: Struct<unknown[] | Record<string, unknown> | undefined, null>;

@@ -55,4 +63,4 @@ export declare type JsonRpcParams = Infer<typeof JsonRpcParamsStruct>;

id: string | number | null;
method: string;
jsonrpc: "2.0";
method: string;
params?: unknown[] | Record<string, unknown> | undefined;

@@ -75,4 +83,4 @@ }, {

export declare const JsonRpcNotificationStruct: Struct<{
method: string;
jsonrpc: "2.0";
method: string;
params?: unknown[] | Record<string, unknown> | undefined;

@@ -134,24 +142,9 @@ }, Omit<{

export declare const JsonRpcFailureStruct: Struct<{
error: JsonRpcError;
id: string | number | null;
jsonrpc: "2.0";
error: {
code: number;
message: string;
data: unknown;
stack?: string | undefined;
};
}, {
id: Struct<string | number | null, null>;
jsonrpc: Struct<"2.0", "2.0">;
error: Struct<{
code: number;
message: string;
data: unknown;
stack?: string | undefined;
}, {
code: Struct<number, null>;
message: Struct<string, null>;
data: Struct<unknown, null>;
stack: Struct<string | undefined, null>;
}>;
error: Struct<JsonRpcError, unknown>;
}>;

@@ -167,10 +160,5 @@ /**

} | {
error: JsonRpcError;
id: string | number | null;
jsonrpc: "2.0";
error: {
code: number;
message: string;
data: unknown;
stack?: string | undefined;
};
}, null>;

@@ -177,0 +165,0 @@ /**

@@ -67,2 +67,3 @@ "use strict";

JsonSize[JsonSize["Colon"] = 1] = "Colon";
// eslint-disable-next-line @typescript-eslint/no-shadow
JsonSize[JsonSize["Date"] = 24] = "Date";

@@ -69,0 +70,0 @@ })(JsonSize = exports.JsonSize || (exports.JsonSize = {}));

{
"name": "@metamask/utils",
"version": "3.0.3",
"version": "3.1.0",
"description": "Various JavaScript/TypeScript utilities of wide relevance to the MetaMask codebase.",

@@ -16,15 +16,17 @@ "repository": {

"scripts": {
"setup": "yarn install && yarn allow-scripts",
"test": "jest",
"test:watch": "jest --watch",
"prepublishOnly": "yarn build:clean && yarn lint && yarn test",
"build": "tsc --project tsconfig.build.json",
"build:clean": "rimraf dist && yarn build",
"docs": "typedoc",
"docs:publish": "typedoc --cleanOutputDir false --gitRevision \"v$(jq -r .version < ./package.json)\"",
"lint": "yarn lint:eslint && yarn lint:misc --check",
"lint:eslint": "eslint . --cache --ext js,ts",
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write",
"lint:misc": "prettier '**/*.json' '**/*.md' '!CHANGELOG.md' '**/*.yml' --ignore-path .gitignore",
"lint": "yarn lint:eslint && yarn lint:misc --check",
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write",
"build:clean": "rimraf dist && yarn build",
"build": "tsc --project .",
"docs": "typedoc",
"docs:publish": "typedoc --cleanOutputDir false --gitRevision \"v$(jq -r .version < ./package.json)\""
"prepublishOnly": "yarn build:clean && yarn lint && yarn test",
"test": "jest",
"test:watch": "jest --watch"
},
"resolutions": {
"jest-worker@^28.1.3": "patch:jest-worker@npm%3A28.1.3#./.yarn/patches/jest-worker-npm-28.1.3-5d0ff9006c.patch"
},
"dependencies": {

@@ -37,3 +39,3 @@ "@types/debug": "^4.1.7",

"devDependencies": {
"@lavamoat/allow-scripts": "^1.0.5",
"@lavamoat/allow-scripts": "^2.0.3",
"@metamask/auto-changelog": "^2.3.0",

@@ -55,2 +57,3 @@ "@metamask/eslint-config": "^9.0.0",

"jest": "^28.1.0",
"json-bigint": "^1.0.0",
"prettier": "^2.2.1",

@@ -64,2 +67,3 @@ "prettier-plugin-packagejson": "^2.2.11",

},
"packageManager": "yarn@3.2.3",
"engines": {

@@ -66,0 +70,0 @@ "node": ">=14.0.0"

@@ -24,3 +24,3 @@ # MetaMask Utils

- Install [Yarn v1](https://yarnpkg.com/en/docs/install)
- Run `yarn setup` to install dependencies and run any requried post-install scripts
- Run `yarn setup` to install dependencies and run any required post-install scripts
- **Warning:** Do not use the `yarn` / `yarn install` command directly. Use `yarn setup` instead. The normal install command will skip required post-install scripts, leaving your development environment in an invalid state.

@@ -27,0 +27,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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