@tryghost/social-urls 0.1.42 → 0.1.44

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2013-2023 Ghost Foundation
3
+ Copyright (c) 2013-2025 Ghost Foundation
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -44,4 +44,4 @@ Follow the instructions for the top-level repo.
44
44
 
45
45
  # Copyright & License
46
46
 
47
- Copyright (c) 2013-2023 Ghost Foundation - Released under the [MIT license](LICENSE).
47
+ Copyright (c) 2013-2025 Ghost Foundation - Released under the [MIT license](LICENSE).
package/lib/index.js CHANGED
@@ -4,7 +4,7 @@
4
4
  */
5
5
  module.exports.twitter = function twitter(username) {
6
6
  // Creates the canonical twitter URL without the '@'
7
- return 'https://twitter.com/' + username.replace(/^@/, '');
7
+ return 'https://x.com/' + username.replace(/^@/, '');
8
8
  };
9
9
 
10
10
  /**
@@ -15,3 +15,68 @@ module.exports.facebook = function facebook(username) {
15
15
  // Handles a starting slash, this shouldn't happen, but just in case
16
16
  return 'https://www.facebook.com/' + username.replace(/^\//, '');
17
17
  };
18
+
19
+ /**
20
+ * @param {string} username
21
+ * @returns {string}
22
+ */
23
+ module.exports.threads = function threads(username) {
24
+ // a threads profile url is always prefixed with @
25
+ username = username.replace(/^@/, '');
26
+ return 'https://www.threads.net/@' + username;
27
+ };
28
+
29
+ /**
30
+ * @param {string} username
31
+ * @returns {string}
32
+ */
33
+ module.exports.bluesky = function bluesky(username) {
34
+ // Bluesky URLs use profile path, no @ in stored handle
35
+ return 'https://bsky.app/profile/' + username;
36
+ };
37
+
38
+ /**
39
+ * @param {string} username
40
+ * @returns {string}
41
+ */
42
+ module.exports.mastodon = function mastodon(username) {
43
+ // Mastodon stores full URL without https://, just prepend protocol
44
+ return 'https://' + username;
45
+ };
46
+
47
+ /**
48
+ * @param {string} username
49
+ * @returns {string}
50
+ */
51
+ module.exports.tiktok = function tiktok(username) {
52
+ // TikTok URLs include @, handles stored with or without @
53
+ username = username.startsWith('@') ? username : '@' + username;
54
+ return 'https://www.tiktok.com/' + username;
55
+ };
56
+
57
+ /**
58
+ * @param {string} username
59
+ * @returns {string}
60
+ */
61
+ module.exports.youtube = function youtube(username) {
62
+ // YouTube handles include @, user/, or channel/, stored as-is
63
+ return 'https://www.youtube.com/' + username;
64
+ };
65
+
66
+ /**
67
+ * @param {string} username
68
+ * @returns {string}
69
+ */
70
+ module.exports.instagram = function instagram(username) {
71
+ // Instagram URLs have no @, stored without @
72
+ return 'https://www.instagram.com/' + username;
73
+ };
74
+
75
+ /**
76
+ * @param {string} username
77
+ * @returns {string}
78
+ */
79
+ module.exports.linkedin = function linkedin(username) {
80
+ // LinkedIn URLs use /in/, stored without @
81
+ return 'https://www.linkedin.com/in/' + username;
82
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryghost/social-urls",
3
- "version": "0.1.42",
3
+ "version": "0.1.44",
4
4
  "repository": "https://github.com/TryGhost/SDK/tree/main/packages/social-urls",
5
5
  "author": "Ghost Foundation",
6
6
  "license": "MIT",
@@ -18,10 +18,10 @@
18
18
  "access": "public"
19
19
  },
20
20
  "devDependencies": {
21
- "c8": "8.0.1",
22
- "mocha": "10.2.0",
21
+ "c8": "10.1.3",
22
+ "mocha": "11.1.0",
23
23
  "should": "13.2.3",
24
- "sinon": "17.0.1"
24
+ "sinon": "20.0.0"
25
25
  },
26
- "gitHead": "4839d3f97de2120d98fa47677eed7591dfa20e64"
26
+ "gitHead": "19592ba6684cd896674e6bd1da92e3eb06e665f2"
27
27
  }