@sqlrooms/utils 0.7.0 → 0.8.1
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.
- package/dist/helpers.d.ts.map +1 -1
- package/dist/str.d.ts +8 -0
- package/dist/str.d.ts.map +1 -1
- package/dist/str.js +10 -0
- package/dist/str.js.map +1 -1
- package/dist/xhr.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/helpers.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAEA,OAAc,EAAC,UAAU,EAAC,MAAM,OAAO,CAAC;AAKxC;;GAEG;AACH,eAAO,MAAM,aAAa,mBAExB,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../src/helpers.ts"],"names":[],"mappings":"AAEA,OAAc,EAAC,UAAU,EAAC,MAAM,OAAO,CAAC;AAKxC;;GAEG;AACH,eAAO,MAAM,aAAa,mBAExB,CAAC;AAEH;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,GAAI,GAAG,MAAM,WAA4B,CAAC;AAMnE;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,GAAI,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,WAGvD,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,GAAI,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,WAGnD,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,GAAI,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,WAGxD,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,GAAI,GAAG,UAAU,WAE/C,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,GAAI,GAAG,OAAO,WAKnD,CAAC"}
|
package/dist/str.d.ts
CHANGED
|
@@ -16,4 +16,12 @@ export declare function formatBytes(bytes: number): string;
|
|
|
16
16
|
* camelCaseToTitle("URL") // returns "URL"
|
|
17
17
|
*/
|
|
18
18
|
export declare function camelCaseToTitle(camelCase: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Capitalizes the first letter of string
|
|
21
|
+
* @param str - The string to capitalize
|
|
22
|
+
* @returns A new string with the first letter capitalized
|
|
23
|
+
* @example
|
|
24
|
+
* capitalize("hello world") // returns "Hello world"
|
|
25
|
+
*/
|
|
26
|
+
export declare function capitalize(str: string): string;
|
|
19
27
|
//# sourceMappingURL=str.d.ts.map
|
package/dist/str.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"str.d.ts","sourceRoot":"","sources":["../src/str.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAgBjD;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAgB1D"}
|
|
1
|
+
{"version":3,"file":"str.d.ts","sourceRoot":"","sources":["../src/str.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAgBjD;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAgB1D;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE9C"}
|
package/dist/str.js
CHANGED
|
@@ -43,4 +43,14 @@ export function camelCaseToTitle(camelCase) {
|
|
|
43
43
|
// If no words were found, just capitalize the whole string
|
|
44
44
|
return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);
|
|
45
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* Capitalizes the first letter of string
|
|
48
|
+
* @param str - The string to capitalize
|
|
49
|
+
* @returns A new string with the first letter capitalized
|
|
50
|
+
* @example
|
|
51
|
+
* capitalize("hello world") // returns "Hello world"
|
|
52
|
+
*/
|
|
53
|
+
export function capitalize(str) {
|
|
54
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
55
|
+
}
|
|
46
56
|
//# sourceMappingURL=str.js.map
|
package/dist/str.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"str.js","sourceRoot":"","sources":["../src/str.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAElC,MAAM,CAAC,GAAG,IAAI,CAAC;IACf,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAExE,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAEpD,IAAI,SAAS,GAAG,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACvC,+EAA+E;IAC/E,SAAS;QACP,SAAS,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;YAChC,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YAClC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAE5B,OAAO,SAAS,GAAG,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AACpC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,SAAiB;IAChD,0DAA0D;IAC1D,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAEtD,kEAAkE;IAClE,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,KAAK;aACT,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YACZ,2CAA2C;YAC3C,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;QACpE,CAAC,CAAC;aACD,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,4BAA4B;IAC5C,CAAC;IAED,2DAA2D;IAC3D,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAChE,CAAC","sourcesContent":["/**\n * Formats a number of bytes into a human-readable string with appropriate size units.\n * @param bytes - The number of bytes to format\n * @returns A string representation of the bytes with appropriate unit (Bytes, KB, MB, etc.)\n * @example\n * formatBytes(1024) // returns \"1 KB\"\n * formatBytes(1234567) // returns \"1.18 MB\"\n */\nexport function formatBytes(bytes: number): string {\n if (bytes === 0) return '0 Bytes';\n\n const k = 1024;\n const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n\n let sizeValue = bytes / Math.pow(k, i);\n // Use floor to check if there's a non-zero fractional part, format accordingly\n sizeValue =\n sizeValue != Math.floor(sizeValue)\n ? parseFloat(sizeValue.toFixed(2))\n : Math.floor(sizeValue);\n\n return sizeValue + ' ' + sizes[i];\n}\n\n/**\n * Converts a camelCase string into a Title Case string.\n * @param camelCase - The camelCase string to convert\n * @returns A Title Case string with spaces between words\n * @example\n * camelCaseToTitle(\"myVariableName\") // returns \"My Variable Name\"\n * camelCaseToTitle(\"URL\") // returns \"URL\"\n */\nexport function camelCaseToTitle(camelCase: string): string {\n // Split the string into words on the camelCase boundaries\n const words = camelCase.match(/^[a-z]+|[A-Z][a-z]*/g);\n\n // If words are found, transform them and join into a title string\n if (words) {\n return words\n .map((word) => {\n // Capitalize the first letter of each word\n return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();\n })\n .join(' '); // Join the words with space\n }\n\n // If no words were found, just capitalize the whole string\n return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"str.js","sourceRoot":"","sources":["../src/str.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAElC,MAAM,CAAC,GAAG,IAAI,CAAC;IACf,MAAM,KAAK,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAExE,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAEpD,IAAI,SAAS,GAAG,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACvC,+EAA+E;IAC/E,SAAS;QACP,SAAS,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;YAChC,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YAClC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAE5B,OAAO,SAAS,GAAG,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AACpC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,SAAiB;IAChD,0DAA0D;IAC1D,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,sBAAsB,CAAC,CAAC;IAEtD,kEAAkE;IAClE,IAAI,KAAK,EAAE,CAAC;QACV,OAAO,KAAK;aACT,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YACZ,2CAA2C;YAC3C,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;QACpE,CAAC,CAAC;aACD,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,4BAA4B;IAC5C,CAAC;IAED,2DAA2D;IAC3D,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAChE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC","sourcesContent":["/**\n * Formats a number of bytes into a human-readable string with appropriate size units.\n * @param bytes - The number of bytes to format\n * @returns A string representation of the bytes with appropriate unit (Bytes, KB, MB, etc.)\n * @example\n * formatBytes(1024) // returns \"1 KB\"\n * formatBytes(1234567) // returns \"1.18 MB\"\n */\nexport function formatBytes(bytes: number): string {\n if (bytes === 0) return '0 Bytes';\n\n const k = 1024;\n const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];\n\n const i = Math.floor(Math.log(bytes) / Math.log(k));\n\n let sizeValue = bytes / Math.pow(k, i);\n // Use floor to check if there's a non-zero fractional part, format accordingly\n sizeValue =\n sizeValue != Math.floor(sizeValue)\n ? parseFloat(sizeValue.toFixed(2))\n : Math.floor(sizeValue);\n\n return sizeValue + ' ' + sizes[i];\n}\n\n/**\n * Converts a camelCase string into a Title Case string.\n * @param camelCase - The camelCase string to convert\n * @returns A Title Case string with spaces between words\n * @example\n * camelCaseToTitle(\"myVariableName\") // returns \"My Variable Name\"\n * camelCaseToTitle(\"URL\") // returns \"URL\"\n */\nexport function camelCaseToTitle(camelCase: string): string {\n // Split the string into words on the camelCase boundaries\n const words = camelCase.match(/^[a-z]+|[A-Z][a-z]*/g);\n\n // If words are found, transform them and join into a title string\n if (words) {\n return words\n .map((word) => {\n // Capitalize the first letter of each word\n return word.charAt(0).toUpperCase() + word.slice(1).toLowerCase();\n })\n .join(' '); // Join the words with space\n }\n\n // If no words were found, just capitalize the whole string\n return camelCase.charAt(0).toUpperCase() + camelCase.slice(1);\n}\n\n/**\n * Capitalizes the first letter of string\n * @param str - The string to capitalize\n * @returns A new string with the first letter capitalized\n * @example\n * capitalize(\"hello world\") // returns \"Hello world\"\n */\nexport function capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.slice(1);\n}\n"]}
|
package/dist/xhr.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xhr.d.ts","sourceRoot":"","sources":["../src/xhr.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"xhr.d.ts","sourceRoot":"","sources":["../src/xhr.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,GAAU,gBAG5B;IACD,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,iBAoBA,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,CAAC;AAK1E;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAChC,GAAG,EAAE,MAAM,EACX,IAAI,GAAE;IACJ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;CACtC,GACL,OAAO,CAAC,UAAU,CAAC,CAsCrB;AAID;;;;;;;;;;GAUG;AACH,wBAAsB,UAAU,CAC9B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,IAAI,GAAG,IAAI,GAAG,QAAQ,EAC/B,IAAI,GAAE;IACJ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,IAAI,CAAC;CACtC,GACL,OAAO,CAAC,QAAQ,CAAC,CAiCnB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sqlrooms/utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"react": "^19.0.0",
|
|
42
42
|
"usehooks-ts": "^3.1.1"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "7b5e727b79d675c17b93412c109d1ba1b22699c8"
|
|
45
45
|
}
|