# stringfu

> String utils

Latest version **0.0.10** (published 2019-07-23) · MIT license · 0 weekly downloads

## Install

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

## Health

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

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

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.10 |
| Published | 2019-07-23 |
| First published | 2018-09-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 10.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Peter Roehlen |
| Maintainers | peter.roehlen |
| Keywords | string, utils, library, nodejs, browser |

## Links

- npm: https://www.npmjs.com/package/stringfu
- Repository: https://github.com/proehlen/stringfu
- Homepage: https://github.com/proehlen/stringfu#README.md
- Issues: https://github.com/proehlen/stringfu/issues
- npm.io page: https://npm.io/package/stringfu

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.0.10 (latest) — 2019-07-23
- 0.0.9 — 2019-07-19
- 0.0.8 — 2019-07-19
- 0.0.7 — 2019-07-19
- 0.0.6 — 2019-07-16
- 0.0.5 — 2018-10-23
- 0.0.4 — 2018-10-03
- 0.0.3 — 2018-09-29
- 0.0.2 — 2018-09-28
- 0.0.1 — 2018-09-28

## README

# String Fu

String manipulation and conversion functions including for working with bytes/hex strings.

**Warning**: This sofware is under construction and in pre-alpha state.

## Example usage

```js
import { reverseBytes } from 'stringfu';

console.log(reverseBytes('0FAB03')); // 03AB0F
```

## API

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

#### Table of Contents

-   [leftPad](#leftpad)
    -   [Parameters](#parameters)
-   [rightPad](#rightpad)
    -   [Parameters](#parameters-1)
-   [toBytes](#tobytes)
    -   [Parameters](#parameters-2)
-   [fromBytes](#frombytes)
    -   [Parameters](#parameters-3)
-   [reverseBytes](#reversebytes)
    -   [Parameters](#parameters-4)
-   [containsOnly](#containsonly)
    -   [Parameters](#parameters-5)
-   [isInteger](#isinteger)
    -   [Parameters](#parameters-6)
-   [splitWidth](#splitwidth)
    -   [Parameters](#parameters-7)
-   [isWhitespace](#iswhitespace)
    -   [Parameters](#parameters-8)
-   [isAlphaNumeric](#isalphanumeric)
    -   [Parameters](#parameters-9)

### leftPad

Takes a string and makes it length, left-padded with padChar

#### Parameters

-   `str` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
-   `length` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** 
-   `padChar` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 

### rightPad

Takes a string and makes it length, right-padded with spaces

#### Parameters

-   `str` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 
-   `length` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** 

### toBytes

Takes a hex string and returns Uint8Array of bytes

#### Parameters

-   `str` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 

### fromBytes

Takes an array of bytes and returns them as a string

#### Parameters

-   `bytes` **[Uint8Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array)** 

### reverseBytes

Takes a string of hexadecimal and returns a string with the bytes reversed

#### Parameters

-   `str` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** 

### containsOnly

Returns true if string only contains nominated chars

#### Parameters

-   `str` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** String to check
-   `chars` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** Chars to test with

### isInteger

Returns true if string represents an integer number

#### Parameters

-   `str` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** String to check

### splitWidth

Return a string as an array split at lineWidth chars

#### Parameters

-   `str` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** String to check
-   `lineWidth` **[number](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number)** Make lines this width

Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** Array of strings

### isWhitespace

Checks if string contains only whitespace characters

#### Parameters

-   `str` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** String to check

Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** True/false

### isAlphaNumeric

Checks if string contains only alphanumeric characters

#### Parameters

-   `str` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** String to check

Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** True if only alphanumeric

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