# messaging-api-common

> Helpers for common usages in Messaging API clients

Latest version **1.0.4** (published 2021-01-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install messaging-api-common
pnpm add messaging-api-common
yarn add messaging-api-common
bun add messaging-api-common
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2021-01-11 |
| First published | 2019-09-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=10 |
| Dependencies | 11 |
| Unpacked size | 146.5 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1937 |
| Maintainers | chentsulin |
| Keywords | bot, chatbot, messaging-apis |

## Links

- npm: https://www.npmjs.com/package/messaging-api-common
- Repository: https://github.com/Yoctol/messaging-apis
- Homepage: https://github.com/Yoctol/messaging-apis#readme
- Issues: https://github.com/Yoctol/messaging-apis/issues
- npm.io page: https://npm.io/package/messaging-api-common

## Dependencies (11)

- [axios](https://npm.io/package/axios.md) ^0.21.1
- [debug](https://npm.io/package/debug.md) ^4.1.1
- [lodash](https://npm.io/package/lodash.md) ^4.17.15
- [map-obj](https://npm.io/package/map-obj.md) ^4.1.0
- [url-join](https://npm.io/package/url-join.md) ^4.0.1
- [camel-case](https://npm.io/package/camel-case.md) ^4.1.1
- [snake-case](https://npm.io/package/snake-case.md) ^3.0.3
- [pascal-case](https://npm.io/package/pascal-case.md) ^3.1.1
- [@types/debug](https://npm.io/package/@types/debug.md) ^4.1.5
- [@types/lodash](https://npm.io/package/@types/lodash.md) ^4.14.156
- [@types/url-join](https://npm.io/package/@types/url-join.md) ^4.0.0

## Recent versions

- 1.0.4 (latest) — 2021-01-11
- 1.0.0-beta.29 (next) — 2020-06-29
- 1.0.0 — 2020-09-07
- 1.0.0-beta.26 — 2020-06-16
- 1.0.0-beta.24 — 2020-06-11
- 1.0.0-beta.23 — 2020-05-18
- 1.0.0-beta.16 — 2020-04-06
- 1.0.0-beta.5 — 2019-11-22
- 1.0.0-beta.4 — 2019-11-22
- 1.0.0-beta.3 — 2019-11-22
- 1.0.0-beta.2 — 2019-11-19
- 1.0.0-beta.1 — 2019-11-16
- 1.0.0-beta.0 — 2019-11-14
- 1.0.0-alpha.2 — 2019-10-04
- 1.0.0-alpha.0 — 2019-09-11

## README

# messaging-api-common

> Helpers for common usages in Messaging API clients

## Table of Contents

- [Installation](#installation)
- [Usage](#usage)

## Installation

```sh
npm i --save messaging-api-common
```

or

```sh
yarn add messaging-api-common
```

<br />

## Usage

Case Convertors:

```js
const {
  snakecase,
  snakecaseKeys,
  snakecaseKeysDeep,
  camelcase,
  camelcaseKeys,
  camelcaseKeysDeep,
  pascalcase,
  pascalcaseKeys,
  pascalcaseKeysDeep,
} = require('messaging-api-common');

snakecase('fooBar');
//=> 'foo_bar'
snakecaseKeys({ fooBar: true });
//=> { 'foo_bar': true }
snakecaseKeysDeep({ fooBar: { barFoo: true } });
//=> { 'foo_bar': { 'bar_foo': true } }

camelcase('foo_bar');
//=> 'fooBar'
camelcaseKeys({ foo_bar: true });
//=> { 'fooBar': true }
camelcaseKeysDeep({ foo_bar: { bar_foo: true } });
//=> { 'fooBar': { 'barFoo': true } }

pascalcase('fooBar');
//=> 'FooBar'
pascalcaseKeys({ fooBar: true });
//=> { 'FooBar': true }
pascalcaseKeysDeep({ fooBar: { barFoo: true } });
//=> { 'FooBar': { 'BarFoo': true } }
```

Axios Request Interceptors:

```js
const { onRequest, createRequestInterceptor } = require('messaging-api-common');

// use the default onRequest function
axios.interceptors.request.use(createRequestInterceptor());

// use the custom onRequest function
axios.interceptors.request.use(
  createRequestInterceptor({
    onRequest: (request) => {
      console.log(request);
    },
  })
);
```

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