# inidot

> Get, set, or delete a property from a nested object using a dot path

Latest version **1.0.0-rc.2** (published 2024-02-19) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0-rc.2 |
| Published | 2024-02-19 |
| First published | 2024-02-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 11.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Karim Amahtil |
| Maintainers | inicontent |
| Keywords | inibase, object, dot, bracket, notation, nested, path, parse, string, json |

## Links

- npm: https://www.npmjs.com/package/inidot
- Repository: https://github.com/inicontent/inidot
- Homepage: https://github.com/inicontent/inidot#readme
- Issues: https://github.com/inicontent/inidot/issues
- Funding: https://github.com/sponsors/inicontent
- npm.io page: https://npm.io/package/inidot

## 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

- 1.0.0-rc.2 (latest) — 2024-02-19
- 1.0.0-rc.1 — 2024-02-12

## README

[![Inidot banner](./.github/assets/banner.jpg)](https://github.com/inicontent/inidot)

# Inidot :pencil:

[![npmjs](https://img.shields.io/npm/dm/inidot.svg?style=flat)](https://www.npmjs.org/package/inidot) [![License](https://img.shields.io/github/license/inicontent/inidot.svg?style=flat&colorA=18181B&colorB=28CF8D)](./LICENSE) [![Activity](https://img.shields.io/github/commit-activity/m/inicontent/inidot)](https://github.com/inicontent/inidot/pulse) [![GitHub stars](https://img.shields.io/github/stars/inicontent/inidot?style=social)](https://github.com/inicontent/inidot)

> Get, set, or delete a property from a nested object using a dot path :fire:

## Features

- **Lightweight** 🪶
- **Minimalist** :white_circle: (but powerful)
- **TypeScript** :large_blue_diamond:
- **Super-Fast** :zap:
- **Suitable for large data** :page_with_curl:
- **Safe** :lock:
- **Easy to use** :bread:
- **...** and much more :rocket:

## Usage

```js
import Inidot from "inidot";
// or
import {
  toDotNotation,
  getProperty,
  setProperty,
  deleteProperty,
  hasProperty
} from "inidot";

const myObj = {
  name: "Jo,hn",
  age: 21,
  address: {
    city: "New York",
    zip: 65221,
  },
  hobbies: ["Reading", "Tra[veling", ["test", "test2", { test: true }]],
};

// Get Property by path
Inidot.getProperty(myObj, "address.city");
// New York

// Get Unexisted Property by path
Inidot.getProperty(myObj, "address.country");
// undefined

// Define a default value
Inidot.getProperty(myObj, "address.city", "Morocco");
// Morocco
```

### Selector Examples

```
- `obj.value` => `['obj', 'value']`
- `obj.ary.0.value` => `['obj', 'ary', '0', 'value']`
- `obj.ary.0.va\\.lue` => `['obj', 'ary', '0', 'va.lue']`
- `obj.ary.*.value` => `['obj', 'ary', '*', 'value']`
```

If you like Inidot, please sponsor: [GitHub Sponsors](https://github.com/sponsors/inicontent) || [Paypal](https://paypal.me/KarimAmahtil).

## Install

```js
<npm|pnpm|yarn> install inidot
```

## License

[MIT](./LICENSE)

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