@gearbox-protocol/cli-utils 5.33.0 → 5.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ export declare class CensoredString<V extends string = string> {
2
+ #private;
3
+ static transform<T extends string>(value: T): CensoredString<T>;
4
+ constructor(value: V);
5
+ get value(): V;
6
+ toString(): string;
7
+ toJSON(): string;
8
+ }
@@ -0,0 +1,27 @@
1
+ export class CensoredString {
2
+ #value;
3
+ #censored;
4
+ static transform(value) {
5
+ return new CensoredString(value);
6
+ }
7
+ constructor(value) {
8
+ this.#value = value;
9
+ let visibleLen = Math.floor(0.2 * value.length);
10
+ if (visibleLen < 1) {
11
+ this.#censored = "*".repeat(value.length);
12
+ }
13
+ else {
14
+ this.#censored =
15
+ "*".repeat(value.length - visibleLen) + value.slice(-1 * visibleLen);
16
+ }
17
+ }
18
+ get value() {
19
+ return this.#value;
20
+ }
21
+ toString() {
22
+ return this.#censored;
23
+ }
24
+ toJSON() {
25
+ return this.toString();
26
+ }
27
+ }
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from "./CensoredString.js";
1
2
  export * from "./resolveYamlFiles.js";
2
3
  export * from "./schema-primitives.js";
3
4
  export * from "./Zommand.js";
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ export * from "./CensoredString.js";
1
2
  export * from "./resolveYamlFiles.js";
2
3
  export * from "./schema-primitives.js";
3
4
  export * from "./Zommand.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/cli-utils",
3
3
  "description": "Utils for creating cli apps",
4
- "version": "5.33.0",
4
+ "version": "5.34.0",
5
5
  "homepage": "https://gearbox.fi",
6
6
  "keywords": [
7
7
  "gearbox"