import ArrayProxy from "kinibind/ts/proxy/array-proxy"; import FilterQuery from "kinibind/ts/proxy/filter-query"; import FilteredResults from "kinibind/ts/proxy/filtered-results"; export default class FetchArrayProxy extends ArrayProxy { private _fetchInstance; // Collect a fetch instance constructor(fetchInstance: any) { super(); this._fetchInstance = fetchInstance; } /** * Filter results for this type * * @param filterQuery */ public filterResults(filterQuery: FilterQuery): Promise { return this._fetchInstance.then((response: any) => { return response.json().then((jsonResults: any) => { return new FilteredResults(jsonResults, jsonResults.length); }); }); } }