mirror of
https://github.com/joelwmale/webhook-action.git
synced 2024-08-25 08:08:00 +00:00
22 lines
809 B
TypeScript
22 lines
809 B
TypeScript
|
import * as fs from './adapters/fs';
|
||
|
|
||
|
export type Options = {
|
||
|
followSymbolicLink?: boolean;
|
||
|
fs?: Partial<fs.FileSystemAdapter>;
|
||
|
markSymbolicLink?: boolean;
|
||
|
throwErrorOnBrokenSymbolicLink?: boolean;
|
||
|
};
|
||
|
|
||
|
export default class Settings {
|
||
|
public readonly followSymbolicLink: boolean = this._getValue(this._options.followSymbolicLink, true);
|
||
|
public readonly fs: fs.FileSystemAdapter = fs.createFileSystemAdapter(this._options.fs);
|
||
|
public readonly markSymbolicLink: boolean = this._getValue(this._options.markSymbolicLink, false);
|
||
|
public readonly throwErrorOnBrokenSymbolicLink: boolean = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
||
|
|
||
|
constructor(private readonly _options: Options = {}) { }
|
||
|
|
||
|
private _getValue<T>(option: T | undefined, value: T): T {
|
||
|
return option ?? value;
|
||
|
}
|
||
|
}
|