# querymap

> use query string to map one object or array into another object or array

Latest version **1.0.3** (published 2019-01-22) · ISC license · 0 weekly downloads

## Install

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

## 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.3 |
| Published | 2019-01-22 |
| First published | 2018-08-02 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | qingming.jiang |
| Maintainers | qingming.jiang |

## Links

- npm: https://www.npmjs.com/package/querymap
- npm.io page: https://npm.io/package/querymap

## Recent versions

- 1.0.3 (latest) — 2019-01-22
- 1.0.2 — 2018-08-02
- 1.0.1 — 2018-08-02
- 1.0.0 — 2018-08-02

## README

use query string to map one object or array into another object or array

useage:

```
import { queryMap } from 'querymap';

let source = [{ a: 1, b: { c: { d: 2 } } }];
let dest = queryMap(source, 'a as m, b.c.d as n, "string" as l');

console.log(dest); //  { m: 1, n: 2, l: 'string' } ]

source = { a: [1, 2, 3] };
dest = queryMap(source, 'a as m', function(item) {
  item.m = item.m.map((i) => i * 2);
  return item;
});

console.log(dest); // { m: [ 2, 4, 6 ] }

source = [{ a: 1, b: { c: { d: 2 } } }];
dest = queryMap(source, 'a as m, b.c.d, "string" as l');

console.log(dest); // [ { m: 1, d: 2, l: 'string' } ]

source = [{ a: 1, b: { c: { d: 2 } }, k: 1, q: 'good' }];
dest = queryMap(source, 'a as m, b.c.d, "string" as l, ...'); // ... means rest

console.log(dest); // [ { m: 1, d: 2, l: 'string', k: 1, q: 'good' } ]

```

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