๐ Quick Start
๐ Quick Start with @fizzwiz/vanilla
@fizzwiz/vanilla provides simple, semantic helpers for working with plain JSON objects. Below are examples to get you started quickly.
Installation
npm install @fizzwiz/vanilla
OptionStore Example
Store and retrieve options by type, automatically walking up an instance's prototype chain.
import { OptionStore } from '@fizzwiz/vanilla';
class Base {}
class Derived extends Base {}
const options = OptionStore.as({});
options.set(Base, 'color', 'blue');
options.get(Derived, 'color'); // -> 'blue'
Notes
- Useful for per-type configuration.
- Automatically resolves values from the prototype chain.
ObjNavigator Example
Navigate and manipulate nested objects using paths or functions.
import { ObjNavigator } from '@fizzwiz/vanilla';
const navigator = ObjNavigator.from({})
.set('user.profile.name', 'Alice')
.with('user.profile')
.set('age', 30)
.set('email', 'alice@example.com')
.without();
Notes
- Simplifies working with deeply nested objects without manual intermediate checks.
- Supports scoped navigation with
within()/with()and returning to parent viawithout(). - Works with plain JSON objects; fully serializable and flexible.
Comments
Post a Comment