Files
wumpfetch/lib/util/MemoryCollection.js
Wessel T dd302b983e v0.3.0 - Profiles (Check the description for changes)
A lot has been renovated and some small things has been added to v0.3.0:
	* Added profiles (`getProfile`, `setProfile`, `setDefaults`)
	* Renamed `Collection` to `MemoryCollection`
	* Made `wumpfetch.userAgent` read-only
	* Renamed `__test__` to `tests`
	* Removed the `dist` folder
	* Changed the tab size from `4` to `2` in the declarations file
	and wumpfetch TS test file
	* Added JSdoc to `WumpRequest` and `WumpResponse`
	* Fixed up some of the weird spacing in `WumpRequest` and
	`WumpResponse`
	* Cleaned up all test files
2019-08-26 16:52:34 +02:00

24 lines
447 B
JavaScript

module.exports = class MemoryCollection extends Map {
constructor() {
super();
}
filter(callback) {
let result = [];
for (const entry of Array.from(this.values())) {
if (callback(entry)) result.push(entry);
}
return result;
}
map(callback) {
let result = [];
for (const value of Array.from(this.values())) {
result.push(callback(value));
}
return result;
}
};