@pistachiojs/core 0.1.0-dev.3 → 0.1.0-dev.5

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/index.d.ts CHANGED
@@ -1,3 +1,21 @@
1
+ /**
2
+ * Extracts a section of a string between two indices.
3
+ * @param value - String value to slice.
4
+ * @param start - Start index extraction.
5
+ * @param end - End index extraction.
6
+ * @returns String value extracted.
7
+ */
8
+ declare function slice(value: string, start: number, end?: number): string;
9
+
10
+ /**
11
+ * Splits a string into an array of substrings using a separator pattern.
12
+ * @param value - String value to split.
13
+ * @param separator - Separator to split.
14
+ * @param limit - Limit on number of splits.
15
+ * @returns Array value of substrings.
16
+ */
17
+ declare function split(value: string, separator: string | RegExp, limit?: number): string[];
18
+
1
19
  /**
2
20
  * Converts a string to camel case.
3
21
  * @param value - String value to camel case.
@@ -40,4 +58,41 @@ declare function toPascalCase(value: string): string;
40
58
  */
41
59
  declare function toSentenceCase(value: string): string;
42
60
 
43
- export { toCamelCase, toCapitalize, toKebabCase, toLowerCase, toPascalCase, toSentenceCase };
61
+ /**
62
+ * Converts a string to a URL-friendly slug.
63
+ * @param value - String value to slug.
64
+ * @returns String value slug.
65
+ */
66
+ declare function toSlug(value: string): string;
67
+
68
+ /**
69
+ * Converts a string to snake case.
70
+ * @param value - String value to snake case.
71
+ * @returns String value snake case.
72
+ */
73
+ declare function toSnakeCase(value: string): string;
74
+
75
+ /**
76
+ * Converts a string to title case.
77
+ * @param value - String value to title case.
78
+ * @returns String value title case.
79
+ */
80
+ declare function toTitleCase(value: string): string;
81
+
82
+ /**
83
+ * Converts a string to upper case.
84
+ * @param value - String value to upper case.
85
+ * @returns String value upper case.
86
+ */
87
+ declare function toUpperCase(value: string): string;
88
+
89
+ /**
90
+ * Truncates a string to a specified length and adds an optional suffix.
91
+ * @param value - String value to truncate.
92
+ * @param length - Maximum length of string.
93
+ * @param suffix - Suffix to append.
94
+ * @returns String value truncated.
95
+ */
96
+ declare function truncate(value: string, length: number, suffix?: string): string;
97
+
98
+ export { slice, split, toCamelCase, toCapitalize, toKebabCase, toLowerCase, toPascalCase, toSentenceCase, toSlug, toSnakeCase, toTitleCase, toUpperCase, truncate };
package/dist/index.esm.js CHANGED
@@ -1 +1 @@
1
- function t(e){return e.length===0?e:e.replace(/[-_\s]+(.)?/g,(r,a)=>a?a.toUpperCase():"").replace(/^[A-Z]/,r=>r.toLowerCase())}function o(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}function n(e){return e.length===0?e:e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}function s(e){return e.toLowerCase()}function c(e){return e.length===0?e:e.replace(/[-_\s]+(.)?/g,(r,a)=>a?a.toUpperCase():"").replace(/^[a-z]/,r=>r.toUpperCase())}function p(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}export{t as toCamelCase,o as toCapitalize,n as toKebabCase,s as toLowerCase,c as toPascalCase,p as toSentenceCase};
1
+ function n(e,t,r){return e.slice(t,r)}function a(e,t,r){return e.split(t,r)}function o(e){return e.length===0?e:e.replace(/[-_\s]+(.)?/g,(t,r)=>r?r.toUpperCase():"").replace(/^[A-Z]/,t=>t.toLowerCase())}function s(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}function c(e){return e.length===0?e:e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}function l(e){return e.toLowerCase()}function p(e){return e.length===0?e:e.replace(/[-_\s]+(.)?/g,(t,r)=>r?r.toUpperCase():"").replace(/^[a-z]/,t=>t.toUpperCase())}function u(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function i(e){return e.length===0?e:e.toLowerCase().replace(/[^\w\s-]/g,"").replace(/[\s_]+/g,"-").replace(/^-+|-+$/g,"").replace(/-+/g,"-")}function C(e){return e.length===0?e:e.replace(/([a-z])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase()}function g(e){return e.length===0?e:e.toLowerCase().replace(/(?:^|\s|-|_)\w/g,t=>t.toUpperCase())}function f(e){return e.toUpperCase()}function h(e,t,r="..."){return e.length<=t?e:t-r.length<=0?r.slice(0,t):e.slice(0,t-r.length)+r}export{n as slice,a as split,o as toCamelCase,s as toCapitalize,c as toKebabCase,l as toLowerCase,p as toPascalCase,u as toSentenceCase,i as toSlug,C as toSnakeCase,g as toTitleCase,f as toUpperCase,h as truncate};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";function r(e){return e.length===0?e:e.replace(/[-_\s]+(.)?/g,(a,t)=>t?t.toUpperCase():"").replace(/^[A-Z]/,a=>a.toLowerCase())}function o(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}function s(e){return e.length===0?e:e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}function n(e){return e.toLowerCase()}function C(e){return e.length===0?e:e.replace(/[-_\s]+(.)?/g,(a,t)=>t?t.toUpperCase():"").replace(/^[a-z]/,a=>a.toUpperCase())}function c(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}exports.toCamelCase=r,exports.toCapitalize=o,exports.toKebabCase=s,exports.toLowerCase=n,exports.toPascalCase=C,exports.toSentenceCase=c;
1
+ "use strict";function r(e,t,a){return e.slice(t,a)}function o(e,t,a){return e.split(t,a)}function n(e){return e.length===0?e:e.replace(/[-_\s]+(.)?/g,(t,a)=>a?a.toUpperCase():"").replace(/^[A-Z]/,t=>t.toLowerCase())}function s(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1)}function l(e){return e.length===0?e:e.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}function c(e){return e.toLowerCase()}function p(e){return e.length===0?e:e.replace(/[-_\s]+(.)?/g,(t,a)=>a?a.toUpperCase():"").replace(/^[a-z]/,t=>t.toUpperCase())}function C(e){return e.length===0?e:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}function u(e){return e.length===0?e:e.toLowerCase().replace(/[^\w\s-]/g,"").replace(/[\s_]+/g,"-").replace(/^-+|-+$/g,"").replace(/-+/g,"-")}function i(e){return e.length===0?e:e.replace(/([a-z])([A-Z])/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase()}function g(e){return e.length===0?e:e.toLowerCase().replace(/(?:^|\s|-|_)\w/g,t=>t.toUpperCase())}function f(e){return e.toUpperCase()}function h(e,t,a="..."){return e.length<=t?e:t-a.length<=0?a.slice(0,t):e.slice(0,t-a.length)+a}exports.slice=r,exports.split=o,exports.toCamelCase=n,exports.toCapitalize=s,exports.toKebabCase=l,exports.toLowerCase=c,exports.toPascalCase=p,exports.toSentenceCase=C,exports.toSlug=u,exports.toSnakeCase=i,exports.toTitleCase=g,exports.toUpperCase=f,exports.truncate=h;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pistachiojs/core",
3
3
  "description": "-",
4
- "version": "0.1.0-dev.3",
4
+ "version": "0.1.0-dev.5",
5
5
  "author": "Dirga Prakesha <dirga.prakesha@gmail.com>",
6
6
  "license": "MIT",
7
7
  "sideEffects": false,
@@ -9,7 +9,9 @@
9
9
  "module": "dist/index.esm.js",
10
10
  "types": "dist/index.d.ts",
11
11
  "files": [
12
- "dist"
12
+ "dist/index.js",
13
+ "dist/index.esm.js",
14
+ "dist/index.d.ts"
13
15
  ],
14
16
  "scripts": {
15
17
  "build": "rollup -c ../../rollup.config.mjs --environment TARGET:core",
@@ -1 +0,0 @@
1
- export * from './strings';
@@ -1,6 +0,0 @@
1
- export * from './to-camel-case';
2
- export * from './to-capitalize';
3
- export * from './to-kebab-case';
4
- export * from './to-lower-case';
5
- export * from './to-pascal-case';
6
- export * from './to-sentence-case';
@@ -1,6 +0,0 @@
1
- /**
2
- * Converts a string to camel case.
3
- * @param value - String value to camel case.
4
- * @returns String value camel case.
5
- */
6
- export declare function toCamelCase(value: string): string;
@@ -1,6 +0,0 @@
1
- /**
2
- * Converts a string to capitalize.
3
- * @param value - Value string to capitalize.
4
- * @returns Value string capitalize.
5
- */
6
- export declare function toCapitalize(value: string): string;
@@ -1,6 +0,0 @@
1
- /**
2
- * Converts a string to kebab case.
3
- * @param value - String value to kebab case.
4
- * @returns String value kebab case.
5
- */
6
- export declare function toKebabCase(value: string): string;
@@ -1,6 +0,0 @@
1
- /**
2
- * Converts a string to lower case.
3
- * @param value - String value to lower case.
4
- * @returns String value lower case.
5
- */
6
- export declare function toLowerCase(value: string): string;
@@ -1,6 +0,0 @@
1
- /**
2
- * Converts a string to pascal case.
3
- * @param value - String value to pascal case.
4
- * @returns String value pascal case.
5
- */
6
- export declare function toPascalCase(value: string): string;
@@ -1,6 +0,0 @@
1
- /**
2
- * Converts a string to sentence case.
3
- * @param value - String value to sentence case.
4
- * @returns String value sentence case.
5
- */
6
- export declare function toSentenceCase(value: string): string;