# nx-toolkit

> Helper utilities for angular

Latest version **1.4.0** (published 2018-01-18) · ISC license · 0 weekly downloads

## Install

```sh
npm install nx-toolkit
pnpm add nx-toolkit
yarn add nx-toolkit
bun add nx-toolkit
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.0 |
| Published | 2018-01-18 |
| First published | 2018-01-17 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Asham |
| Maintainers | ashamnx |

## Links

- npm: https://www.npmjs.com/package/nx-toolkit
- Repository: https://github.com/ashamnx/nx-toolkit
- Homepage: https://github.com/ashamnx/nx-toolkit#readme
- Issues: https://github.com/ashamnx/nx-toolkit/issues
- npm.io page: https://npm.io/package/nx-toolkit

## Recent versions

- 1.4.0 (latest) — 2018-01-18
- 1.3.0 — 2018-01-18
- 1.2.0 — 2018-01-18
- 1.1.0 — 2018-01-18
- 1.0.0 — 2018-01-17

## README

# nx-toolkit
Collection of Helper functions and other Utilities to speed up angular development,
## Install
Create a new angular project and install `nx-toolkit` via
`npm install nx-toolkit`
## Features
### Decorators
#### NxBaseFunctions
Decorator adds most of the code required to get started with the angular component. Basic functionality such as creating a `dataLoader` function, assigning query parameters from route (eg. search) to `queryParams`
#####Usage
```typescript
 @Component({
     selector: 'hr-banks',
     templateUrl: './banks.component.html',
     styleUrls: ['./banks.component.styl']
 })
 @NxBaseFunctions({
     serviceName: 'bankService'
 })
 export class BanksComponent implements OnInit {
    constructor(private bankService: BankService,
                private activatedRoute: ActivatedRoute)
 }
 ```
 This adds the following methods and  to the `component`.
 ```typescript
export interface BaseFunctionT {
    nxDataSource: NxDataSource | null;
    dataSubject: BehaviorSubject<any[]>;
    queryParams: Params | null;
    
    loadData(params?: object): void;
    getUpdatedRouteParams(newParams: object): Params;
}
```

#### NxDataService
Decorator adds basic crud functions to the angular service (`@Injectable`)
##### Usage
```typescript

@Injectable()
@NxDataService({
    url: '/api/banks'
})
export class BankService {
    constructor(private http: HttpClient) {
    }
}
```
This adds the following methods to the service
```typescript
export interface NxDataService<T> {
    list(params?: object): Observable<any>;

    get(id: number): Observable<T>;

    add(T): Observable<any>;

    update(T): Observable<any>;

    delete(number): Observable<any>;
}
```
## Dev Instructions
```
git clone https://github.com/ashamnx/nx-toolkit.git
cd nx-toolkit
npm link
// then in your angular project do
npm link nx-toolkit
// now nx-toolkit will be available in your project (via node_modules)
// any changes made to original nx-toolkit will be reflected in your project.
// create PR if you wish to push to your changes
```

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