@mfdj/tsc-as-build-tool 0.4.1 → 1.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.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- export declare class StringToLowercase {
2
- static ToLower(stringName: string): string;
1
+ export declare class CaseChanger {
2
+ static ToLower(input: string): string;
3
+ static toLowercase(input: string): string;
3
4
  }
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qBAAa,iBAAiB;IAE5B,MAAM,CAAC,OAAO,CAAC,UAAU,EAAC,MAAM;CAejC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,qBAAa,WAAW;IAEtB,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM;IAI5B,MAAM,CAAC,WAAW,CAAC,KAAK,EAAE,MAAM;CAGjC"}
package/dist/index.js CHANGED
@@ -1,15 +1,10 @@
1
- export class StringToLowercase {
2
- static ToLower(stringName) {
3
- let lower = "";
4
- for (let i = 0; i < stringName.length; i++) {
5
- let value = stringName.charCodeAt(i);
6
- if (value >= 65 && value <= 90) {
7
- lower += String.fromCharCode(value + 32);
8
- }
9
- else {
10
- lower += stringName[i];
11
- }
12
- }
13
- return lower;
1
+ import { toLowercase } from "./utils/toLowercase.js";
2
+ export class CaseChanger {
3
+ // @deprecated in favor of toLowercase
4
+ static ToLower(input) {
5
+ return toLowercase(input);
6
+ }
7
+ static toLowercase(input) {
8
+ return toLowercase(input);
14
9
  }
15
10
  }
@@ -0,0 +1,2 @@
1
+ export declare function toLowercase(input: string): string;
2
+ //# sourceMappingURL=toLowercase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toLowercase.d.ts","sourceRoot":"","sources":["../../src/utils/toLowercase.ts"],"names":[],"mappings":"AAGA,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,UAyBxC"}
@@ -0,0 +1,24 @@
1
+ /*
2
+ Crude version that handles basic latin alphabet.
3
+ */
4
+ export function toLowercase(input) {
5
+ let output = "";
6
+ for (let i = 0; i < input.length; i++) {
7
+ let charCode = input.charCodeAt(i);
8
+ let char = input.charAt(i);
9
+ if (charCode >= 65 && charCode <= 90) {
10
+ let newChar = String.fromCharCode(charCode + 32);
11
+ // console.log(
12
+ // `uppercase: ${i} ${char} ${charCode} newCharCode ${
13
+ // charCode + 32
14
+ // } newChar: ${newChar}`
15
+ // );
16
+ output += newChar;
17
+ }
18
+ else {
19
+ // console.log(`already lowercase: ${i} ${char} ${charCode}`);
20
+ output += input[i];
21
+ }
22
+ }
23
+ return output;
24
+ }
package/package.json CHANGED
@@ -8,6 +8,6 @@
8
8
  "build": "rm -rf dist/*; tsc",
9
9
  "prepare": "npm run build"
10
10
  },
11
- "version": "0.4.1",
11
+ "version": "1.1.0",
12
12
  "type": "module"
13
13
  }
package/src/index.ts CHANGED
@@ -1,18 +1,12 @@
1
- export class StringToLowercase
2
- {
3
- static ToLower(stringName:string) {
4
- let lower = "";
1
+ import { toLowercase } from "./utils/toLowercase.js";
5
2
 
6
- for (let i = 0; i < stringName.length; i++) {
7
- let value = stringName.charCodeAt(i);
8
-
9
- if (value >= 65 && value <= 90) {
10
- lower += String.fromCharCode(value + 32);
11
- } else {
12
- lower += stringName[i];
13
- }
14
- }
3
+ export class CaseChanger {
4
+ // @deprecated in favor of toLowercase
5
+ static ToLower(input: string) {
6
+ return toLowercase(input);
7
+ }
15
8
 
16
- return lower;
9
+ static toLowercase(input: string) {
10
+ return toLowercase(input);
17
11
  }
18
12
  }
@@ -0,0 +1,29 @@
1
+ /*
2
+ Crude version that handles basic latin alphabet.
3
+ */
4
+ export function toLowercase(input: string) {
5
+ let output = "";
6
+
7
+ for (let i = 0; i < input.length; i++) {
8
+ let charCode = input.charCodeAt(i);
9
+ let char = input.charAt(i);
10
+
11
+ if (charCode >= 65 && charCode <= 90) {
12
+ let newChar = String.fromCharCode(charCode + 32);
13
+
14
+ // console.log(
15
+ // `uppercase: ${i} ${char} ${charCode} newCharCode ${
16
+ // charCode + 32
17
+ // } newChar: ${newChar}`
18
+ // );
19
+
20
+ output += newChar;
21
+ } else {
22
+ // console.log(`already lowercase: ${i} ${char} ${charCode}`);
23
+
24
+ output += input[i];
25
+ }
26
+ }
27
+
28
+ return output;
29
+ }