@vgabriel45/demo-sdk 1.1.0 → 1.3.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/index.js +36 -2
- package/package.json +6 -1
package/index.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
/** Sandbox SDK — used to test the release pipeline. */
|
|
2
2
|
export function greet(name = "world", { style = "default" } = {}) {
|
|
3
|
-
const
|
|
3
|
+
const trimmed = String(name ?? "").trim();
|
|
4
|
+
const message = `Hello, ${trimmed === "" ? "world" : trimmed}!`;
|
|
4
5
|
if (style === "upper") return message.toUpperCase();
|
|
5
6
|
if (style === "lower") return message.toLowerCase();
|
|
6
7
|
return message;
|
|
7
8
|
}
|
|
8
9
|
|
|
9
10
|
export function farewell(name = "world") {
|
|
10
|
-
|
|
11
|
+
const trimmed = String(name ?? "").trim();
|
|
12
|
+
return `Goodbye, ${trimmed === "" ? "world" : trimmed}!`;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
/** Returns a short celebration string for release testing. */
|
|
@@ -19,3 +21,35 @@ export function celebrate(event = "release") {
|
|
|
19
21
|
export function greetEmoji(name = "world", emoji = "👋", options = {}) {
|
|
20
22
|
return `${emoji} ${greet(name, options)}`;
|
|
21
23
|
}
|
|
24
|
+
|
|
25
|
+
/** Greet several people at once, joined with a separator. */
|
|
26
|
+
export function greetMany(names = [], { separator = " ", ...options } = {}) {
|
|
27
|
+
return names
|
|
28
|
+
.filter((name) => name != null && String(name).trim() !== "")
|
|
29
|
+
.map((name) => greet(name, options))
|
|
30
|
+
.join(separator);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Greet two people with an "and" joiner. */
|
|
34
|
+
export function greetPair(first = "world", second = "world", options = {}) {
|
|
35
|
+
return `${greet(first, options)} and ${greet(second, options)}`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Title-case a display name for UI labels. */
|
|
39
|
+
export function formatName(name = "") {
|
|
40
|
+
return String(name ?? "")
|
|
41
|
+
.trim()
|
|
42
|
+
.split(/\s+/)
|
|
43
|
+
.filter(Boolean)
|
|
44
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())
|
|
45
|
+
.join(" ");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Initials from a display name, e.g. "jane doe" -> "JD". */
|
|
49
|
+
export function formatInitials(name = "") {
|
|
50
|
+
return formatName(name)
|
|
51
|
+
.split(/\s+/)
|
|
52
|
+
.filter(Boolean)
|
|
53
|
+
.map((word) => word.charAt(0))
|
|
54
|
+
.join("");
|
|
55
|
+
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vgabriel45/demo-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Minimal publishable package for release pipeline sandbox testing",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"files": [
|
|
8
8
|
"index.js"
|
|
9
9
|
],
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/VGabriel45/trails-release-pipeline-sandbox",
|
|
13
|
+
"directory": "packages/demo-sdk"
|
|
14
|
+
},
|
|
10
15
|
"publishConfig": {
|
|
11
16
|
"access": "public"
|
|
12
17
|
}
|