# dotpath-resolve

> Dot-path based object property selector

Latest version **0.1.3** (published 2014-11-26) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

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

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2014-11-26 |
| First published | 2014-09-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Aleksandr Tsertkov |
| Maintainers | tsertkov |
| Keywords | walk, traverse, dotpath, dot-path, resolve, object, selector |

## Links

- npm: https://www.npmjs.com/package/dotpath-resolve
- Repository: git@github.com:tsertkov/dotpath-resolve
- Homepage: https://github.com/tsertkov/dotpath-resolve
- Issues: https://github.com/tsertkov/dotpath-resolve/issues
- npm.io page: https://npm.io/package/dotpath-resolve

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 0.1.3 (latest) — 2014-11-26
- 0.1.2 — 2014-11-24
- 0.1.1 — 2014-11-23
- 0.1.0 — 2014-11-21
- 0.0.2 — 2014-09-23

## README

# dotpath-resolve

[![NPM](https://nodei.co/npm/dotpath-resolve.png)](https://nodei.co/npm/dotpath-resolve/)

[![Build Status](https://travis-ci.org/tsertkov/dotpath-resolve.svg?branch=master)](https://travis-ci.org/tsertkov/dotpath-resolve)
[![Coverage Status](https://img.shields.io/coveralls/tsertkov/dotpath-resolve.svg)](https://coveralls.io/r/tsertkov/dotpath-resolve?branch=master)

> Dot-path based object property selector.

## Features

- dot-path object traversal
- array traversal
- reverse traversal

## Usage

All possible use cases are described in [test code](https://github.com/tsertkov/dotpath-resolve/blob/master/test/resolve.js).

```javascript
var resolve = require('dotpath-resolve');

// object to be searched
var obj = {
  k1: {
    k11: 'k11',
    k2: 'k1.k2',
    k3: [1, 2, 3]
  },
  k2: 'k2'
};

resolve(obj, 'k2');       // k2
resolve(obj, 'k1.k11');   // k11
resolve(obj, 'k2', 'k1'); // k1.k2
resolve(obj, 'k1.k3.1');  // 2
resolve(obj, 'missing');  // undefined
resolve(obj, 'k2', 'k1.k3.0.missing'); // k1.k2
```

## Public API

### resolve(obj, selector, [startSelector])

Search given object using dotpath selector and optionally start selector.

**Parameters:**

- *obj* {Object|Array} - Object to be searched
- *selector* {String} - Dotpath selector
- [*startSelector*] {String} - Optional search start selector

**Return Values:**

Returns a value of `obj` key specified by given `selector` or `undefined` if a key was not found.

## Private API

Complete API Documentation including private and public methods is generated from source code by JSDoc tool and is [available here](https://s3.eu-central-1.amazonaws.com/tsertkov-artifacts/dotpath-resolve/master/jsdoc/index.html).

## Code coverage

Code coverage report for all files is [available here](https://s3.eu-central-1.amazonaws.com/tsertkov-artifacts/dotpath-resolve/master/coverage/lcov-report/index.html).

## Scripts

- `npm test` - run tests
- `npm run jsdoc` - build jsdoc
- `npm run dev` - run tests continuously

## License

The MIT License (MIT)

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