proto-toolkit 1.0.0 → 1.0.2

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/README.md CHANGED
@@ -0,0 +1,112 @@
1
+ # proto-toolkit
2
+
3
+ Lightweight JavaScript utility library that extends native prototypes with useful helper methods.
4
+
5
+ ---
6
+
7
+ Version: 1.0.1
8
+ npm: https://www.npmjs.com/package/proto-toolkit
9
+
10
+ Currently focused on String utilities. More features coming soon.
11
+
12
+ ## Installation
13
+
14
+ ### Using npm
15
+
16
+ ```bash
17
+ npm install proto-toolkit
18
+ ```
19
+
20
+ ### Using CDN
21
+
22
+ ```html
23
+ <script src="https://cdn.jsdelivr.net/npm/proto-toolkit/dist/proto-toolkit.umd.js"></script>
24
+ ```
25
+
26
+ ---
27
+
28
+ ## Usage
29
+
30
+ ### ES Module
31
+
32
+ Import the package once in your project:
33
+
34
+ ```javascript
35
+ import 'proto-toolkit';
36
+ ```
37
+
38
+ After importing, you can directly use the added methods on strings.
39
+
40
+ ---
41
+
42
+ ### Browser (CDN)
43
+
44
+ Include the script tag before your custom script:
45
+
46
+ ```html
47
+ <script src="https://cdn.jsdelivr.net/npm/proto-toolkit/dist/proto-toolkit.umd.min.js"></script>
48
+ <script>
49
+ let name = 'Kousik Chowdhury';
50
+ console.log(name.mask());
51
+ </script>
52
+ ```
53
+
54
+ ---
55
+
56
+ ## Available Methods
57
+
58
+ - `mask()`
59
+ - `toAbbreviatedName()`
60
+
61
+ ---
62
+
63
+ ## 1. mask()
64
+
65
+ Masks part of a string. Useful for hiding sensitive text like usernames.
66
+
67
+ ### Example
68
+
69
+ ```javascript
70
+ import 'proto-toolkit';
71
+
72
+ let name = 'Kousik Chowdhury';
73
+ console.log(name.mask());
74
+ ```
75
+
76
+ ### Output
77
+
78
+ ```
79
+ Ko************ry
80
+ ```
81
+
82
+ ---
83
+
84
+ ## 2. toAbbreviatedName()
85
+
86
+ Converts a full name into abbreviated format.
87
+
88
+ ### Example
89
+
90
+ ```javascript
91
+ import 'proto-toolkit';
92
+
93
+ let name = 'Kousik Chowdhury';
94
+ console.log(name.toAbbreviatedName());
95
+ ```
96
+
97
+ ### Output
98
+
99
+ ```javascript
100
+ K.Chowdhury;
101
+ ```
102
+
103
+ ## Links
104
+
105
+ **Twitter / X**
106
+ https://x.com/csakoushik
107
+
108
+ **Website**
109
+ https://kousikchowdhury.in
110
+
111
+ **Proto-Toolkit Docs**
112
+ https://proto-toolkit.kousikchowdhury.in
@@ -0,0 +1 @@
1
+ !function(t){"function"==typeof define&&define.amd?define(t):t()}(function(){"use strict";function t(t){return t[0].toUpperCase()+t.slice(1).toLowerCase()}String.prototype.mask||(String.prototype.mask=function(){const t=this.trim();if(t.length<=4)return t;const e=t.slice(0,2),n=t.slice(-2),r=t.length-4;return e+"*".repeat(r)+n}),String.prototype.toAbbreviatedName||(String.prototype.toAbbreviatedName=function(){if("string"!=typeof this)throw new TypeError("Input must be a string");const e=this.trim().split(/\s+/).filter(Boolean);if(0===e.length)return"";if(1===e.length)return t(e[0]);const n=e.pop();return`${e.map(t=>t[0].toUpperCase()+".").join(" ")} ${t(n)}`})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "proto-toolkit",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "A lightweight JavaScript utility toolkit",
5
5
  "type": "module",
6
6
  "main": "dist/proto-toolkit.cjs.js",
@@ -21,6 +21,7 @@
21
21
  "author": "Kousik Chowdhury",
22
22
  "license": "MIT",
23
23
  "devDependencies": {
24
+ "@rollup/plugin-terser": "^0.4.4",
24
25
  "rollup": "^4.59.0"
25
26
  }
26
- }
27
+ }