jpf 5.0.77 → 5.0.78

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.
@@ -1 +1,2 @@
1
1
  export declare function join(separator?: string, ...strings: string[]): string;
2
+ export declare function toKebabCase(str: any): any;
@@ -1,8 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.join = join;
4
+ exports.toKebabCase = toKebabCase;
4
5
  function join(separator = ', ', ...strings) {
5
6
  return strings.join(separator);
6
7
  }
7
8
  ;
9
+ function toKebabCase(str) {
10
+ if (!str) {
11
+ return str;
12
+ }
13
+ return str.split('').map((letter, idx) => {
14
+ return letter.toUpperCase() === letter
15
+ ? `${idx !== 0 ? '-' : ''}${letter.toLowerCase()}`
16
+ : letter;
17
+ }).join('');
18
+ }
8
19
  //# sourceMappingURL=string.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"string.js","sourceRoot":"","sources":["../../../src/utilities/string/string.ts"],"names":[],"mappings":";;AAAA,oBAEC;AAFD,SAAgB,IAAI,CAAC,YAAoB,IAAI,EAAE,GAAG,OAAiB;IAC/D,OAAO,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AACnC,CAAC;AAAA,CAAC"}
1
+ {"version":3,"file":"string.js","sourceRoot":"","sources":["../../../src/utilities/string/string.ts"],"names":[],"mappings":";;AAAA,oBAEC;AAED,kCASC;AAbD,SAAgB,IAAI,CAAC,YAAoB,IAAI,EAAE,GAAG,OAAiB;IAC/D,OAAO,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AACnC,CAAC;AAAA,CAAC;AAEF,SAAgB,WAAW,CAAC,GAAG;IAC3B,IAAI,CAAC,GAAG,EAAE,CAAC;QACP,OAAO,GAAG,CAAC;IACf,CAAC;IACD,OAAO,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE;QACrC,OAAO,MAAM,CAAC,WAAW,EAAE,KAAK,MAAM;YAClC,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,CAAC,WAAW,EAAE,EAAE;YAClD,CAAC,CAAC,MAAM,CAAC;IACjB,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAChB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jpf",
3
- "version": "5.0.77",
3
+ "version": "5.0.78",
4
4
  "description": "Javascript Presentation Foundation base classes and interfaces",
5
5
  "keywords": [
6
6
  "mvvm",
@@ -1,3 +1,14 @@
1
1
  export function join(separator: string = ', ', ...strings: string[]): string {
2
2
  return strings.join(separator);
3
- };
3
+ };
4
+
5
+ export function toKebabCase(str) {
6
+ if (!str) {
7
+ return str;
8
+ }
9
+ return str.split('').map((letter, idx) => {
10
+ return letter.toUpperCase() === letter
11
+ ? `${idx !== 0 ? '-' : ''}${letter.toLowerCase()}`
12
+ : letter;
13
+ }).join('');
14
+ }