# fliphub-resolve

> resolve objects, arrays, strings, to app, monorepo, or custom scopes

Latest version **0.0.12** (published 2017-04-13) · 0 weekly downloads

## Install

```sh
npm install fliphub-resolve
pnpm add fliphub-resolve
yarn add fliphub-resolve
bun add fliphub-resolve
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.12 |
| Published | 2017-04-13 |
| First published | 2017-03-16 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 30 |
| Author | James |
| Maintainers | aretecode |
| Keywords | helpers, utils, debugging, fliphub, flipbox |

## Links

- npm: https://www.npmjs.com/package/fliphub-resolve
- Repository: https://github.com/fliphub/fliphub
- Homepage: https://github.com/fliphub/fliphub#readme
- Issues: https://github.com/fliphub/fliphub/issues
- npm.io page: https://npm.io/package/fliphub-resolve

## Dependencies (6)

- [izz](https://npm.io/package/izz.md) *
- [fliplog](https://npm.io/package/fliplog.md) *
- [flipfile](https://npm.io/package/flipfile.md) *
- [fliptime](https://npm.io/package/fliptime.md) *
- [mono-root](https://npm.io/package/mono-root.md) *
- [deep-replace](https://npm.io/package/deep-replace.md) *

## Alternatives

- [lodash.assign](https://npm.io/package/lodash.assign.md) — 2.3M weekly downloads
- [lodash.chunk](https://npm.io/package/lodash.chunk.md) — 1.8M weekly downloads
- [react-native-ios-utilities](https://npm.io/package/react-native-ios-utilities.md) — 138.5K weekly downloads
- [@technically/lodash](https://npm.io/package/@technically/lodash.md) — 50.9K weekly downloads
- [@fluid-topics/ft-icon](https://npm.io/package/@fluid-topics/ft-icon.md) — 20.6K weekly downloads

## Recent versions

- 0.0.12 (latest) — 2017-04-13
- 0.0.11 — 2017-04-06
- 0.0.10 — 2017-03-26
- 0.0.9 — 2017-03-26
- 0.0.8 — 2017-03-23
- 0.0.7 — 2017-03-23
- 0.0.6 — 2017-03-16
- 0.0.5 — 2017-03-16
- 0.0.4 — 2017-03-16
- 0.0.1 — 2017-03-16

## README

# 🎯 fliphub-resolve

[![NPM version][fliphub-resolve-npm-image]][fliphub-resolve-npm-url]
[![MIT License][license-image]][license-url]
[![fliphub][gitter-badge]][gitter-url]
[![flipfam][flipfam-image]][flipfam-url]

[fliphub-resolve-npm-image]: https://img.shields.io/npm/v/fliphub-resolve.svg
[fliphub-resolve-npm-url]: https://npmjs.org/package/fliphub-resolve
[license-image]: http://img.shields.io/badge/license-MIT-blue.svg?style=flat
[license-url]: https://spdx.org/licenses/MIT
[gitter-badge]: https://img.shields.io/gitter/room/fliphub/pink.svg
[gitter-url]: https://gitter.im/fliphub/Lobby
[flipfam-image]: https://img.shields.io/badge/%F0%9F%8F%97%20%F0%9F%92%A0-flipfam-9659F7.svg
[flipfam-url]: https://www.npmjs.com/package/flipfam

## 📦 usage
```bash
yarn add fliphub-resolve
npm i fliphub-resolve --save
```


- if it's a monorepo package, it will default resolve relative to the monorepo root
- otherwise, it will default resolve relative to the the package root
- the root can be set once, and all other resolving using it will default to that root
- the root can be set for multiple scopes

### [flipfile](https://www.npmjs.com/package/flipfile) used to detect
### [🥕 mono-root](https://www.npmjs.com/package/mono-root) to find root


```js
const resolve = require('fliphub-resolve')
resolve('./path-from-root')
```

## 📘 examples

## scope

```js
// resolve all with this scope
const localResolver = resolve.scoped('local', __dirname)

// default is monorepo
const monoResolver = resolve.scoped('mono')

// how many folders to check up
const appResolver = resolve.scoped('app').setRoot(1)
```

- a `number` can be passed for shorthand `depth`

## obj
- forProps, fn

```js
const obj = {
  fixtures: './fixtures',
  simple: './fixtures/somePath',
  simplejs: './fixtures/somePath.js',
}

// all properties resolved to absolute paths, if they are relative
const resolvedObj = resolve.obj(obj)
```


## arr
- resolves objects, arrays, with multiple scopes.

```js
const arr = ['./fixtures', './fixtures/somePath']

// all relative strings in the array are resolved
const resolvedArr = resolver.arr(arr)
```

## auto

```js
const arr = ['./fixtures', './fixtures/somePath']
const obj = {
  fixtures: './fixtures',
  simple: './fixtures/somePath',
  simplejs: './fixtures/somePath.js',
}

// will auto-resolve based on type
const resolvedArr = resolver(arr)
const resolvedObj = resolve(obj)
```

## resolve-scoped

```js
// or resolve with a scope
const apps = resolve.scope('app')('./eh.js')
const monos = resolve.scope('mono')('./eh.js')
const locals = resolve.scope('app')(arr)
```

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