# @monteway/utils

> Common utilities for Monterail projects

Latest version **0.4.2** (published 2023-04-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install @monteway/utils
pnpm add @monteway/utils
yarn add @monteway/utils
bun add @monteway/utils
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.4.2 |
| Published | 2023-04-27 |
| First published | 2022-06-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | ^18.12.1 \|\| ^16.16 |
| Dependencies | 1 |
| Unpacked size | 5.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Monterail |
| Maintainers | jedrzejginter |
| Keywords | monterail, monteway |

## Links

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

## Dependencies (1)

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

## Recent versions

- 0.4.2 (latest) — 2023-04-27
- 0.4.1-rc.1 (next) — 2023-04-27
- 0.0.25-cjs.2 (cjs) — 2022-07-01
- 0.0.25-esm.2 (esm) — 2022-07-01
- 0.4.1 — 2023-04-27
- 0.4.0 — 2023-03-31
- 0.4.0-rc.2 — 2023-03-31
- 0.4.0-rc.1 — 2023-03-30
- 0.3.2 — 2023-03-16
- 0.3.2-rc.1 — 2023-03-16
- 0.3.1 — 2022-12-12
- 0.3.0 — 2022-12-02
- 0.3.0-rc.1 — 2022-12-02
- 0.2.0 — 2022-12-02
- 0.2.0-rc.6 — 2022-12-02
- … 58 more at https://npm.io/package/@monteway/utils/versions

## README

# @monteway/utils

Tiny but useful utilities.

## Install

```bash
npm i @monteway/utils
```

## Usage

### `trimMultiline`

- Trims useless spaces from the beginning of each line.
- Removes empty new lines at the beginning and end of the input.
- Keeps the identation pattern.

#### Example

```ts
import { trimMultiline } from '@monteway/utils/format';

const code = `
  function foo() {
    return bar;
  }
`;

const output = trimMultiline(code);
```

- If we do `console.log(code)`, the result will be:

  ```
    function foo() {
      return bar;
    }
  ```

- If we do `console.log(output)`, the result will be different by trimming the trailing, useless spaces:

  ```
  function foo() {
    return bar;
  }
  ```

  > This shows, that `trimMultiline` acts a little bit like Prettier.

#### Options

As a second, optional arguments we might pass an object:

```ts
{
  // Make sure the miniam identation is this number of spaces.
  indentBy?: number;

  // Keep a single new line at the beginning of the output (since by default it's removed).
  startWithNewLine?: boolean;
}
```

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