Skip to content

Commit

Permalink
style(): run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
AlenVelocity committed Nov 12, 2021
1 parent 1bf6f45 commit e032a17
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion examples/index.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(async () => {
;(async () => {
await import('./default.mjs')
await import('./crop.mjs')
await import('./full.mjs')
Expand Down
13 changes: 6 additions & 7 deletions src/Sticker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ export class Sticker {
private _parse = async (): Promise<Buffer> =>
Buffer.isBuffer(this.data)
? this.data
: this.data.trim().startsWith('<svg') ? Buffer.from(this.data) : (async () =>
: this.data.trim().startsWith('<svg')
? Buffer.from(this.data)
: (async () =>
existsSync(this.data)
? readFile(this.data)
: axios.get(this.data as string, { responseType: 'arraybuffer' }).then(({ data }) => data))()
Expand All @@ -53,13 +55,10 @@ export class Sticker {
* const sticker = new Sticker('./image.png')
* const buffer = sticker.build()
*/
public build = async (
): Promise<Buffer> => {
public build = async (): Promise<Buffer> => {
const data = await this._parse()
const mime = await this._getMimeType(data)
return new Exif(this.metadata as IStickerConfig).add(
await convert(data, mime, this.metadata)
)
return new Exif(this.metadata as IStickerConfig).add(await convert(data, mime, this.metadata))
}

/**
Expand Down Expand Up @@ -126,7 +125,7 @@ export class Sticker {
this.metadata.id = id
return this
}

/**
* Set the sticker category
* @param categories - Sticker Category
Expand Down
7 changes: 2 additions & 5 deletions src/internal/convert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,8 @@ import { IStickerOptions } from '..'
const convert = async (
data: Buffer,
mime: string,
{
quality = 100,
background = defaultBg,
type = StickerTypes.DEFAULT,
}: IStickerOptions): Promise<Buffer> => {
{ quality = 100, background = defaultBg, type = StickerTypes.DEFAULT }: IStickerOptions
): Promise<Buffer> => {
const isVideo = mime.startsWith('video')
let image = isVideo ? await videoToGif(data) : data
const isAnimated = isVideo || mime.includes('gif')
Expand Down

0 comments on commit e032a17

Please sign in to comment.