Registry / database / qlmapper

qlmapper

JSON →
library1.1.2jsnpmunverified

QLMapper (v1.1.2) generates nested objects from SQL query result rows by grouping columns with a prefix convention (e.g., __user__name). It simplifies mapping flat join outputs into structured objects, especially for PostgreSQL queries. Unlike manual mapping, it reduces boilerplate and supports custom prefixes and depth handling. Maintenance is low; no recent updates since initial release. Release cadence is sparse.

npm install qlmapper
INSTALL
IMPORT
SIG · QLMAPPER
Q
qlmapper
databasejavascriptv1.1.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import QLMapper from 'qlmapper'
import { QLMapper } from 'qlmapper'
Default export, not named.
require (CommonJS)
const QLMapper = require('qlmapper')
const { QLMapper } = require('qlmapper')
Use default import with require.
TypeScript type import
import QLMapper from 'qlmapper'
No official types; may need // @ts-ignore or declare module.

Shows how to map a flat SQL row with prefixed columns into a nested object using QLMapper.

import QLMapper from 'qlmapper'; const row = {"orderId":"300000","__user__name":"Vahagn","__user__id":200}; const result = QLMapper(row, ["user"]); console.log(JSON.stringify(result, null, 2)); // Output: // { // "user": { // "name": "Vahagn", // "id": 200 // }, // "orderId": "300000" // }
Debug
Known issues
gotchaColumn prefix is '__' by default; if your data uses a different separator, you must configure it or mapping fails silently.
fix
Pass custom prefix as third argument: QLMapper(row, groups, {prefix: '##'})
affects: >=1.0.0
gotchaIf a column name does not match the expected prefix pattern, it is placed at the root level, possibly overwriting existing keys or causing unexpected structure.
fix
Ensure all columns you intend to group follow the prefix convention.
affects: >=1.0.0
deprecatedNo TypeScript definitions bundled. TypeScript users must create their own .d.ts or use // @ts-ignore.
fix
Install @types/qlmapper if community provides, or declare module manually.
affects: >=1.0.0
gotchaThe second argument (groups) is an array of strings; if you pass a string instead, it will iterate over characters, leading to unexpected behavior.
fix
Always pass groups as an array: e.g., ['user', 'address'].
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: QLMapper is not a function
CommonJS require without default import when using ESM or wrong import syntax.
fix
Use `import QLMapper from 'qlmapper'` or `const QLMapper = require('qlmapper').default`.
Cannot read properties of undefined (reading 'split')
Passed a non-string value as a column name or omitted the row object.
fix
Ensure first argument is an object with string keys.
Unexpected token '.'
Using dot notation for keys that have '__' prefix; not a QLMapper error but common when accessing nested properties after mapping.
fix
Use bracket notation: result['__user__name'] or ensure mapping is complete.
Upgrade
Version history
1.1.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
12
Meta
1
Resources
qlmapper — npm install qlmapper · libregistry