Facade abstractions for software side-effects. Reduce accidental complexity; focus on the problem to solve.
import { LocalFileSystem, VirtualFileSystem } from '@paulshryock/abstractions'
class MyClass {
public constructor(private fs: VirtualFileSystem) {}
public doSomething(): void {
this.fs.copy('some-file', 'another-file')
}
}
new MyClass(new LocalFileSystem()).doSomething()Decouple side-effects from your business logic. Swap your infrastructure any time.
- Switch from
LocalFileSystemtoSshFileSystemtoS3FileSystem. - Switch from
InMemoryStoragetoFileSystemStoragetoSqliteStorage.
npm install @paulshryock/abstractionsContributions are welcome! Read the contribution guidelines, and then submit a pull request.