Skip to content

Commit

Permalink
Refactor code; update package version to 3.2.15
Browse files Browse the repository at this point in the history
  • Loading branch information
FlameWolf committed May 6, 2024
1 parent 9158481 commit 635df3f
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion CallbackStorage.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { FileInfo } from "busboy";
import { FileHandler, StorageOption } from "./index";

export declare class CallbackStorage implements StorageOption {
#callback: FileHandler;
private callback: FileHandler;
constructor(callback: FileHandler);
process(name: string, stream: Readable, info: FileInfo): import("./index").File | Promise<import("./index").File>;
}
6 changes: 3 additions & 3 deletions CallbackStorage.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"use strict";

class CallbackStorage {
#callback;
callback;
constructor(callback) {
this.#callback = callback;
this.callback = callback;
}
process(name, stream, info) {
return this.#callback(name, stream, info);
return this.callback(name, stream, info);
}
}

Expand Down
2 changes: 1 addition & 1 deletion DiscStorage.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Readable } from "stream";
import { FileInfo } from "busboy";

export declare class DiscStorage implements StorageOption {
#target: TargetType;
private target: TargetType;
constructor(target: TargetType);
process(name: string, stream: Readable, info: FileInfo): Promise<File>;
}
6 changes: 3 additions & 3 deletions DiscStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ const os = require("os");
const fs = require("fs");

class DiscStorage {
#target;
target;
constructor(target) {
this.#target = target;
this.target = target;
}
process(name, stream, info) {
const target = this.#target;
const target = this.target;
const file = new FileInternal(name, info);
const saveLocation = typeof target === "function" ? target(file) : target;
const filePath = path.join(saveLocation?.directory || os.tmpdir(), saveLocation?.fileName || file.originalName);
Expand Down
2 changes: 1 addition & 1 deletion FieldParserWithSchema.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Dictionary, FieldParser } from "./index";

export declare class FieldParserWithSchema implements FieldParser {
#props: Dictionary;
private props: Dictionary;
constructor(props: Dictionary);
parseField(name: string, value: any): any;
}
6 changes: 3 additions & 3 deletions FieldParserWithSchema.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"use strict";

class FieldParserWithSchema {
#props;
props;
constructor(props) {
this.#props = props;
this.props = props;
}
parseField(name, value) {
if (this.#props[name]?.type !== "string") {
if (this.props[name]?.type !== "string") {
try {
return JSON.parse(value);
} catch {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "formzilla",
"version": "3.2.14",
"version": "3.2.15",
"description": "Fastify plugin for parsing multipart/form data",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 635df3f

Please sign in to comment.