1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-08 21:10:05 +00:00

chore(writeStream): refactor function and improve test

This commit is contained in:
Yury Shkoda
2022-01-31 10:21:20 +03:00
parent 556ab608c5
commit 56df578ab2
2 changed files with 23 additions and 17 deletions

View File

@@ -3,13 +3,9 @@ import { WriteStream } from '../../types'
export const writeStream = async (
stream: WriteStream,
content: string
): Promise<void> => {
return new Promise((resolve, reject) => {
stream.write(content + '\n', (e) => {
if (e) {
return reject(e)
}
return resolve()
})
): Promise<void> =>
stream.write(content + '\n', (e) => {
if (e) return Promise.reject(e)
return Promise.resolve()
})
}