# jsend-response-builder

> A simple typescript library for constructing jsend response objects

Latest version **2.0.5** (published 2018-10-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install jsend-response-builder
pnpm add jsend-response-builder
yarn add jsend-response-builder
bun add jsend-response-builder
```

## 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 | 2.0.5 |
| Published | 2018-10-21 |
| First published | 2018-08-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 11.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Joe Hartzell |
| Maintainers | joe_hartzell |
| Keywords | jsend, typescript, builder |

## Links

- npm: https://www.npmjs.com/package/jsend-response-builder
- Repository: https://github.com/JoeHartzell/jsend-response-builder
- Homepage: https://github.com/JoeHartzell/jsend-response-builder#readme
- Issues: https://github.com/JoeHartzell/jsend-response-builder/issues
- npm.io page: https://npm.io/package/jsend-response-builder

## Dependencies (1)

- [obj-key-normalizer](https://npm.io/package/obj-key-normalizer.md) ^1.3.1

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 2.0.5 (latest) — 2018-10-21
- 2.0.4 — 2018-10-18
- 2.0.3 — 2018-10-18
- 2.0.2 — 2018-10-09
- 2.0.1 — 2018-08-24
- 2.0.0 — 2018-08-24
- 1.0.3 — 2018-08-23
- 1.0.2 — 2018-08-23
- 1.0.1 — 2018-08-23
- 1.0.0 — 2018-08-23

## README

# About

A simple typescript library for creating JSend responses. Supports making "Success", "Error" and "Fail" responses. 
# Usage

The project is very simple to start using. You simply create an instance of the JSendResponseBuilder then start using the methods. The builder supports several options to customize the builder

### Options 

The options are currently a WIP but currently there are 2 available options.

| Option | Values                    | Description                                                                     |
|--------|---------------------------|---------------------------------------------------------------------------------|
| *case* | 'kebab', 'camel', 'snake' | By setting this, it controls what case type the object keys in the response are |
| *deep* | true, false               | By setting this, it controls if nested objects in the reponse get normalized    |
| *namespaceKey* | string             | By setting this, it prevents the case type from rewriting the characters that separate a namespace from its key |

### Example 
```ts
const data = {
    firstName: 'Joe',
    lastName: 'Hartzell'
};
const jsend = new JSendResponseBuilder();
const response = jsend.success(data);

// response output
// {
//     status: 'success',
//     data: {
//         firstName: 'Joe',
//         lastName: 'Hartzell'
//     }
// }
```

More examples can be found in the tests directory

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