Skip to content

Commit

Permalink
Fix getting started article
Browse files Browse the repository at this point in the history
  • Loading branch information
lahmatiy committed May 14, 2024
1 parent 5753b99 commit 1cdf5e2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 55 deletions.
1 change: 1 addition & 0 deletions docs/discovery/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ module.exports = function() {

articles.unshift(readmeTOC.shift());
articles[0].slug = 'intro';
readmeTOC.shift();
articles.splice(3, 0, {
...readmeTOC.shift(),
slug: 'jora-syntax',
Expand Down
72 changes: 17 additions & 55 deletions docs/discovery/text/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,29 @@ import jora from 'jora';
const jora = require('jora');
```

For a browser unminified (`dist/jora.js`) and minified (`dist/jora.min.js`) bundles are available. You may include `jora` by one of the following way:
For a browser two bundles are available:

- `dist/jora.js`
- `dist/jora.esm.js`

You may include `jora` by one of the following way:

```html
<script src="node_modules/jora/dist/jora.js"></script>
<script src="node_modules/jora/dist/jora.min.js"></script>
<script type="module">
import jora from 'node_modules/jora/dist/jora.esm.js';
</script>

<!-- or use one of CDN -->
<script src="https://unpkg.com/jora/dist/jora.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jora/dist/jora.js"></script>
<script type="module">
import jora from 'https://cdn.jsdelivr.net/npm/jora';
</script>

<script src="https://unpkg.com/jora/dist/jora.js"></script>
```

In this case, a global variable `jora` will become available.
In case a non ESM version is used, a global variable `jora` will become available.

## Usage

Expand All @@ -44,57 +56,7 @@ Such function takes a value and returns new value – a result of query performi
jora('query')(data) // query result
```

Query builder function takes `options` optional parameter:

```js
// used default values for options
jora('query', {
methods: undefined,
debug: false,
tolerant: false,
stat: false
});
```

Options:

- methods

Type: `Object`
Default: `undefined`

> NOTE: Use `jora.setup()` (see bellow) to specify custom methods when possible, due to performance reasons.
Custom methods for using in query passed as an object, where a key is a method name and a value is a function to perform an action. It overrides build-in methods. See [...]() for detail.

- debug

Type: `Boolean` or `function(name, value)`
Default: `false`

Enables debug output. When set a function, this function will recieve a section name and its value.

- tolerant

Type: `Boolean`
Default: `false`

Enables tolerant parsing mode. This mode supresses parsing errors when possible.

- stat

Type: `Boolean`
Default: `false`

Enables stat mode. When mode is enabled a query stat interface is returning instead of resulting data.

To create a new query factory function with predefined custom methods `jora.setup()` is using. Such factory function is not respect (ignores) `methods` option in `options`:

```js
const myQuery = jora.setup(methods);

myQuery(query)(data) // result of query
```
See [Jora library API](#article:api) for details.

## Your first query

Expand Down

0 comments on commit 1cdf5e2

Please sign in to comment.