@sbimochan/pathify
v1.1.0
Published
A lightweight utility that recursively walks through a nested JavaScript object and replaces all leaf values with their corresponding dot-notation paths.
Readme
pathify
Generate dot-notated key paths from deeply nested JavaScript objects — clean, recursive, and zero dependencies.
✨ Features
- 🔁 Recursively walks any nested object
- 📌 Replaces all leaf values with their full dot-notation paths
- 🧼 Preserves original object structure
- 🪶 Lightweight — no dependencies
- ⚙️ Optional base path prefix
📦 Install
npm install @sbimochan/pathifyTest
npm run testUsage
const input = {
user: {
profile: {
name: '',
age: ''
},
settings: {
theme: ''
}
}
};Expected output
{
user: {
profile: {
name: 'user.profile.name',
age: 'user.profile.age'
},
settings: {
theme: 'user.settings.theme'
}
}
}