@coong/utils
Advanced tools
| export declare const shortenAddress: (address: string) => string; | ||
| export declare const trimOffUrlProtocol: (url: string) => string; | ||
| export declare const trimTrailingSlash: (input: string) => string; |
+16
| export const shortenAddress = (address) => { | ||
| if (!address) { | ||
| return ''; | ||
| } | ||
| const length = address.length; | ||
| if (length <= 15) { | ||
| return address; | ||
| } | ||
| return `${address.substring(0, 6)}...${address.substring(length - 6, length)}`; | ||
| }; | ||
| export const trimOffUrlProtocol = (url) => { | ||
| return url.replace(/https?:\/\//, ''); | ||
| }; | ||
| export const trimTrailingSlash = (input) => { | ||
| return input.endsWith('/') ? trimTrailingSlash(input.slice(0, -1)) : input; | ||
| }; |
+1
-1
@@ -10,3 +10,3 @@ import { CoongError, ErrorCode, ErrorCodes } from './errors'; | ||
| else { | ||
| throw new CoongError(ErrorCode.UnknownRequest, message); | ||
| throw new CoongError(ErrorCode.InternalError, message); | ||
| } | ||
@@ -13,0 +13,0 @@ } |
+3
-1
@@ -15,3 +15,5 @@ export declare enum ErrorCode { | ||
| AccountNameUsed = "AccountNameUsed", | ||
| InvalidMnemonic = "InvalidMnemonic" | ||
| InvalidMnemonic = "InvalidMnemonic", | ||
| AccountExisted = "AccountExisted", | ||
| OriginalHashNotFound = "OriginalHashNotFound" | ||
| } | ||
@@ -18,0 +20,0 @@ export declare const ErrorCodes: string[]; |
+2
-0
@@ -17,2 +17,4 @@ export var ErrorCode; | ||
| ErrorCode["InvalidMnemonic"] = "InvalidMnemonic"; | ||
| ErrorCode["AccountExisted"] = "AccountExisted"; | ||
| ErrorCode["OriginalHashNotFound"] = "OriginalHashNotFound"; | ||
| })(ErrorCode || (ErrorCode = {})); | ||
@@ -19,0 +21,0 @@ export const ErrorCodes = Object.values(ErrorCode); |
+1
-0
| export * from './errors'; | ||
| export * from './assert'; | ||
| export * from './string'; |
+1
-0
| export * from './errors'; | ||
| export * from './assert'; | ||
| export * from './string'; |
+3
-3
| { | ||
| "name": "@coong/utils", | ||
| "version": "0.0.21-alpha.6+8b76262", | ||
| "description": "Utilities for Coong wallet", | ||
| "version": "0.0.21-alpha.23+e4e176c", | ||
| "description": "Utilities for Coong Wallet", | ||
| "author": "Thang X. Vu <thang@coongwallet.io>", | ||
@@ -23,3 +23,3 @@ "homepage": "https://github.com/CoongCrafts/coong-wallet/tree/main/packages/utils#readme", | ||
| "license": "Apache-2.0", | ||
| "gitHead": "8b7626225c70a206e62ebb5c152d7078dd399b64" | ||
| "gitHead": "e4e176cf945034765e2956723380d48ca1a46e35" | ||
| } |
+1
-1
| // THIS FILE IS AUTO-GENERATED, DO NOT EDIT! | ||
| export const packageInfo = { name: '@coong/utils', version: '0.0.21-alpha.0' }; | ||
| export const packageInfo = { name: '@coong/utils', version: '0.0.21' }; |
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
17001
5.82%13
18.18%136
22.52%