@tryghost/social-urls 0.1.38 → 0.1.40
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 +8 -0
- package/lib/index.js +8 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -11,6 +11,14 @@ or
|
|
|
11
11
|
|
|
12
12
|
## Usage
|
|
13
13
|
|
|
14
|
+
```js
|
|
15
|
+
const {twitter: makeTwitter, facebook: makeFacebook} = require('@tryghost/social-urls');
|
|
16
|
+
|
|
17
|
+
const socialUrls = [
|
|
18
|
+
makeTwitter('@ghost'), // https://twitter.com/ghost
|
|
19
|
+
makeFacebook('/ghost') // https://facebook.com/ghost
|
|
20
|
+
];
|
|
21
|
+
```
|
|
14
22
|
|
|
15
23
|
## Develop
|
|
16
24
|
|
package/lib/index.js
CHANGED
|
@@ -1,8 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @param {string} username
|
|
3
|
+
* @returns {string}
|
|
4
|
+
*/
|
|
1
5
|
module.exports.twitter = function twitter(username) {
|
|
2
6
|
// Creates the canonical twitter URL without the '@'
|
|
3
7
|
return 'https://twitter.com/' + username.replace(/^@/, '');
|
|
4
8
|
};
|
|
5
9
|
|
|
10
|
+
/**
|
|
11
|
+
* @param {string} username
|
|
12
|
+
* @returns {string}
|
|
13
|
+
*/
|
|
6
14
|
module.exports.facebook = function facebook(username) {
|
|
7
15
|
// Handles a starting slash, this shouldn't happen, but just in case
|
|
8
16
|
return 'https://www.facebook.com/' + username.replace(/^\//, '');
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tryghost/social-urls",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"repository": "https://github.com/TryGhost/SDK/tree/
|
|
3
|
+
"version": "0.1.40",
|
|
4
|
+
"repository": "https://github.com/TryGhost/SDK/tree/main/packages/social-urls",
|
|
5
5
|
"author": "Ghost Foundation",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"main": "lib/index.js",
|
|
@@ -23,5 +23,5 @@
|
|
|
23
23
|
"should": "13.2.3",
|
|
24
24
|
"sinon": "15.0.4"
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "9aab58d76232aa8487afaa4006db14816094671d"
|
|
27
27
|
}
|