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 11, 2017
1 parent c5dc4bc commit 97fb49b
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 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,21 @@ 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 which can be a promise (Default: generates UUIDs v4 by default)

These options can be provided when instantiating the plugin:

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

## Tests

Run the tests from the root directory:
Expand Down

0 comments on commit 97fb49b

Please sign in to comment.