# @janiscommerce/active-client

> A simple module for getting an Active Client from a field and a value

Latest version **1.2.2** (published 2019-08-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install @janiscommerce/active-client
pnpm add @janiscommerce/active-client
yarn add @janiscommerce/active-client
bun add @janiscommerce/active-client
```

## 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 | 1.2.2 |
| Published | 2019-08-13 |
| First published | 2019-06-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 4.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Janis |
| Maintainers | janiscommerce |

## Links

- npm: https://www.npmjs.com/package/@janiscommerce/active-client
- Repository: https://github.com/janis-commerce/active-client
- Homepage: https://github.com/janis-commerce/active-client#readme
- Issues: https://github.com/janis-commerce/active-client/issues
- npm.io page: https://npm.io/package/@janiscommerce/active-client

## Dependencies (2)

- [@janiscommerce/model](https://npm.io/package/@janiscommerce/model.md) ^1.0.0
- [@janiscommerce/settings](https://npm.io/package/@janiscommerce/settings.md) ^1.0.0

## Recent versions

- 1.2.2 (latest) — 2019-08-13
- 1.2.1 — 2019-08-06
- 1.2.0 — 2019-07-18
- 1.1.1 — 2019-07-15
- 1.1.0 — 2019-07-04
- 1.0.0 — 2019-06-26

## README

# active-client

[![Build Status](https://travis-ci.org/janis-commerce/active-client.svg?branch=master)](https://travis-ci.org/janis-commerce/active-client)
[![Coverage Status](https://coveralls.io/repos/github/janis-commerce/active-client/badge.svg?branch=master)](https://coveralls.io/github/janis-commerce/active-client?branch=master)

**ActiveClient** is a simple module for getting an Active Client from a field and a value.
The module only has one method and a Model for the get.

## Installation

```bash
npm install @janiscommerce/active-client
```

## Settings
This package uses the [Settings](https://www.npmjs.com/package/@janiscommerce/settings) package for handle settings.
The setting key is `clients` and the available settings are the following

| Setting | Default Value | Description |
|--|--|--|
| databaseKey | _default | The database key from DB configuration |
| table | clients | The clients table name |


## API

* `getByField(field, value)` **ASYNCHRONOUS**, Search the client by a field and value given.

- `field`: *type* `String`, the field name. eg. 'name'.
- `value`: *type* `String|Integer`, the field value. eg. 'foo'.

Returns a `Object` with the client found or `false` if client not found for `field` with that `value`.

## Usage

```javascript

const ActiveClient = require('@janiscommerce/active-client');

const client = await ActiveClient.getByField('name', 'client-name');

/**
	Expected output:
	{
		id: 1,
		name: 'client-name',
		status: 5
	}
 */

```

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