From aa6f8b6f8eef15c2ff613eb449cce210d0275299 Mon Sep 17 00:00:00 2001 From: rhpidfyre Date: Thu, 6 Mar 2025 20:55:43 -0500 Subject: [PATCH] rename `new_entry` and `new_collection` to `entry` and `collection` --- src/rt/rfwfs/main.ts | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/rt/rfwfs/main.ts b/src/rt/rfwfs/main.ts index 7b7f4df..c741548 100644 --- a/src/rt/rfwfs/main.ts +++ b/src/rt/rfwfs/main.ts @@ -28,7 +28,6 @@ interface EntryCollectionInner extends Entry { interface EntryFile extends Entry { inner: T } - interface EntryCollection extends EntryCollectionInner { pop: (file_name: string) => T | undefined, find: (file_name: string) => T | undefined @@ -38,8 +37,10 @@ interface EntryCollection extends EntryCollectionInner { interface Rfwfs { is_dir: (entry: T) => boolean, is_file: (entry: T) => boolean, - new_entry: (name: string, permissions: Permissions, timestamp: number, inner: T) => EntryFile, - new_collection: (inner: T[]) => EntryCollection, + entry: (name: string, permissions: Permissions, timestamp: number, inner: T) => EntryFile, + collection: (inner: T[]) => EntryCollection, +} + function readable(self: EntryCollection): boolean { return self.permissions === Permissions.rw || self.permissions === Permissions.r } @@ -89,7 +90,7 @@ rfwfs.is_file = function(entry) { return entry.type === EntryType.File } -rfwfs.new_entry = function(name, permissions, timestamp, inner) { +rfwfs.entry = function(name, permissions, timestamp, inner) { return { name: name, type: typeof inner === "object" ? EntryType.Directory : EntryType.File, @@ -99,12 +100,12 @@ rfwfs.new_entry = function(name, permissions, timestamp, inner) { } } -rfwfs.new_collection = function(collection: T[]): EntryCollection { +rfwfs.collection = function(collection: T[]): EntryCollection { const collection_trait = { collection: collection } as EntryCollection - collection_trait.sort = function() { return sort(this) } - collection_trait.push = function(entry) { return push(this, entry) } - collection_trait.find = function(file_name) { return find(this, file_name) } - collection_trait.pop = function(file_name) { return pop(this, file_name) } + collection_trait.pop = function(file_name) { return pop(this, file_name) } + collection_trait.find = function(file_name) { return find(this, file_name) } + collection_trait.push = function(entry) { return push(this, entry) } + collection_trait.sort = function() { return sort(this) } collection_trait.sort() return collection_trait }