File-based response support & static server
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
- Clean up UniversalPath implementation
- Use Readable/Writable types correctly for stream methods
- Add .list() methods for getting child files
- Make Response body specify explicit types and support
writing Readable streams to the body
- Create a static file server that supports directory listing
This commit is contained in:
@@ -50,6 +50,20 @@ class Collection<T> {
|
||||
return new Collection(items)
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new collection from an item or array of items.
|
||||
* Filters out undefined items.
|
||||
* @param itemOrItems
|
||||
*/
|
||||
public static normalize<T2>(itemOrItems: (CollectionItem<T2> | undefined)[] | CollectionItem<T2> | undefined): Collection<T2> {
|
||||
if ( !Array.isArray(itemOrItems) ) {
|
||||
itemOrItems = [itemOrItems]
|
||||
}
|
||||
|
||||
const items = itemOrItems.filter(x => typeof x !== 'undefined') as CollectionItem<T2>[]
|
||||
return new Collection<T2>(items)
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a collection of "undefined" elements of a given size.
|
||||
* @param size
|
||||
|
||||
Reference in New Issue
Block a user