docs
This commit is contained in:
38
API.unit.md
Normal file
38
API.unit.md
Normal file
@@ -0,0 +1,38 @@
|
||||
# unit
|
||||
|
||||
This document is auto-generated from the JSDoc comments in `src/store` by running `npm run api-doc`.
|
||||
|
||||
## `unit.delete`
|
||||
|
||||
*Source: `src/store/unit/delete.js`*
|
||||
|
||||
Deletes a unit for a company by its SI code.
|
||||
|
||||
```js
|
||||
const fn = del(pool);
|
||||
await fn(42, 1, 'l');
|
||||
```
|
||||
|
||||
## `unit.list`
|
||||
|
||||
*Source: `src/store/unit/list.js`*
|
||||
|
||||
Lists the units available for a company.
|
||||
|
||||
```js
|
||||
const fn = list(pool);
|
||||
const units = await fn(42, 1);
|
||||
// => [{ id, si, basesi, basesifactor, symbol, name }]
|
||||
```
|
||||
|
||||
## `unit.upsert`
|
||||
|
||||
*Source: `src/store/unit/upsert.js`*
|
||||
|
||||
Creates or updates a unit for a company, keyed by its SI code.
|
||||
|
||||
```js
|
||||
const fn = upsert(pool);
|
||||
const unit = await fn(42, 1, { si: 'l', basesi: 'm3', basesifactor: 0.001, symbol: 'L', name: 'Liter' });
|
||||
// => { id, si, basesi, basesifactor, symbol, name }
|
||||
```
|
||||
Reference in New Issue
Block a user