Files
linux-odyssey/packages/file-graph/file.js
T
wancat 7405f786a0 feat: add merge function
Able to deal with:
1.  merge a subtree
2023-08-21 22:22:01 +08:00

19 lines
366 B
JavaScript

import { basename } from './utils'
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)
}
}