# @kenote/common

> Based on @kenote common methods and types.

Latest version **1.0.51** (published 2025-01-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install @kenote/common
pnpm add @kenote/common
yarn add @kenote/common
bun add @kenote/common
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

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

Warnings: low downloads; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.51 |
| Published | 2025-01-16 |
| First published | 2020-12-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=8.16.0 |
| Dependencies | 14 |
| Unpacked size | 90.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | thondery |
| Maintainers | thondery |
| Keywords | common, kenote.js |

## Links

- npm: https://www.npmjs.com/package/@kenote/common
- Repository: https://github.com/kenote/kenote.js
- Homepage: https://github.com/kenote/kenote.js#readme
- Issues: https://github.com/kenote/kenote.js/issues
- npm.io page: https://npm.io/package/@kenote/common

## Dependencies (14)

- [bytes](https://npm.io/package/bytes.md) ^3.1.2
- [dayjs](https://npm.io/package/dayjs.md) ^1.11.5
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [crypto-js](https://npm.io/package/crypto-js.md) ^4.1.1
- [url-parse](https://npm.io/package/url-parse.md) ^1.5.9
- [file-saver](https://npm.io/package/file-saver.md) ^2.0.5
- [@types/bytes](https://npm.io/package/@types/bytes.md) ^3.1.1
- [parse-string](https://npm.io/package/parse-string.md) ^1.2.5
- [query-string](https://npm.io/package/query-string.md) ^6.14.1
- [@types/lodash](https://npm.io/package/@types/lodash.md) ^4.14.183
- [rule-judgment](https://npm.io/package/rule-judgment.md) ^1.1.5
- [@types/crypto-js](https://npm.io/package/@types/crypto-js.md) ^4.1.1
- [@types/url-parse](https://npm.io/package/@types/url-parse.md) ^1.4.8
- [@types/file-saver](https://npm.io/package/@types/file-saver.md) ^2.0.5

## Alternatives

- [@mdxeditor/editor](https://npm.io/package/@mdxeditor/editor.md) — 962.4K weekly downloads
- [mmdb-lib](https://npm.io/package/mmdb-lib.md) — 680.9K weekly downloads
- [playcanvas](https://npm.io/package/playcanvas.md) — 36.2K weekly downloads
- [@glw907/cairn-cms](https://npm.io/package/@glw907/cairn-cms.md) — 967 weekly downloads
- [markdown-to-confluence](https://npm.io/package/markdown-to-confluence.md) — 103 weekly downloads

## Recent versions

- 1.0.51 (latest) — 2025-01-16
- 1.0.50 — 2023-08-25
- 1.0.49 — 2023-08-17
- 1.0.48 — 2023-08-16
- 1.0.40 — 2022-08-18
- 1.0.33 — 2022-03-07
- 1.0.32 — 2022-02-23
- 1.0.31 — 2022-02-18
- 1.0.30 — 2021-11-23
- 1.0.27 — 2021-08-04
- 1.0.21 — 2021-03-29
- 1.0.20 — 2021-03-29
- 1.0.19 — 2021-03-11
- 1.0.12 — 2021-01-22
- 1.0.11 — 2021-01-21
- … 1 more at https://npm.io/package/@kenote/common/versions

## README

# @kenote/common

Based on `@kenote` common methods and types.

[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![Gratipay][licensed-image]][licensed-url]

[npm-image]: https://img.shields.io/npm/v/@kenote/common.svg
[npm-url]: https://www.npmjs.com/package/@kenote/common
[downloads-image]: https://img.shields.io/npm/dm/@kenote/common.svg
[downloads-url]: https://www.npmjs.com/package/@kenote/common
[licensed-image]: https://img.shields.io/badge/license-MIT-blue.svg
[licensed-url]: https://github.com/kenote/kenote.js/blob/main/LICENSE

## CommonEngine

```ts
import { CommonEngine } from '@kenote/common'
import express, { Express } from 'express'
import { RequestListener } from 'http'

export class ServiceEngine extends CommonEngine<Express> {

  constructor (options?: any) {
    super()
    this.__application = express()
  }

  get name (): string {
    return 'express'
  }

  get server (): RequestListener {
    return this.__application
  }
}
```

## HttpClient

```ts
import { HttpClient, xhrClient } from '@kenote/common'

// Axios
const client: ClientInstance = axios
// XMLHttpRequest
const client: ClientInstance = xhrClient(new XMLHttpRequest())

const httpClient = (options?: HeaderOptions) => new HttpClient(client, options)

async function start () {
  // Send Get
  await httpClient().get(url, params)
  // Send Post
  await httpClient().post(url, body)
  // Download
  await httpClient().download(url)
  // Upload
  await httpClient().upload(url)
}
```

## DataNodeProxy

```ts
import { dataNodeProxy, CommonDataNode } from '@kenote/common'

const data: CommonDataNode[] = [
  {
    key: '1',
    name: 'home'
  }
]

const dataProxy = dataNodeProxy(data)
// Find Single Node
let node = dataProxy.find({ name: 'home' })
console.log( node )
// Add Single Node
dataProxy.add(null, { key: '2', name: 'aaa' })
dataProxy.add('1', { key: '3', name: 'bbb' })
// Update Single Node
dataProxy.update('1', { name: 'ccc' })
// Remove Single Node
dataProxy.remove('1')
// Get Changed Data
console.log( dataProxy.data )
```

---
MIT License.

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