Skip to content

Commit fe80a68

Browse files
James TsaiJames Tsai
authored andcommitted
refactor: change arrow function of inner class method into regular funcion
1 parent 3fbb770 commit fe80a68

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

nodejs/.eslintrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ module.exports = {
1111
"semi": ["warn", "never"],
1212
"@typescript-eslint/no-non-null-assertion": "off",
1313
"keyword-spacing": ["warn", {"before": true, "after": true}],
14-
"space-infix-ops": "warn"
14+
"space-infix-ops": "warn",
15+
"space-before-function-paren": "warn"
1516
},
1617
"parserOptions": {
1718
"project": [

nodejs/src/error.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
class HackMDError extends Error {
2-
constructor(message: string) {
2+
constructor (message: string) {
33
super(message)
44
Object.setPrototypeOf(this, new.target.prototype)
55
}
66
}
77

88

99
class HttpResponseError extends HackMDError {
10-
public constructor(
10+
public constructor (
1111
message: string,
1212
readonly code: number,
1313
readonly statusText: string,

nodejs/src/index.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import * as HackMDErrors from './error'
55
export class API {
66
private axios: AxiosInstance
77

8-
constructor(readonly accessToken: string, public hackmdAPIEndpointURL: string = "https://api.hackmd.io/v1") {
8+
constructor (readonly accessToken: string, public hackmdAPIEndpointURL: string = "https://api.hackmd.io/v1") {
99
if (!accessToken) {
1010
throw new HackMDErrors.MissingRequiredArgument('Missing access token when creating HackMD client')
1111
}
@@ -53,62 +53,62 @@ export class API {
5353
)
5454
}
5555

56-
getMe = async () => {
56+
async getMe () {
5757
const { data } = await this.axios.get<User>("me")
5858
return data
5959
}
6060

61-
getHistory = async () => {
61+
async getHistory () {
6262
const { data } = await this.axios.get<Note[]>("history")
6363
return data
6464
}
6565

66-
getNoteList = async () => {
66+
async getNoteList () {
6767
const { data } = await this.axios.get<Note[]>("notes")
6868
return data
6969
}
7070

71-
getNote = async (noteId: string) => {
71+
async getNote (noteId: string) {
7272
const { data } = await this.axios.get<Note>(`notes/${noteId}`)
7373
return data
7474
}
7575

76-
createNote = async (options: CreateNoteOptions) => {
76+
async createNote (options: CreateNoteOptions) {
7777
const { data } = await this.axios.post<Note>("notes", options)
7878
return data
7979
}
8080

81-
updateNoteContent = async (noteId: string, content?: string) => {
81+
async updateNoteContent (noteId: string, content?: string) {
8282
const { data } = await this.axios.patch<string>(`notes/${noteId}`, { content })
8383
return data
8484
}
8585

86-
deleteNote = async (noteId: string) => {
86+
async deleteNote (noteId: string) {
8787
const { data } = await this.axios.delete<void>(`notes/${noteId}`)
8888
return data
8989
}
9090

91-
getTeams = async () => {
91+
async getTeams () {
9292
const { data } = await this.axios.get<Team[]>("teams")
9393
return data
9494
}
9595

96-
getTeamNotes = async (teamPath: string) => {
96+
async getTeamNotes (teamPath: string) {
9797
const {data} = await this.axios.get<Note[]>(`teams/${teamPath}/notes`)
9898
return data
9999
}
100100

101-
createTeamNote = async (teamPath: string, options: CreateNoteOptions) => {
101+
async createTeamNote (teamPath: string, options: CreateNoteOptions) {
102102
const { data } = await this.axios.post<Note>(`teams/${teamPath}/notes`, options)
103103
return data
104104
}
105105

106-
updateTeamNoteContent = async (teamPath: string, noteId: string, content?: string) => {
106+
async updateTeamNoteContent (teamPath: string, noteId: string, content?: string) {
107107
const { data } = await this.axios.patch<string>(`teams/${teamPath}/notes/${noteId}`, { content })
108108
return data
109109
}
110110

111-
deleteTeamNote = async (teamPath: string, noteId: string) => {
111+
async deleteTeamNote (teamPath: string, noteId: string) {
112112
const { data } = await this.axios.delete<void>(`teams/${teamPath}/notes/${noteId}`)
113113
return data
114114
}

0 commit comments

Comments
 (0)