# path-notation

> A dot-notation based path string which yields key literals, allows for the inclusion of the "."character in keys and square bracket notation in path strings, promotes readability of path strings and provides other useful utilities for reasoning and workin

Latest version **2.1.0** (published 2019-10-09) · ISC license · 0 weekly downloads

## Install

```sh
npm install path-notation
pnpm add path-notation
yarn add path-notation
bun add path-notation
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2019-10-09 |
| First published | 2019-09-09 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 773.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Michael Price |
| Maintainers | mikepricedev |
| Keywords | Javascript, JSON, object, path, dot-notation |

## Links

- npm: https://www.npmjs.com/package/path-notation
- Repository: https://github.com/mikepricedev/pathNotation
- Homepage: https://github.com/mikepricedev/pathNotation#readme
- Issues: https://github.com/mikepricedev/pathNotation/issues
- npm.io page: https://npm.io/package/path-notation

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 2.1.0 (latest) — 2019-10-09
- 2.0.1 — 2019-10-07
- 2.0.0 — 2019-09-26
- 1.0.0 — 2019-09-09

## README

# PathNotation
A dot-notation based path string which yields key literals, allows
for the inclusion of the "." character in keys and square bracket notation 
in path strings, promotes readability of path strings and provides other 
useful utilities for reasoning and working with objects paths.

## Example:
```
import PathNotation from 'path-notation';

const path = new PathNotation('foo', 'bar', 2, '10','baz\\.qux');

console.log(`Path notation string: ${path}`); 
// Path notation string: foo.bar[2].10[baz.qux]

console.log(`Number of keys in the path: ${path.length}`);
// Number of keys in the path: 5

console.log(`First key in the path: ${path.firstKey}`);
// First key in the path: foo

console.log(`Last key in the path: ${path.lastKey}`);
// Last key in the path: baz.qux

// Create a PathNotation instance from a path notation string.
const pathStr = new PathNotation('foo.bar[2].10[baz.qux]');

console.log('\nKeys')
for(const key of pathStr) {
  console.log(`  Key: ${key}; Type ${typeof key}`);
}
// Keys
//   Key: foo; Type string
//   Key: bar; Type string
//   Key: 2; Type number
//   Key: 10; Type string
//   Key: baz.qux; Type string
```

#
Full [docs](https://mikepricedev.github.io/pathNotation/ "PathNotation Documentation").

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