max-mapper / max-mapper/toiletdb

Handle nested keys

Open
#14 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
221
Forks
19
PR merge metrics
No merged PRs in 30d

Description

It'd be neat if toiletdb methods that accepted key parameters handled nested keys. For example:

// db.json = { ports: { http: 80, https: 443 } }
db.read('ports.http', function(err, data) {
  console.log(data)
  > 80
})

or:

// db.json = { ports: { http: 80, https: 443 } }
db.read(['ports', 'http'], function(err, data) {
  console.log(data)
  > 80
})

The second method avoids confusion where '.' may be a part of an attribute's name, ex: data['example.org']

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the toiletdb methods that accept key parameters, especially db.read, and inspect how they currently resolve keys from the JSON backend. Done means nested keys work with both dot-separated strings such as 'ports.http' and key arrays such as ['ports', 'http'], while preserving support for attribute names containing dots.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
database
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.