# for-util

> ### Motivation

Latest version **1.2.5** (published 2022-08-14) · 0 weekly downloads

## Install

```sh
npm install for-util
pnpm add for-util
yarn add for-util
bun add for-util
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.5 |
| Published | 2022-08-14 |
| First published | 2022-02-06 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 96.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Luke Zirngibl |
| Maintainers | lukaszirngibl |

## Links

- npm: https://www.npmjs.com/package/for-util
- npm.io page: https://npm.io/package/for-util

## Dependencies (4)

- [reselect](https://npm.io/package/reselect.md) ^4.0.0
- [redux-saga](https://npm.io/package/redux-saga.md) 1.0.2
- [typelevel-ts](https://npm.io/package/typelevel-ts.md) ^0.4.0
- [@devexperts/remote-data-ts](https://npm.io/package/@devexperts/remote-data-ts.md) 0.6.0

## Recent versions

- 1.2.5 (latest) — 2022-08-14
- 1.2.4 — 2022-06-15
- 1.2.3 — 2022-06-15
- 1.2.2 — 2022-05-23
- 1.2.0 — 2022-05-21
- 1.1.0 — 2022-05-21
- 1.0.5 — 2022-05-21
- 1.0.3 — 2022-03-28
- 1.0.2 — 2022-03-08
- 1.0.1 — 2022-03-01
- 1.0.0 — 2022-02-06

## README

# Utility Functions and HOC Guard

### Motivation

Just a little library that provides some useful functions and a cool data guard pattern HOC.

### Install

```
yarn add frr-util reselect react react-redux
```
```
npm install frr-util reselect react react-redux
```

### Guard Pattern

```ts

import { createGuard } from 'frr-util/lib/guards'

type UserGuardedProps = { user: { name: string } }

// userAsOptionSelector is selector that selects Option<{ user: { name: string } }> from the redux store
const userGuard = createGuard<UserGuardedProps>(userAsOptionSelector)

const Page = (props: UserGuardedProps) => {
  return (
    <div>
      {props.user.name}
    </div>
  )
}


const Guarded = userGuard(Page)

export { Guarded as Page } 

```

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