mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-05 19:20:12 +08:00
19 lines
366 B
JavaScript
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)
|
|
}
|
|
}
|