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

@axelarjs/utils

Package Overview
Dependencies
Maintainers
2
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@axelarjs/utils - npm Package Compare versions

Comparing version 0.0.0-snapshot.8af9be9 to 0.0.0-snapshot.99c2f0a

1

array.d.ts

@@ -5,1 +5,2 @@ export { default as ascend } from "ramda/src/ascend";

export { default as memoizeWith } from "ramda/src/memoizeWith";
export declare const toSum: (list: readonly bigint[]) => bigint;

4

array.js

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.memoizeWith = exports.sortWith = exports.descend = exports.ascend = void 0;
exports.toSum = exports.memoizeWith = exports.sortWith = exports.descend = exports.ascend = void 0;
const ramda_1 = require("ramda");
var ascend_1 = require("ramda/src/ascend");

@@ -16,1 +17,2 @@ Object.defineProperty(exports, "ascend", { enumerable: true, get: function () { return __importDefault(ascend_1).default; } });

Object.defineProperty(exports, "memoizeWith", { enumerable: true, get: function () { return __importDefault(memoizeWith_1).default; } });
exports.toSum = (0, ramda_1.reduce)((a, b) => a + b, 0n);

@@ -5,1 +5,2 @@ export { default as ascend } from "ramda/src/ascend";

export { default as memoizeWith } from "ramda/src/memoizeWith";
export declare const toSum: (list: readonly bigint[]) => bigint;

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

Object.defineProperty(exports, "__esModule", { value: true });
exports.memoizeWith = exports.sortWith = exports.descend = exports.ascend = void 0;
exports.toSum = exports.memoizeWith = exports.sortWith = exports.descend = exports.ascend = void 0;
const ramda_1 = require("ramda");
var ascend_1 = require("ramda/src/ascend");

@@ -16,1 +17,2 @@ Object.defineProperty(exports, "ascend", { enumerable: true, get: function () { return __importDefault(ascend_1).default; } });

Object.defineProperty(exports, "memoizeWith", { enumerable: true, get: function () { return __importDefault(memoizeWith_1).default; } });
exports.toSum = (0, ramda_1.reduce)((a, b) => a + b, 0n);

@@ -34,5 +34,4 @@ "use strict";

camelCase: (input) => {
var _a, _b;
const words = (_a = input.split("_")) !== null && _a !== void 0 ? _a : [];
const firstWord = (_b = words.shift()) === null || _b === void 0 ? void 0 : _b.toLowerCase();
const words = input.split("_") ?? [];
const firstWord = words.shift()?.toLowerCase();
return [

@@ -68,5 +67,4 @@ firstWord,

function convertCase(fromCase, toCase) {
var _a;
return ((_a = exports.CONVERTERS[fromCase]) === null || _a === void 0 ? void 0 : _a[toCase]) || ((input) => input); // No conversion needed
return exports.CONVERTERS[fromCase]?.[toCase] || ((input) => input); // No conversion needed
}
exports.convertCase = convertCase;

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

function hexlify(value, options) {
var _a;
if (!options) {

@@ -104,3 +103,3 @@ options = {};

for (let i = 0; i < value.length; i++) {
const v = (_a = value[i]) !== null && _a !== void 0 ? _a : 0;
const v = value[i] ?? 0;
result +=

@@ -107,0 +106,0 @@ String(HexCharacters[(v & 0xf0) >> 4]) +

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

constructor(options = {}) {
var _a, _b;
this.prefixUrl = "";

@@ -26,5 +25,5 @@ this.defaultHeaders = {

this.credentials = "omit";
this.prefixUrl = (_a = options.prefixUrl) !== null && _a !== void 0 ? _a : "";
this.prefixUrl = options.prefixUrl ?? "";
this.defaultHeaders = { ...this.defaultHeaders, ...options.defaultHeaders };
this.credentials = (_b = options.credentials) !== null && _b !== void 0 ? _b : "omit";
this.credentials = options.credentials ?? "omit";
}

@@ -31,0 +30,0 @@ /**

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

get(target, p) {
var _a;
if (typeof p === "symbol") {

@@ -17,3 +16,3 @@ // eslint-disable-next-line @typescript-eslint/ban-ts-comment

}
return (_a = Object.entries(target).find(([key]) => key.localeCompare(p, undefined, { sensitivity: "accent" }) === 0)) === null || _a === void 0 ? void 0 : _a[1];
return Object.entries(target).find(([key]) => key.localeCompare(p, undefined, { sensitivity: "accent" }) === 0)?.[1];
},

@@ -20,0 +19,0 @@ });

@@ -18,1 +18,8 @@ export declare const isNilOrWhitespace: (value: string | undefined | null) => value is null | undefined;

export declare function caseInsensitiveEqual(a: string | undefined, b: string | undefined): boolean;
/**
* Locale compare two strings. a.localeCompare(b)
* @param a string
* @param b string
* @returns number
*/
export declare const localeCompare: (a: string, b: string) => number;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.caseInsensitiveEqual = exports.generateRandomHash = exports.maskAddress = exports.unSluggify = exports.sluggify = exports.capitalize = exports.isNilOrWhitespace = void 0;
const isNilOrWhitespace = (value) => { var _a; return ((_a = value === null || value === void 0 ? void 0 : value.trim()) !== null && _a !== void 0 ? _a : "") === ""; };
exports.localeCompare = exports.caseInsensitiveEqual = exports.generateRandomHash = exports.maskAddress = exports.unSluggify = exports.sluggify = exports.capitalize = exports.isNilOrWhitespace = void 0;
const isNilOrWhitespace = (value) => (value?.trim() ?? "") === "";
exports.isNilOrWhitespace = isNilOrWhitespace;

@@ -15,6 +15,3 @@ const capitalize = (value) => value.charAt(0).toUpperCase().concat(value.slice(1));

exports.unSluggify = unSluggify;
const maskAddress = (address, opts) => {
var _a, _b;
return `${address.slice(0, (_a = opts === null || opts === void 0 ? void 0 : opts.segmentA) !== null && _a !== void 0 ? _a : 6)}...${address.slice((_b = opts === null || opts === void 0 ? void 0 : opts.segmentB) !== null && _b !== void 0 ? _b : -4)}`;
};
const maskAddress = (address, opts) => `${address.slice(0, opts?.segmentA ?? 6)}...${address.slice(opts?.segmentB ?? -4)}`;
exports.maskAddress = maskAddress;

@@ -35,4 +32,12 @@ function generateRandomHash(bits = 32) {

function caseInsensitiveEqual(a, b) {
return (a === null || a === void 0 ? void 0 : a.toLowerCase()) === (b === null || b === void 0 ? void 0 : b.toLowerCase());
return a?.toLowerCase() === b?.toLowerCase();
}
exports.caseInsensitiveEqual = caseInsensitiveEqual;
/**
* Locale compare two strings. a.localeCompare(b)
* @param a string
* @param b string
* @returns number
*/
const localeCompare = (a, b) => a.localeCompare(b);
exports.localeCompare = localeCompare;

@@ -5,1 +5,2 @@ export { default as ascend } from "ramda/src/ascend";

export { default as memoizeWith } from "ramda/src/memoizeWith";
export declare const toSum: (list: readonly bigint[]) => bigint;

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

import { reduce } from "ramda";
export { default as ascend } from "ramda/src/ascend";

@@ -5,1 +6,2 @@ export { default as descend } from "ramda/src/descend";

export { default as memoizeWith } from "ramda/src/memoizeWith";
export const toSum = reduce((a, b) => a + b, 0n);

@@ -31,5 +31,4 @@ export const CONVERTERS = {

camelCase: (input) => {
var _a, _b;
const words = (_a = input.split("_")) !== null && _a !== void 0 ? _a : [];
const firstWord = (_b = words.shift()) === null || _b === void 0 ? void 0 : _b.toLowerCase();
const words = input.split("_") ?? [];
const firstWord = words.shift()?.toLowerCase();
return [

@@ -65,4 +64,3 @@ firstWord,

export function convertCase(fromCase, toCase) {
var _a;
return ((_a = CONVERTERS[fromCase]) === null || _a === void 0 ? void 0 : _a[toCase]) || ((input) => input); // No conversion needed
return CONVERTERS[fromCase]?.[toCase] || ((input) => input); // No conversion needed
}

@@ -42,3 +42,2 @@ const HexCharacters = "0123456789abcdef";

export function hexlify(value, options) {
var _a;
if (!options) {

@@ -98,3 +97,3 @@ options = {};

for (let i = 0; i < value.length; i++) {
const v = (_a = value[i]) !== null && _a !== void 0 ? _a : 0;
const v = value[i] ?? 0;
result +=

@@ -101,0 +100,0 @@ String(HexCharacters[(v & 0xf0) >> 4]) +

@@ -12,3 +12,2 @@ import unfetch from "isomorphic-unfetch";

constructor(options = {}) {
var _a, _b;
this.prefixUrl = "";

@@ -20,5 +19,5 @@ this.defaultHeaders = {

this.credentials = "omit";
this.prefixUrl = (_a = options.prefixUrl) !== null && _a !== void 0 ? _a : "";
this.prefixUrl = options.prefixUrl ?? "";
this.defaultHeaders = { ...this.defaultHeaders, ...options.defaultHeaders };
this.credentials = (_b = options.credentials) !== null && _b !== void 0 ? _b : "omit";
this.credentials = options.credentials ?? "omit";
}

@@ -25,0 +24,0 @@ /**

export const caseInsensitiveRecord = (record) => new Proxy(record, {
get(target, p) {
var _a;
if (typeof p === "symbol") {

@@ -13,3 +12,3 @@ // eslint-disable-next-line @typescript-eslint/ban-ts-comment

}
return (_a = Object.entries(target).find(([key]) => key.localeCompare(p, undefined, { sensitivity: "accent" }) === 0)) === null || _a === void 0 ? void 0 : _a[1];
return Object.entries(target).find(([key]) => key.localeCompare(p, undefined, { sensitivity: "accent" }) === 0)?.[1];
},

@@ -16,0 +15,0 @@ });

@@ -18,1 +18,8 @@ export declare const isNilOrWhitespace: (value: string | undefined | null) => value is null | undefined;

export declare function caseInsensitiveEqual(a: string | undefined, b: string | undefined): boolean;
/**
* Locale compare two strings. a.localeCompare(b)
* @param a string
* @param b string
* @returns number
*/
export declare const localeCompare: (a: string, b: string) => number;

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

export const isNilOrWhitespace = (value) => { var _a; return ((_a = value === null || value === void 0 ? void 0 : value.trim()) !== null && _a !== void 0 ? _a : "") === ""; };
export const isNilOrWhitespace = (value) => (value?.trim() ?? "") === "";
export const capitalize = (value) => value.charAt(0).toUpperCase().concat(value.slice(1));

@@ -8,6 +8,3 @@ export const sluggify = (value) => value

export const unSluggify = (value) => value.split("-").map(capitalize).join(" ");
export const maskAddress = (address, opts) => {
var _a, _b;
return `${address.slice(0, (_a = opts === null || opts === void 0 ? void 0 : opts.segmentA) !== null && _a !== void 0 ? _a : 6)}...${address.slice((_b = opts === null || opts === void 0 ? void 0 : opts.segmentB) !== null && _b !== void 0 ? _b : -4)}`;
};
export const maskAddress = (address, opts) => `${address.slice(0, opts?.segmentA ?? 6)}...${address.slice(opts?.segmentB ?? -4)}`;
export function generateRandomHash(bits = 32) {

@@ -26,3 +23,10 @@ const bytes = window.crypto.getRandomValues(new Uint8Array(bits));

export function caseInsensitiveEqual(a, b) {
return (a === null || a === void 0 ? void 0 : a.toLowerCase()) === (b === null || b === void 0 ? void 0 : b.toLowerCase());
return a?.toLowerCase() === b?.toLowerCase();
}
/**
* Locale compare two strings. a.localeCompare(b)
* @param a string
* @param b string
* @returns number
*/
export const localeCompare = (a, b) => a.localeCompare(b);

@@ -34,5 +34,4 @@ "use strict";

camelCase: (input) => {
var _a, _b;
const words = (_a = input.split("_")) !== null && _a !== void 0 ? _a : [];
const firstWord = (_b = words.shift()) === null || _b === void 0 ? void 0 : _b.toLowerCase();
const words = input.split("_") ?? [];
const firstWord = words.shift()?.toLowerCase();
return [

@@ -68,5 +67,4 @@ firstWord,

function convertCase(fromCase, toCase) {
var _a;
return ((_a = exports.CONVERTERS[fromCase]) === null || _a === void 0 ? void 0 : _a[toCase]) || ((input) => input); // No conversion needed
return exports.CONVERTERS[fromCase]?.[toCase] || ((input) => input); // No conversion needed
}
exports.convertCase = convertCase;

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

function hexlify(value, options) {
var _a;
if (!options) {

@@ -104,3 +103,3 @@ options = {};

for (let i = 0; i < value.length; i++) {
const v = (_a = value[i]) !== null && _a !== void 0 ? _a : 0;
const v = value[i] ?? 0;
result +=

@@ -107,0 +106,0 @@ String(HexCharacters[(v & 0xf0) >> 4]) +

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

constructor(options = {}) {
var _a, _b;
this.prefixUrl = "";

@@ -26,5 +25,5 @@ this.defaultHeaders = {

this.credentials = "omit";
this.prefixUrl = (_a = options.prefixUrl) !== null && _a !== void 0 ? _a : "";
this.prefixUrl = options.prefixUrl ?? "";
this.defaultHeaders = { ...this.defaultHeaders, ...options.defaultHeaders };
this.credentials = (_b = options.credentials) !== null && _b !== void 0 ? _b : "omit";
this.credentials = options.credentials ?? "omit";
}

@@ -31,0 +30,0 @@ /**

{
"name": "@axelarjs/utils",
"version": "0.0.0-snapshot.8af9be9",
"version": "0.0.0-snapshot.99c2f0a",
"publishConfig": {

@@ -57,7 +57,7 @@ "access": "public"

"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^14.1.2",
"@tsconfig/strictest": "^2.0.2",
"@testing-library/react": "^14.2.1",
"@tsconfig/strictest": "^2.0.3",
"@types/lodash.debounce": "^4.0.9",
"@types/lodash.throttle": "^4.1.9",
"@types/node": "^20.11.5",
"@types/node": "^20.11.20",
"@types/ramda": "^0.29.10",

@@ -68,6 +68,6 @@ "@types/react": "18.2.21",

"@vitejs/plugin-react": "^4.2.1",
"fast-check": "^3.15.0",
"fast-check": "^3.15.1",
"happy-dom": "^9.20.3",
"matchers": "link:@testing-library/jest-dom/matchers",
"rambda": "^9.0.1",
"rambda": "^9.1.0",
"react": "^18.2.0",

@@ -77,5 +77,5 @@ "react-dom": "^18.2.0",

"typescript": "^5.3.3",
"vite": "^5.0.12",
"vitest": "^1.2.1",
"@axelarjs/config": "0.0.0-snapshot.8af9be9"
"vite": "^5.1.4",
"vitest": "^1.3.1",
"@axelarjs/config": "0.0.0-snapshot.99c2f0a"
},

@@ -88,3 +88,3 @@ "dependencies": {

"ramda": "^0.29.1",
"tiny-invariant": "^1.3.1"
"tiny-invariant": "^1.3.3"
},

@@ -91,0 +91,0 @@ "scripts": {

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

get(target, p) {
var _a;
if (typeof p === "symbol") {

@@ -17,3 +16,3 @@ // eslint-disable-next-line @typescript-eslint/ban-ts-comment

}
return (_a = Object.entries(target).find(([key]) => key.localeCompare(p, undefined, { sensitivity: "accent" }) === 0)) === null || _a === void 0 ? void 0 : _a[1];
return Object.entries(target).find(([key]) => key.localeCompare(p, undefined, { sensitivity: "accent" }) === 0)?.[1];
},

@@ -20,0 +19,0 @@ });

@@ -18,1 +18,8 @@ export declare const isNilOrWhitespace: (value: string | undefined | null) => value is null | undefined;

export declare function caseInsensitiveEqual(a: string | undefined, b: string | undefined): boolean;
/**
* Locale compare two strings. a.localeCompare(b)
* @param a string
* @param b string
* @returns number
*/
export declare const localeCompare: (a: string, b: string) => number;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.caseInsensitiveEqual = exports.generateRandomHash = exports.maskAddress = exports.unSluggify = exports.sluggify = exports.capitalize = exports.isNilOrWhitespace = void 0;
const isNilOrWhitespace = (value) => { var _a; return ((_a = value === null || value === void 0 ? void 0 : value.trim()) !== null && _a !== void 0 ? _a : "") === ""; };
exports.localeCompare = exports.caseInsensitiveEqual = exports.generateRandomHash = exports.maskAddress = exports.unSluggify = exports.sluggify = exports.capitalize = exports.isNilOrWhitespace = void 0;
const isNilOrWhitespace = (value) => (value?.trim() ?? "") === "";
exports.isNilOrWhitespace = isNilOrWhitespace;

@@ -15,6 +15,3 @@ const capitalize = (value) => value.charAt(0).toUpperCase().concat(value.slice(1));

exports.unSluggify = unSluggify;
const maskAddress = (address, opts) => {
var _a, _b;
return `${address.slice(0, (_a = opts === null || opts === void 0 ? void 0 : opts.segmentA) !== null && _a !== void 0 ? _a : 6)}...${address.slice((_b = opts === null || opts === void 0 ? void 0 : opts.segmentB) !== null && _b !== void 0 ? _b : -4)}`;
};
const maskAddress = (address, opts) => `${address.slice(0, opts?.segmentA ?? 6)}...${address.slice(opts?.segmentB ?? -4)}`;
exports.maskAddress = maskAddress;

@@ -35,4 +32,12 @@ function generateRandomHash(bits = 32) {

function caseInsensitiveEqual(a, b) {
return (a === null || a === void 0 ? void 0 : a.toLowerCase()) === (b === null || b === void 0 ? void 0 : b.toLowerCase());
return a?.toLowerCase() === b?.toLowerCase();
}
exports.caseInsensitiveEqual = caseInsensitiveEqual;
/**
* Locale compare two strings. a.localeCompare(b)
* @param a string
* @param b string
* @returns number
*/
const localeCompare = (a, b) => a.localeCompare(b);
exports.localeCompare = localeCompare;
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