# @helios-interactive/garuda-js

> Garuda Config Management

Latest version **1.1.0** (published 2018-04-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install @helios-interactive/garuda-js
pnpm add @helios-interactive/garuda-js
yarn add @helios-interactive/garuda-js
bun add @helios-interactive/garuda-js
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2018-04-02 |
| First published | 2018-03-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | 8.4.0 |
| Dependencies | 0 |
| Unpacked size | 18.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Michael Neil |
| Maintainers | adammcfadden, chickenfoot, halfwizard, mneil |

## Links

- npm: https://www.npmjs.com/package/@helios-interactive/garuda-js
- Repository: https://bitbucket.org/heliosinteract/garuda-js
- Homepage: http://heliosinteractive.com/
- npm.io page: https://npm.io/package/@helios-interactive/garuda-js

## Recent versions

- 1.1.0 (latest) — 2018-04-02
- 1.0.0 — 2018-03-28

## README

# Garuda
> Config Manager

Garuda loads configuration for apps from the file `/garuda.config.json`.

Additionally, if a the file `/garuda.local.config.json` is found, settings in that file will be merged into the configuration loaded from `/garuda.config.json`.

## Functions and Methods

### garuda()
Alias of garuda.set()

### garuda.get([prop], [options]) ⇒ `Promise.<Object>`
Get a property from garuda. All keys are found by string.
garuda.get('path.to.property.at.index.2')

**Returns**: `Promise.<Object>` - - A promise containing the config  

| Param | Type | Description |
| --- | --- | --- |
| [prop] | `string` OR `Object` | string - namespacecd property, OR options object |
| [options] | `Object` | options object |

### garuda.set(propOrVal, value) ⇒ `Promise.<Object>`
Set a property or properties

**Returns**: `Promise.<Object>` - - A promise containing the updated config object  

| Param | Type | Description |
| --- | --- | --- |
| propOrVal | `string` OR `Object` | string: namespaced property OR val: config object |
| value | `\*` | when first parameter is a string, sets specified property to this string |


### garuda.retrieveLocalStorage() ⇒ `Object`
Retrieves config from local storage

**Returns**: `Object` - - config as stored in local storage  

### garuda.clearLocalStorage()
Clears garuda local storage and resets config to configs loaded from server.
Note: When config is changed through `garuda.set()` it automatically saved
to local storage. Clearing local storage reverts garuda to configs loaded
from the server.

## Events
### `garuda-updated`
Every time the config is updated using `garuda.set()` or it's alias, Garuda dispatches an the event `garuda-updated` on the `document`. The event parameter sent to the callback function of the event listener contains a `details` property that includes an object detailing the updates.

```
document.addEventListener('garuda-updated', (e) => {
  const updates = e.detail;
  console.log(updates);
});
```

---
_Source: https://npm.io/package/@helios-interactive/garuda-js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
