@chainflip/utils 0.1.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,42 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/string.ts
21
+ var string_exports = {};
22
+ __export(string_exports, {
23
+ capitalize: () => capitalize,
24
+ split: () => split,
25
+ toLowerCase: () => toLowerCase,
26
+ toUpperCase: () => toUpperCase,
27
+ uncapitalize: () => uncapitalize
28
+ });
29
+ module.exports = __toCommonJS(string_exports);
30
+ var toUpperCase = (str) => str.toUpperCase();
31
+ var toLowerCase = (str) => str.toLowerCase();
32
+ var split = (str, delimiter) => str.split(delimiter);
33
+ var capitalize = (str) => `${str.charAt(0).toUpperCase()}${str.slice(1)}`;
34
+ var uncapitalize = (str) => `${str.charAt(0).toLowerCase()}${str.slice(1)}`;
35
+ // Annotate the CommonJS export names for ESM import in node:
36
+ 0 && (module.exports = {
37
+ capitalize,
38
+ split,
39
+ toLowerCase,
40
+ toUpperCase,
41
+ uncapitalize
42
+ });
@@ -0,0 +1,8 @@
1
+ declare const toUpperCase: <const T extends string>(str: T) => Uppercase<T>;
2
+ declare const toLowerCase: <const T extends string>(str: T) => Lowercase<T>;
3
+ type Split<T extends string, D extends string> = T extends `${infer L}${D}${infer R}` ? [L, ...Split<R, D>] : [T];
4
+ declare const split: <const T extends string, D extends string>(str: T, delimiter: D) => Split<T, D>;
5
+ declare const capitalize: <const T extends string>(str: T) => Capitalize<T>;
6
+ declare const uncapitalize: <const T extends string>(str: T) => Uncapitalize<T>;
7
+
8
+ export { capitalize, split, toLowerCase, toUpperCase, uncapitalize };
@@ -0,0 +1,8 @@
1
+ declare const toUpperCase: <const T extends string>(str: T) => Uppercase<T>;
2
+ declare const toLowerCase: <const T extends string>(str: T) => Lowercase<T>;
3
+ type Split<T extends string, D extends string> = T extends `${infer L}${D}${infer R}` ? [L, ...Split<R, D>] : [T];
4
+ declare const split: <const T extends string, D extends string>(str: T, delimiter: D) => Split<T, D>;
5
+ declare const capitalize: <const T extends string>(str: T) => Capitalize<T>;
6
+ declare const uncapitalize: <const T extends string>(str: T) => Uncapitalize<T>;
7
+
8
+ export { capitalize, split, toLowerCase, toUpperCase, uncapitalize };
package/dist/string.js ADDED
@@ -0,0 +1,13 @@
1
+ // src/string.ts
2
+ var toUpperCase = (str) => str.toUpperCase();
3
+ var toLowerCase = (str) => str.toLowerCase();
4
+ var split = (str, delimiter) => str.split(delimiter);
5
+ var capitalize = (str) => `${str.charAt(0).toUpperCase()}${str.slice(1)}`;
6
+ var uncapitalize = (str) => `${str.charAt(0).toLowerCase()}${str.slice(1)}`;
7
+ export {
8
+ capitalize,
9
+ split,
10
+ toLowerCase,
11
+ toUpperCase,
12
+ uncapitalize
13
+ };
package/dist/types.cjs ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/types.ts
17
+ var types_exports = {};
18
+ module.exports = __toCommonJS(types_exports);
@@ -0,0 +1,3 @@
1
+ type HexString = `0x${string}`;
2
+
3
+ export type { HexString };
@@ -0,0 +1,3 @@
1
+ type HexString = `0x${string}`;
2
+
3
+ export type { HexString };
package/dist/types.js ADDED
File without changes
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@chainflip/utils",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "files": [
6
+ "dist",
7
+ "README.md"
8
+ ],
9
+ "exports": {
10
+ "./*": {
11
+ "require": {
12
+ "default": "./dist/*.cjs",
13
+ "types": "./dist/*.d.cts"
14
+ },
15
+ "import": {
16
+ "default": "./dist/*.js",
17
+ "types": "./dist/*.d.ts"
18
+ }
19
+ }
20
+ },
21
+ "devDependencies": {
22
+ "@noble/hashes": "^1.4.0"
23
+ },
24
+ "scripts": {
25
+ "clean": "rm -rf dist",
26
+ "prepublish": "pnpm test run && pnpm build:clean",
27
+ "build": "tsup",
28
+ "build:clean": "pnpm clean && pnpm build",
29
+ "test": "vitest",
30
+ "coverage": "vitest run --coverage"
31
+ }
32
+ }