Files
linux-odyssey/packages/file-graph/file.js
T

19 lines
369 B
JavaScript

import { basename } from './utils.js'
export default class File {
constructor({ path, type, discovered }) {
this.path = path
this.name = basename(path)
this.type = type
this.discovered = discovered
}
isDirectory() {
return this.type === 'folder'
}
contains(file) {
return this.isDirectory() && file.path.startsWith(this.path)
}
}