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

@trezor/utils

Package Overview
Dependencies
Maintainers
4
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trezor/utils - npm Package Compare versions

Comparing version 9.2.0 to 9.2.1-beta.1

1

lib/bufferUtils.d.ts

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

/// <reference types="node" />
export declare const reverseBuffer: (src: Buffer) => Buffer;
export declare const getChunkSize: (n: number) => Buffer;
//# sourceMappingURL=bufferUtils.d.ts.map

2

lib/createLazy.d.ts

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

export declare const createLazy: <T, TArgs extends any[]>(initLazy: (...args: TArgs) => Promise<T>, disposeLazy?: ((t: T) => void) | undefined) => {
export declare const createLazy: <T, TArgs extends Array<any>>(initLazy: (...args: TArgs) => Promise<T>, disposeLazy?: (t: T) => void) => {
get: () => T | undefined;

@@ -3,0 +3,0 @@ getPending: () => Promise<T> | undefined;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getValueByKey = exports.getKeyByValue = void 0;
exports.getKeyByValue = getKeyByValue;
exports.getValueByKey = getValueByKey;
function getKeyByValue(obj, value) {
return obj && Object.keys(obj).find(x => obj[x] === value);
}
exports.getKeyByValue = getKeyByValue;
function getValueByKey(obj, enumKey) {

@@ -12,3 +12,2 @@ const key = obj && Object.keys(obj).find(x => x === enumKey);

}
exports.getValueByKey = getValueByKey;
//# sourceMappingURL=enumUtils.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getLocaleSeparators = void 0;
exports.getLocaleSeparators = getLocaleSeparators;
function getLocaleSeparators(locale) {

@@ -17,3 +17,2 @@ const formattedNumber = new Intl.NumberFormat(locale).format(1234567.89);

}
exports.getLocaleSeparators = getLocaleSeparators;
//# sourceMappingURL=getLocaleSeparators.native.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isAscii = void 0;
exports.isAscii = isAscii;
function isAscii(value) {

@@ -9,3 +9,2 @@ if (!value)

}
exports.isAscii = isAscii;
//# sourceMappingURL=isAscii.js.map

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

export declare const isNotUndefined: <T>(item?: T | undefined) => item is T;
export declare const isNotUndefined: <T>(item?: T) => item is T;
//# sourceMappingURL=isNotUndefined.d.ts.map

@@ -19,3 +19,3 @@ type TAllKeys<T> = T extends any ? keyof T : never;

options: IOptions;
withOptions<T_1 extends IObject[]>(options: Partial<IOptions>, ...objects: T_1): TMerged<T_1[number]>;
withOptions<T extends IObject[]>(options: Partial<IOptions>, ...objects: T): TMerged<T[number]>;
};

@@ -22,0 +22,0 @@ interface IOptions {

@@ -58,5 +58,8 @@ "use strict";

const aborter = new AbortController();
const onClear = () => aborter.abort();
if (clear.aborted)
onClear();
aborter.abort();
const onClear = () => {
clear.removeEventListener('abort', onClear);
aborter.abort();
};
clear.addEventListener('abort', onClear);

@@ -67,3 +70,4 @@ try {

finally {
clear.removeEventListener('abort', onClear);
if (!clear.aborted)
clear.removeEventListener('abort', onClear);
}

@@ -70,0 +74,0 @@ });

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.splitStringEveryNCharacters = void 0;
exports.splitStringEveryNCharacters = splitStringEveryNCharacters;
function splitStringEveryNCharacters(value, n) {

@@ -12,3 +12,2 @@ var _a;

}
exports.splitStringEveryNCharacters = splitStringEveryNCharacters;
//# sourceMappingURL=splitStringEveryNCharacters.js.map

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

export declare const topologicalSort: <T>(elements: T[], precedes: (pred: T, succ: T) => boolean, tie?: ((a: T, b: T) => number) | undefined) => T[];
export declare const topologicalSort: <T>(elements: T[], precedes: (pred: T, succ: T) => boolean, tie?: (a: T, b: T) => number) => T[];
//# sourceMappingURL=topologicalSort.d.ts.map

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

/// <reference types="node" />
import { EventEmitter } from 'events';

@@ -3,0 +2,0 @@ type EventMap = Record<string, any>;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.normalizeVersion = exports.isNewerOrEqual = exports.isEqual = exports.isNewer = exports.isVersionArray = void 0;
const isVersionArray = (arr) => {
if (!Array.isArray(arr)) {
return false;
}
if (arr.length !== 3) {
return false;
}
for (let i = 0; i < arr.length; i++) {
const versionNumber = arr[i];
if (typeof versionNumber !== 'number' || versionNumber < 0) {
return false;
}
}
return true;
};
const throwError_1 = require("./throwError");
const isVersionArray = (arr) => Array.isArray(arr) &&
arr.length === 3 &&
arr.every(number => typeof number === 'number' && number >= 0);
exports.isVersionArray = isVersionArray;
const parse = (versionArr) => ({
major: versionArr[0],
minor: versionArr[1],
patch: versionArr[2],
});
const split = (version) => {
const arr = version.split('.').map(v => Number(v));
if (!(0, exports.isVersionArray)(arr)) {
throw new Error(`version string is in wrong format: ${version}`);
}
return arr;
const tryParse = (version) => {
var _a;
return (_a = version
.match(/^(\d+)\.(\d+)\.(\d+)([+-].*)?$/)) === null || _a === void 0 ? void 0 : _a.slice(1, 4).map(n => Number(n));
};
const versionToString = (arr) => `${arr[0]}.${arr[1]}.${arr[2]}`;
const isNewer = (versionX, versionY) => {
const parsedX = parse(typeof versionX === 'string' ? split(versionX) : versionX);
const parsedY = parse(typeof versionY === 'string' ? split(versionY) : versionY);
if (parsedX.major - parsedY.major !== 0) {
return parsedX.major > parsedY.major;
}
if (parsedX.minor - parsedY.minor !== 0) {
return parsedX.minor > parsedY.minor;
}
if (parsedX.patch - parsedY.patch !== 0) {
return parsedX.patch > parsedY.patch;
}
return false;
const validateArray = (version) => ((0, exports.isVersionArray)(version) ? version : null);
const ensureArray = (version) => {
var _a;
return (_a = (typeof version === 'string' ? tryParse(version) : validateArray(version))) !== null && _a !== void 0 ? _a : (0, throwError_1.throwError)(`version string is in wrong format: ${version}`);
};
const compare = ([majorX, minorX, patchX], [majorY, minorY, patchY]) => majorX - majorY || minorX - minorY || patchX - patchY;
const isNewer = (versionX, versionY) => compare(ensureArray(versionX), ensureArray(versionY)) > 0;
exports.isNewer = isNewer;
const isEqual = (versionX, versionY) => {
const strX = typeof versionX === 'string' ? versionX : versionToString(versionX);
const strY = typeof versionY === 'string' ? versionY : versionToString(versionY);
return strX === strY;
};
const isEqual = (versionX, versionY) => compare(ensureArray(versionX), ensureArray(versionY)) === 0;
exports.isEqual = isEqual;
const isNewerOrEqual = (versionX, versionY) => (0, exports.isNewer)(versionX, versionY) || (0, exports.isEqual)(versionX, versionY);
const isNewerOrEqual = (versionX, versionY) => compare(ensureArray(versionX), ensureArray(versionY)) >= 0;
exports.isNewerOrEqual = isNewerOrEqual;

@@ -56,0 +26,0 @@ const normalizeVersion = (version) => version.replace(/\b0+(\d)/g, '$1');

{
"name": "@trezor/utils",
"version": "9.2.0",
"version": "9.2.1-beta.1",
"author": "Trezor <info@trezor.io>",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/trezor/trezor-suite/tree/develop/packages/utils",

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