1
1
require ( 'dotenv' ) . config ( )
2
- const { URLSearchParams } = require ( 'url' ) ;
2
+ const { URLSearchParams } = require ( 'url' )
3
3
const fetch = require ( 'node-fetch' )
4
4
const parseHtml = require ( 'node-html-parser' ) . parse
5
5
const frontMatter = require ( 'front-matter' )
6
6
7
7
const {
8
8
TRELLO_API_KEY : key ,
9
9
TRELLO_API_TOKEN : token ,
10
- TRELLO_LIST_ID_NEW_CARD_TO_BE_APPENDED : list_id_tweet ,
11
- TRELLO_LIST_ID_IOS : list_id_ios ,
10
+ TRELLO_LIST_ID_NEW_CARD_TO_BE_APPENDED : listIdTweet ,
11
+ TRELLO_listIdIos : listIdIos ,
12
12
TWEET_TO_TRELLO_SECRET : correctAppSecret
13
13
} = process . env
14
14
15
15
module . exports . isValidSecret = appSecret => {
16
- if ( appSecret !== correctAppSecret ) return false
16
+ if ( appSecret !== correctAppSecret ) return false
17
17
return true
18
18
}
19
19
@@ -44,9 +44,9 @@ ${a[2]}`
44
44
45
45
module . exports . createParams = ( { desc, urlSource, fromTweet, fromIos } ) => {
46
46
const params = new URLSearchParams ( )
47
- const list_id = fromTweet ? list_id_tweet : list_id_ios
47
+ const listId = fromTweet ? listIdTweet : listIdIos
48
48
params . append ( 'pos' , 'top' )
49
- params . append ( 'idList' , list_id )
49
+ params . append ( 'idList' , listId )
50
50
params . append ( 'key' , key )
51
51
params . append ( 'token' , token )
52
52
params . append ( 'desc' , desc )
@@ -68,7 +68,7 @@ module.exports.createFormattedTextFromHtml = html => {
68
68
script : false ,
69
69
style : false ,
70
70
pre : true ,
71
- comment : false ,
71
+ comment : false
72
72
}
73
73
// parsed should be a formatted DOM element that node-html-parser generates
74
74
const parsed = parseHtml ( html , options )
@@ -79,8 +79,8 @@ module.exports.createFormattedTextFromHtml = html => {
79
79
}
80
80
81
81
module . exports . combineText = ( tweetText , pageText ) => {
82
- let text ;
83
- if ( tweetText ) {
82
+ let text
83
+ if ( tweetText ) {
84
84
text = `${ tweetText } \n\n---\n\n${ pageText } `
85
85
} else {
86
86
text = pageText
@@ -89,9 +89,10 @@ module.exports.combineText = (tweetText, pageText) => {
89
89
}
90
90
91
91
module . exports . createTrelloCard = async params => {
92
- return await fetch ( 'https://api.trello.com/1/cards' , {
92
+ const response = await fetch ( 'https://api.trello.com/1/cards' , {
93
93
method : 'post' ,
94
94
headers : { Accept : 'application/json' } ,
95
95
body : params
96
96
} )
97
+ return response
97
98
}
0 commit comments