# pvtsutils

> pvtsutils is a set of common utility functions used in various Peculiar Ventures TypeScript based projects.

Latest version **1.3.6** (published 2024-11-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install pvtsutils
pnpm add pvtsutils
yarn add pvtsutils
bun add pvtsutils
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 1.3.6 |
| Published | 2024-11-22 |
| First published | 2017-02-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 39.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | PeculiarVentures |
| Maintainers | microshine |
| Keywords | typescript, helper, util, convert, hex, utf8, utf16, base64, base64url, binary, assign |

## Links

- npm: https://www.npmjs.com/package/pvtsutils
- Repository: https://github.com/PeculiarVentures/pvtsutils
- Homepage: https://github.com/PeculiarVentures/pvtsutils#readme
- Issues: https://github.com/PeculiarVentures/pvtsutils/issues
- npm.io page: https://npm.io/package/pvtsutils

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^2.8.1

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 1.3.6 (latest) — 2024-11-22
- 1.3.5 — 2023-08-18
- 1.3.4 — 2023-08-16
- 1.3.3 — 2023-08-07
- 1.3.2 — 2022-05-05
- 1.3.1 — 2022-05-04
- 1.3.0 — 2022-05-02
- 1.2.2 — 2022-02-18
- 1.2.1 — 2021-09-28
- 1.2.0 — 2021-07-27
- 1.1.7 — 2021-05-17
- 1.1.6 — 2021-04-29
- 1.1.5 — 2021-04-28
- 1.1.4 — 2021-04-27
- 1.1.3 — 2021-04-26
- … 17 more at https://npm.io/package/pvtsutils/versions

## README

[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
[![Coverage Status](https://coveralls.io/repos/github/PeculiarVentures/pvtsutils/badge.svg?branch=master)](https://coveralls.io/github/PeculiarVentures/pvtsutils?branch=master)
[![Test](https://github.com/PeculiarVentures/pvtsutils/actions/workflows/test.yml/badge.svg)](https://github.com/PeculiarVentures/pvtsutils/actions/workflows/test.yml)

# pvtsutils
pvtsutils is a set of common utility functions used in various Peculiar Ventures TypeScript based projects.

## Install

```
npm install pvtsutils
```

## Using

```javascript
const utils = require("pvtsutils");
```

The `pvtsutils` namespace will always be available globally and also supports AMD loaders.

## Types

There is an [index.d.ts](./index.d.ts) file which makes easy to use current module as external

## Helpers

### Convert

Helps to convert `string` to `ArrayBuffer` and back

Convert support next encoding types `hex`, `utf8`, `binary`, `base64`, `base64url`. `utf8` is default.

#### Examples

Converts string to buffer

```javascript
const buf = Convert.FromString("some string", "hex");
```

Converts buffer to string

```javascript
const str = Convert.ToString(buf, "utf8");
```

### assign

Copies properties from objects to a target object. [More info](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)

#### Example

```javascript
const obj = assign({}, {name: "Bob"}, {age: 12}); // {name: "Bob", age: 12}
```

### isEqual

Returns `true` if 2 ArrayBuffers are equal

### combine

Combines some `ArrayBuffer` values

#### Example

```javascript
const buf1 = new Uint8Array([1, 2, 3]);
const buf2 = new Uint8Array([4, 5, 6]);
const buf = combine(buf1, buf2); // [1, 2, 3, 4, 5, 6]
```

Some example capabilities included in pvtsutils include:

- Converting values to adn from hex,
- Converting values to and from base64,
- Working with base64 url,
- Working with binary data.
- And more...

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