# objnav

> create fast getters and setters for deep obj traversal

Latest version **1.0.2** (published 2015-06-01) · MIT license · 0 weekly downloads

## Install

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

## 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 | 1.0.2 |
| Published | 2015-06-01 |
| First published | 2015-06-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Gaetano Checinski |
| Maintainers | nikhedonia |
| Keywords | getter, setter, object, traversal |

## Links

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

## Recent versions

- 1.0.2 (latest) — 2015-06-01
- 1.0.1 — 2015-06-01

## README

# objnav
create fast getters and setters for deep obj traversal.

objnav creates, compiles and caches appropiate getter/setter functions by using 'Function'

# examples

```js

var objnav = require('objnav');

var obj={
  a:[0,{b:42}]
};

var N = objnav(['a',1,'b']); 

N.get(obj); // returns 42 
N.set(obj,5); // returns 5; N.get(obj) == 5

//lazy getter/setter

N(obj); // returns 5;
N(obj,6); returns 6; T.get(obj) is now 6

// more functions:
N.unset(obj) // unsets obj['a'][1]['b']

// secure[exception safe] operations
N.sGet(obj,42) // returns N.get(obj) when no error occurs otherwise 42; 
N.sSet(obj,42) // returns value which has been set otherwise null is returned
N.sUnset(obj)  // returns 1 if unset was successfull otherwise 0

//traversal

N.chain([1]).get(obj); // accesses obj['a'][1]['b'][1]  
N.parent().get(obj); // accesses obj['a'][1];


// templates :

var N2 = objnav(['a','$x','$y']); // threads $<str> as placeholder

N2.bind({x:1,y:'b'})(obj); // works the same way with get/set/ etc...


// cache

N.cache // raw access
N.clearCache() // self explanatory 


```

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