# retarget

> Create selectors for working with redux store data

Latest version **0.0.2** (published 2018-02-20) · MIT license · 0 weekly downloads

## Install

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

## 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.0.2 |
| Published | 2018-02-20 |
| First published | 2018-02-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 23.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 29 |
| Author | Kye Hohenberger |
| Maintainers | tkh44 |
| Keywords | redux, selectors, react-redux |

## Links

- npm: https://www.npmjs.com/package/retarget
- Repository: https://github.com/tkh44/retarget
- Issues: https://github.com/tkh44/retarget/issues
- npm.io page: https://npm.io/package/retarget

## Recent versions

- 0.0.2 (latest) — 2018-02-20
- 0.0.1 — 2018-02-20

## README

#### This is experimental. I would only use it if you are comfortable with breaking changes.

[![npm version](https://badge.fury.io/js/retarget.svg)](https://badge.fury.io/js/retarget)
[![Build Status](https://travis-ci.org/tkh44/retarget.svg?branch=master)](https://travis-ci.org/tkh44/retarget)
[![codecov](https://codecov.io/gh/tkh44/retarget/branch/master/graph/badge.svg)](https://codecov.io/gh/tkh44/retarget)

# retarget

#### selectors via targets


## Install

```bash
npm i retarget -S
```

**or**

```bash
yarn add retarget
```

---

```javascript
import retarget from 'retarget'

const STATE = {
  profile: {
    name: {
      first: 'Waylon',
      last: 'Jennings'
    }
  }
}

const lastNameSelector  = retarget`profile.name.last`

console.log(lastNameSelector(STATE)) // logs "Jennings"

```

## Composing

It is possible to compose multiple selectors together to create a new one.

```javascript
import retarget from 'retarget'

const STATE = {
  users: {
    '1': {
      profile: {
          name: {
            first: 'Waylon',
            last: 'Jennings'
          }
        }
      }
    }
}

const lastNameSelector  = retarget`profile.name.last`

const createUserSelector = (id) =>
  retarget`users.${id}${lastNameSelector}`


const userSelector = createUserSelector(1)

console.log(userSelector(STATE)) // logs "Jennings"

```

## API

#### retarget `function`

```javascript
import retarget from 'retarget'

const selector = retarget`dot.seperated.path.to.value`

const state = {/* Huge object */}
selector(state) // returns the value at "dot.seperated.path.to.value"
```


**Returns**

`retarget` returns a function that when passed an obj, attempts to get the value for the given path.

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