# obtener

> Safely and Easily Obtain Nested Object Property Values

Latest version **0.0.1** (published 2022-02-18) · CC0-1.0 license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2022-02-18 |
| First published | 2022-02-18 |
| Weekly downloads | 0 |
| License | CC0-1.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 11.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Daniel J. Dufour |
| Maintainers | danieljdufour |
| Keywords | access, dot, get, key, nested, object, obtain, notation, path, paths, prop, property, properties, value, values |

## Links

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

## 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.0.1 (latest) — 2022-02-18

## README

# obtener
Safely and Easily Access Nested Object Property Values

## why obtener
"obtener" is Spanish for "to obtain".


## demo
http://danieljdufour.com/obtener/

## install
```html
<script src="https://unpkg.com/obtener"></script>
```
or
```js
import { get } from "obtener";
```

## basic usage
```html
data = {
  "agency": "GSA",
  "measurementType": {
    "method": "modules"
  },
  "version": "2.0.0",
  "releases": [
    {
      "name": "usasearch",
      "description": "System now maintained in open repo https://github.com/GSA/search-gov.",
      "permissions": {
        "licenses": null,
        "usageType": "governmentWideReuse"
      },
      "tags": [
        "GSA"
      ]
    },
    // ...
  }
}
```

```js
get(data, 'agency');
["GSA"]

// get nested properties using dot syntax
get(data, 'releases.permissions.licenses.name');
["CC0 1.0 Universal", "PD", "agpl-3.0", ... ]

// get nested properties using double underscore syntax
get(data, 'releases__permissions__licenses__name');
["CC0 1.0 Universal", "PD", "agpl-3.0", ... ]
```

# advanced usage
## unique
If you only want unique results returned:
```js
// default
get(data, 'releases.tags');
["GSA", "GSA", "GSA", ...]

// uniques only
get(data, 'releases.tags', { unique: true });
["GSA","gsa","socialmedia", "mobileapps", ...]
```

## sort
If you want your results sorted
```js
get(data, 'releases.tags', { sort: true });
["508", "API", "Bing", "DigitalGovSearch", ...]
```

## separator
By default, obtener tries syntax where the steps are separted by 
`"."` or `"__"`.  If you'd like to restrict the syntax or use a custom separator:
```js
get(data, 'releases--tags', { sep: '--' });

// accepts releases--tags and releases__tags
get(data, 'releases--tags', { sep: ['--', '__'] });
```

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