Skip to content

Commit 192bc9e

Browse files
committed
Document format of additionalMethods
Which is, simple truthy properties. Closes #1, for now.
1 parent 280bf78 commit 192bc9e

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,24 @@ _TBD: what this means for `*asBuffer` options._
161161

162162
### `additionalMethods` (object)
163163

164-
Format TBD.
164+
In the form of:
165+
166+
```js
167+
{
168+
foo: true,
169+
bar: true
170+
}
171+
```
172+
173+
Which says the db has two methods, `foo` and `bar`, that are not part of the `abstract-leveldown` interface. It might be used like so:
174+
175+
```js
176+
if (db.supports.additionalMethods.foo) {
177+
db.foo()
178+
}
179+
```
180+
181+
For future extensibility, the properties of `additionalMethods` should be taken as truthy rather than strictly typed booleans. We may add additional metadata (see [#1](https://github.com/Level/supports/issues/1)).
165182

166183
## Install
167184

index.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,6 @@ module.exports = function supports () {
3030
encodings: manifest.encodings || false,
3131

3232
// Methods that are not part of abstract-leveldown or levelup
33-
additionalMethods: manifest.additionalMethods || {
34-
// May look something like:
35-
// approximateSize: {
36-
// sync: false,
37-
// callback: true,
38-
// promise: false
39-
// },
40-
// createWriteStream: {
41-
// sync: true,
42-
// writable: true
43-
// }
44-
}
33+
additionalMethods: manifest.additionalMethods || {}
4534
})
4635
}

0 commit comments

Comments
 (0)