# l-safeset

> get a nested value from an object by paths (`a.b.c` or ['a','b','c'])

Latest version **0.0.1** (published 2018-01-04) · ISC license · 0 weekly downloads

## Install

```sh
npm install l-safeset
pnpm add l-safeset
yarn add l-safeset
bun add l-safeset
```

## 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 | 2018-01-04 |
| First published | 2018-01-04 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | julylb |
| Maintainers | julylb |
| Keywords | safeSet |

## Links

- npm: https://www.npmjs.com/package/l-safeset
- Repository: https://github.com/julyL/safeSet
- Homepage: https://github.com/julyL/safeSet#readme
- Issues: https://github.com/julyL/safeSet/issues
- npm.io page: https://npm.io/package/l-safeset

## Recent versions

- 0.0.1 (latest) — 2018-01-04

## README

### safeSet(obj,path,value)
> set the value by the path in obj , if can not set value in obj through path, will auto create {} or []

### Install
```
npm install l-safeset -S
```
### Usage
```js

var safeget = require("l-safeset");

// when the path can not set value, will create {} (or [])
safeSet({ b: 1 }, 'b.1', 2) 
// the same as 
safeSet({ b: 1 }, ['b',1], 2)


// will create [],if path match [num]
safeSet({ b: 1 }, 'b[1]', 2)  => // { b: [, 2] }
// the same as 
safeSet({ b: 1 }, ['b','[1]'], 2)
```

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