# @lindorm-io/core

> Core utilities and files for lindorm.io

Latest version **0.8.11** (published 2023-04-01) · AGPL-3.0-or-later license · 0 weekly downloads

## Install

```sh
npm install @lindorm-io/core
pnpm add @lindorm-io/core
yarn add @lindorm-io/core
bun add @lindorm-io/core
```

## 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.8.11 |
| Published | 2023-04-01 |
| First published | 2020-10-31 |
| Weekly downloads | 0 |
| License | AGPL-3.0-or-later |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 29.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | princejonn |

## Links

- npm: https://www.npmjs.com/package/@lindorm-io/core
- npm.io page: https://npm.io/package/@lindorm-io/core

## Recent versions

- 0.8.11 (latest) — 2023-04-01
- 0.8.10 — 2023-03-30
- 0.8.9 — 2023-03-26
- 0.8.8 — 2023-03-01
- 0.8.7 — 2023-02-02
- 0.8.6 — 2023-01-15
- 0.8.5 — 2023-01-15
- 0.8.4 — 2023-01-13
- 0.8.3 — 2023-01-13
- 0.8.2 — 2023-01-12
- 0.8.1 — 2023-01-05
- 0.8.0 — 2023-01-04
- 0.7.1 — 2022-11-05
- 0.7.0 — 2022-09-07
- 0.6.3 — 2022-06-26
- … 33 more at https://npm.io/package/@lindorm-io/core/versions

## README

# @lindorm-io/core

Core utilities and files for lindorm.io packages

## Installation

```shell script
npm install --save @lindorm-io/core
```

## Utilities

### base64

Fully unnecessary but quick utility to make base64 parsing a bit easier so that you don't have to remember.

```typescript
baseHash("string"); // -> "c3RyaW5n"
baseParse("c3RyaW5n"); // -> "string"
```

### case switch

Extending some of the lodash case switching functions to also include arrays and records.

```typescript
camelCase("snake_case"); // -> "snakeCase"
camelArray(["snake_case", "PascalCase"]); // -> ["snakeCase, pascalCase"]
camelKeys<Input, Output>({ snake_key: 123, PascalKey: true }); // -> { snakeKey: 123, pascalKey: true }

pascalCase("camelCase"); // -> "CamelCase"
pascalArray(["snake_case", "camelCase"]); // -> ["SnakeCase, CamelCase"]
pascalKeys<Input, Output>({ snake_key: 123, camelKey: true }); // -> { SnakeKey: 123, CamelKey: true }

pascalCase("PascalCase"); // -> "pascal_case"
pascalArray(["PascalCase", "camelCase"]); // -> ["pascal_case, camel_case"]
pascalKeys<Input, Output>({ PascalKey: 123, camelKey: true }); // -> { pascal_key: 123, camel_key: true }
```

### random value

```typescript
getRandomValue(12); // -> "rOjLkjjLFS2A"
getRandomNumber(6); // -> 703976
```

### sort object keys

```typescript
sortObjectKeys({ x: 3, a: 1, m: 2 }); // -> { a: 1, m: 2, x: 3 }
```

### strict typing

Extending some of the lodash typing to be stricter.

```typescript
isArrayStrict(["array"]); // -> true
isArrayStrict("string"); // -> false

isObjectStrict({ object: true }); // -> true
isObjectStrict(["array"]); // -> false
isObjectStrict(new Date()); // -> false
isObjectStrict(new Error()); // -> false
```

### string comparison

Timing safe string comparison. A stricter and safer comparison utility.

```typescript
stringComparison("string", "string"); // -> true
```

### string to time

Generating time data from strings. Useful for date-fns which can take duration objects

```typescript
stringToDurationObject("2 years 5 months"); // -> { years: 2, months: 5 }
stringToMilliseconds("12 seconds"); // -> 12000
stringToSeconds("5 minutes"); // -> 300000
```

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