✨ MAJOR FEATURES: • Auto-zoom intelligence với smart bounds fitting • Enhanced 3D GPS markers với pulsing effects • Professional route display với 6-layer rendering • Status-based parking icons với availability indicators • Production-ready build optimizations 🗺️ AUTO-ZOOM FEATURES: • Smart bounds fitting cho GPS + selected parking • Adaptive padding (50px) cho visual balance • Max zoom control (level 16) để tránh quá gần • Dynamic centering khi không có selection 🎨 ENHANCED VISUALS: • 3D GPS marker với multi-layer pulse effects • Advanced parking icons với status colors • Selection highlighting với animation • Dimming system cho non-selected items 🛣️ ROUTE SYSTEM: • OpenRouteService API integration • Multi-layer route rendering (glow, shadow, main, animated) • Real-time distance & duration calculation • Visual route info trong popup 📱 PRODUCTION READY: • SSR safe với dynamic imports • Build errors resolved • Global deployment via Vercel • Optimized performance 🌍 DEPLOYMENT: • Vercel: https://whatever-ctk2auuxr-phong12hexdockworks-projects.vercel.app • Bundle size: 22.8 kB optimized • Global CDN distribution • HTTPS enabled 💾 VERSION CONTROL: • MapView-v2.0.tsx backup created • MAPVIEW_VERSIONS.md documentation • Full version history tracking
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
|