Implements Phases 1-8 of the TFTSR implementation plan. Rust backend (Tauri 2.x, src-tauri/): - Multi-provider AI: OpenAI-compatible, Anthropic, Gemini, Mistral, Ollama - PII detection engine: 11 regex patterns with overlap resolution - SQLCipher AES-256 encrypted database with 10 versioned migrations - 28 Tauri IPC commands for triage, analysis, document, and system ops - Ollama: hardware probe, model recommendations, pull/delete with events - RCA and blameless post-mortem Markdown document generators - PDF export via printpdf - Audit log: SHA-256 hash of every external data send - Integration stubs for Confluence, ServiceNow, Azure DevOps (v0.2) Frontend (React 18 + TypeScript + Vite, src/): - 9 pages: full triage workflow NewIssue→LogUpload→Triage→Resolution→RCA→Postmortem→History+Settings - 7 components: ChatWindow, TriageProgress, PiiDiffViewer, DocEditor, HardwareReport, ModelSelector, UI primitives - 3 Zustand stores: session, settings (persisted), history - Type-safe tauriCommands.ts matching Rust backend types exactly - 8 IT domain system prompts (Linux, Windows, Network, K8s, DB, Virt, HW, Obs) DevOps: - .woodpecker/test.yml: rustfmt, clippy, cargo test, tsc, vitest on every push - .woodpecker/release.yml: linux/amd64 + linux/arm64 builds, Gogs release upload Verified: - cargo check: zero errors - tsc --noEmit: zero errors - vitest run: 13/13 unit tests passing Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
77 lines
2.0 KiB
Markdown
77 lines
2.0 KiB
Markdown
# `dlv(obj, keypath)` [](https://npmjs.com/package/dlv) [](https://travis-ci.org/developit/dlv)
|
|
|
|
> Safely get a dot-notated path within a nested object, with ability to return a default if the full key path does not exist or the value is undefined
|
|
|
|
|
|
### Why?
|
|
|
|
Smallest possible implementation: only **130 bytes.**
|
|
|
|
You could write this yourself, but then you'd have to write [tests].
|
|
|
|
Supports ES Modules, CommonJS and globals.
|
|
|
|
|
|
### Installation
|
|
|
|
`npm install --save dlv`
|
|
|
|
|
|
### Usage
|
|
|
|
`delve(object, keypath, [default])`
|
|
|
|
```js
|
|
import delve from 'dlv';
|
|
|
|
let obj = {
|
|
a: {
|
|
b: {
|
|
c: 1,
|
|
d: undefined,
|
|
e: null
|
|
}
|
|
}
|
|
};
|
|
|
|
//use string dot notation for keys
|
|
delve(obj, 'a.b.c') === 1;
|
|
|
|
//or use an array key
|
|
delve(obj, ['a', 'b', 'c']) === 1;
|
|
|
|
delve(obj, 'a.b') === obj.a.b;
|
|
|
|
//returns undefined if the full key path does not exist and no default is specified
|
|
delve(obj, 'a.b.f') === undefined;
|
|
|
|
//optional third parameter for default if the full key in path is missing
|
|
delve(obj, 'a.b.f', 'foo') === 'foo';
|
|
|
|
//or if the key exists but the value is undefined
|
|
delve(obj, 'a.b.d', 'foo') === 'foo';
|
|
|
|
//Non-truthy defined values are still returned if they exist at the full keypath
|
|
delve(obj, 'a.b.e', 'foo') === null;
|
|
|
|
//undefined obj or key returns undefined, unless a default is supplied
|
|
delve(undefined, 'a.b.c') === undefined;
|
|
delve(undefined, 'a.b.c', 'foo') === 'foo';
|
|
delve(obj, undefined, 'foo') === 'foo';
|
|
```
|
|
|
|
|
|
### Setter Counterparts
|
|
|
|
- [dset](https://github.com/lukeed/dset) by [@lukeed](https://github.com/lukeed) is the spiritual "set" counterpart of `dlv` and very fast.
|
|
- [bury](https://github.com/kalmbach/bury) by [@kalmbach](https://github.com/kalmbach) does the opposite of `dlv` and is implemented in a very similar manner.
|
|
|
|
|
|
### License
|
|
|
|
[MIT](https://oss.ninja/mit/developit/)
|
|
|
|
|
|
[preact]: https://github.com/developit/preact
|
|
[tests]: https://github.com/developit/dlv/blob/master/test.js
|