docs
This commit is contained in:
62
API.lang.md
Normal file
62
API.lang.md
Normal file
@@ -0,0 +1,62 @@
|
||||
# lang
|
||||
|
||||
This document is auto-generated from the JSDoc comments in `src/store` by running `npm run api-doc`.
|
||||
|
||||
## `lang.create`
|
||||
|
||||
*Source: `src/store/lang/create.js`*
|
||||
|
||||
Creates a new language by its ISO 639 code.
|
||||
|
||||
```js
|
||||
const fn = create(pool);
|
||||
const id = await fn('de');
|
||||
// => 1
|
||||
```
|
||||
|
||||
## `lang.delete`
|
||||
|
||||
*Source: `src/store/lang/delete.js`*
|
||||
|
||||
Deletes a language by its id.
|
||||
|
||||
```js
|
||||
const fn = del(pool);
|
||||
await fn(1);
|
||||
```
|
||||
|
||||
## `lang.ensure`
|
||||
|
||||
*Source: `src/store/lang/ensure.js`*
|
||||
|
||||
Returns the id of a language by ISO code, creating it if it does not exist.
|
||||
|
||||
```js
|
||||
const fn = ensure(pool);
|
||||
const id = await fn('de');
|
||||
// => 1
|
||||
```
|
||||
|
||||
## `lang.getByIso639`
|
||||
|
||||
*Source: `src/store/lang/getByIso639.js`*
|
||||
|
||||
Returns a language row by its ISO 639 code.
|
||||
|
||||
```js
|
||||
const fn = getByIso639(pool);
|
||||
const lang = await fn('de');
|
||||
// => { id, iso639 }
|
||||
```
|
||||
|
||||
## `lang.list`
|
||||
|
||||
*Source: `src/store/lang/list.js`*
|
||||
|
||||
Lists all languages.
|
||||
|
||||
```js
|
||||
const fn = list(pool);
|
||||
const languages = await fn();
|
||||
// => [{ id, iso639 }]
|
||||
```
|
||||
Reference in New Issue
Block a user