# tiny-ng-store

> Tiny RxJS store for @angular

Latest version **3.0.1** (published 2017-04-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install tiny-ng-store
pnpm add tiny-ng-store
yarn add tiny-ng-store
bun add tiny-ng-store
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.1 |
| Published | 2017-04-20 |
| First published | 2016-06-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | JakeS |
| Maintainers | ugliestlemming |
| Keywords | Angular2, RxJS, Data Store |

## Links

- npm: https://www.npmjs.com/package/tiny-ng-store
- Repository: https://github.com/JScearcy/tiny-ng-store
- Homepage: https://github.com/JScearcy/tiny-ng-store#readme
- Issues: https://github.com/JScearcy/tiny-ng-store/issues
- npm.io page: https://npm.io/package/tiny-ng-store

## Recent versions

- 3.0.1 (latest) — 2017-04-20
- 3.0.0 — 2016-11-16
- 2.0.0 — 2016-11-15
- 1.2.5 — 2016-07-11
- 1.2.4 — 2016-06-30
- 1.2.3 — 2016-06-29
- 1.2.1 — 2016-06-28
- 1.2.0 — 2016-06-28
- 1.1.1 — 2016-06-27
- 1.1.0 — 2016-06-27
- 1.0.0 — 2016-06-27
- 0.3.1 — 2016-06-24
- 0.3.0 — 2016-06-23
- 0.2.2 — 2016-06-22
- 0.2.0 — 2016-06-21
- … 2 more at https://npm.io/package/tiny-ng-store/versions

## README

[![Build status](https://ci.appveyor.com/api/projects/status/6r401wlebcgprnam?svg=true)](https://ci.appveyor.com/project/JScearcy/tiny-ng-store)
[![Build Status](https://travis-ci.org/JScearcy/tiny-ng-store.svg?branch=master)](https://travis-ci.org/JScearcy/tiny-ng-store)
[![npm version](https://badge.fury.io/js/tiny-ng-store.svg)](https://badge.fury.io/js/tiny-ng-store)

# tiny-ng-store

A flexible store for Angular 2 projects. 
A tiny API and small footprint allow for a quick setup.

## Docs
* [tiny-ng-store docs](https://jscearcy.github.io/tiny-ng-store/)

## Use

### Initialize
#### In your main app module
    import { TinyNgStore } from 'tiny-ng-store/tiny-ng-store';

    @NGModule({
        ...
        providers: [ TinyNgStore ]
        ...
    })
    

### Inject
    import { TinyNgStore, StoreItem, TnsState } from 'tiny-ng-store/tiny-ng-store';

    items: TnsState<any>;
    constructor(private storeService: TinyNgStore) {};

### Get Item
    this.storeService.GetItem('storeName')
* Returns a StoreItem TnsState - Map to extract data, tansform, or subscribe as necessary
    
    this.storeService.GetItem('storeName').map((s: StoreItem) => s && s.data);
* This will return a TnsState that contains either undefined (if it was never created) or the data you added to that store.

### Insert Item 
    this.storeService.InsertItem({ name: 'storeName' data: 'Any Data' });
* Use any type of data that you want
* Returns a StoreItem TnsState - Map to extract data, tansform, or subscribe as necessary

    this.storeService.InsertItem('storeName').map((s: StoreItem) => s && s.data);
* This will return a TnsState that contains the data added to that store.


### Update Item
    this.storeService.UpdateItem({ name: 'storeName' data: 'Updated Data' });

### Remove Item
    this.storeService.DeleteItem('storeName');

### Run tests   
    npm install
    npm run tests
* Runs Karma test runner and creates new results is the coverage/ folder.

#### Examples
* A collection of small examples for various Angular 2 items
    https://github.com/JScearcy/angular-2-examples

* The tiny-ng-store examples
    https://github.com/JScearcy/angular-2-examples/tree/master/src/app/tiny-ng-store-example

### Versions
#### 3.0.1
* Updated dependencies

#### 3.0.0
Breaking:
* Change TnsObservable to TnsState

Non-Breaking:
* GetItem returns TnsState that utilizes distinctUntilChanged
* Updated dependencies

#### 2.0.0
Breaking:
* Provide TnsObservable instead of Observable to prevent inheritance issues in RxJs

---
_Source: https://npm.io/package/tiny-ng-store · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
