beakerbrowser / webdb

The Web is your database.
https://www.npmjs.com/package/@beaker/webdb
MIT License
399 stars 45 forks source link

Constructor signature mismatch #9

Closed webdesserts closed 6 years ago

webdesserts commented 6 years ago

In the api docs the constructor has the signature new WebDB([name]). However, in the initial nodejs example it has what looks to be the signature new WebDB(path[, options]). I see a mention of the path, but I don't see anything about the options. Also is the path still optional in node?

Side Note: these types of environment dependent dynamic signatures are kind of a pain in the ass to work with in typed pre-processors like Typescript & Flow (edit: specifically if name is optional and path is required in this specific case).

pfrazee commented 6 years ago

Ok that's a mistake in the docs. The options param needs to be documented.

The behavior is different between node and the browser but only slightly (which may be a bad thing). The name/path param is always optional. If you dont specify it in node, it just defaults to a local webdb directory.