Skip to content

Commit

Permalink
Add options section to README
Browse files Browse the repository at this point in the history
  • Loading branch information
joaonice committed Jul 10, 2017
1 parent 101a87d commit beb9aff
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ yarn add objection-guid

```js
// Import the plugin.
const guid = require('objection-guid');
const guid = require('objection-guid')();
const Model = require('objection').Model;

// Mixin the plugin.
Expand All @@ -45,6 +45,22 @@ console.log(item.id);
// bbbe64b0-61a3-11e7-879a-67bb027591aa
```

## Options


**field:** Overrides the default field name of the generated guid (Default: `id`)

**generateGuid:** Overrides the default function that generates the guid (Default: generates UUIDs v4 by default)

These options can be provided when instantiating the plugin:

```js
const guid = require('objection-guid')(
field: 'foo',
generateGuid: () => new Promise(resolve => resolve('bar'))
);
```

## Tests

Run the tests from the root directory:
Expand Down

0 comments on commit beb9aff

Please sign in to comment.