Skip to content

Commit

Permalink
Document format of additionalMethods
Browse files Browse the repository at this point in the history
Which is, simple truthy properties. Closes #1, for now.
  • Loading branch information
vweevers committed Oct 12, 2019
1 parent 280bf78 commit 192bc9e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,24 @@ _TBD: what this means for `*asBuffer` options._

### `additionalMethods` (object)

Format TBD.
In the form of:

```js
{
foo: true,
bar: true
}
```

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:

```js
if (db.supports.additionalMethods.foo) {
db.foo()
}
```

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)).

## Install

Expand Down
13 changes: 1 addition & 12 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,6 @@ module.exports = function supports () {
encodings: manifest.encodings || false,

// Methods that are not part of abstract-leveldown or levelup
additionalMethods: manifest.additionalMethods || {
// May look something like:
// approximateSize: {
// sync: false,
// callback: true,
// promise: false
// },
// createWriteStream: {
// sync: true,
// writable: true
// }
}
additionalMethods: manifest.additionalMethods || {}
})
}

0 comments on commit 192bc9e

Please sign in to comment.