# @flexent/pointer

> Simple Object Get/Set via JSON Pointer or dot-delimited formats

Latest version **2.16.1** (published 2026-08-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install @flexent/pointer
pnpm add @flexent/pointer
yarn add @flexent/pointer
bun add @flexent/pointer
```

## Health

**Score 60/100 (C)** — status: active.

Positive: esm support; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 2.16.1 |
| Published | 2026-08-27 |
| First published | 2022-10-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 0 |
| Unpacked size | 18.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Boris Okunskiy |
| Maintainers | inca |

## Links

- npm: https://www.npmjs.com/package/@flexent/pointer
- npm.io page: https://npm.io/package/@flexent/pointer

## Recent versions

- 2.16.1 (latest) — 2026-08-27
- 2.16.0 — 2026-08-10
- 2.15.1 — 2026-08-08
- 2.15.0 — 2026-08-03
- 2.14.1 — 2026-08-03
- 2.14.0 — 2026-07-10
- 2.12.0 — 2026-07-10
- 2.11.0 — 2026-07-09
- 2.10.0 — 2026-06-30
- 2.9.5 — 2026-06-23
- 2.9.4 — 2026-06-18
- 2.9.3 — 2026-06-18
- 2.9.1 — 2026-06-18
- 2.9.0 — 2026-06-18
- 2.8.0 — 2026-06-17
- … 18 more at https://npm.io/package/@flexent/pointer/versions

## README

# Pointer

Simple library for getting and setting object values via [JSON Pointer](https://www.rfc-editor.org/rfc/rfc6901.html) or dot-delimited formats.

## Highlights

- 🔥 Zero dependencies
- 💻 Works in browser
- 🗜 Tidy and compact, only ~500 bytes minified uncompressed
- ⚡️ Blazing fast

## Usage

```ts
import * as pointer from '@flexent/pointer';

const object = {
    foo: {
        items: [
            { bar: 'one' },
            { bar: 'two' },
            { bar: 'three' },
        ]
    }
};

// If pointer starts with /, then it's interpreted
// as RFC6901 compliant JSON Pointer
pointer.get(object, '/foo/items/1/bar'); // 'two'

// Otherwise it's a dot-delimited path
pointer.get(object, 'foo.items.0'); // { bar: 'one' }

// Set modifies the object, creating additional objects and arrays as needed
const newObj = {}
pointer.set(newObj, 'foo.items.0.bar', '123');
// newObj is now { foo: { items: [{ bar: '123' }] } }
```

## Spec

Pointer aims to implement all the features from [RFC6901](https://www.rfc-editor.org/rfc/rfc6901.html) whilst also extending it to provide the following features:

1. Dot-delimited paths:

    ```ts
    get({ foo: { bar: { baz: 123 }}}, 'foo.bar.baz')
    // 123
    ```

2. Wildcard syntax to access array content:

    ```ts
    // Single level
    get({
        users: [
            { name: 'Joe' },
            { name: 'Jane' },
        ]
    }, 'users.*.name');
    // ['Joe', 'Jane']

    // Multiple levels
    get({
        items: [
            {
                tags: [{ value: 1 }, { value: 2 }],
            },
            {
                tags: [{ value: 3 }],
            },
        ]
    }, 'items.*.tags.*.value');
    // [ [ 1, 2 ], [ 3 ] ]
    ```

3. Push values into array:

    ```ts
    const obj = {};
    set(obj, '/items/-', 'foo');
    // { items: ['foo' ] }
    ```

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