Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why are UniDriverList.map and UniDriverList.filter not consistent in return value #79

Open
hepiyellow opened this issue Apr 28, 2019 · 1 comment

Comments

@hepiyellow
Copy link
Contributor

hepiyellow commented Apr 28, 2019

Current API

map returns an array while filter returns a UniDriverList.

export type UniDriverList<T = any> = {
	get: (idx: number) => UniDriver<T>,
	text: () => Promise<string[]>,
	count: () => Promise<number>,
	map: <T>(mapFn: MapFn<T>) => Promise<T[]>,
	filter: (predicate: PredicateFn) => UniDriverList
};

##Suggestion 1

Either go with Array of List

##Suggestion 2

Expose toArray. And then the consumer can use the Array's map, filter, find.

@GabiGrin
Copy link
Contributor

GabiGrin commented Apr 28, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants