https://github.com/lightwithoutlisonlyight/dottify
https://github.com/lightwithoutlisonlyight/dottify
dot dot-notation dot-notation-dict dottify dotty javascript nodejs typescript
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/lightwithoutlisonlyight/dottify
- Owner: LightwithoutLisonlyight
- License: mit
- Created: 2021-04-06T12:55:53.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-04-07T20:57:21.000Z (almost 5 years ago)
- Last Synced: 2025-02-27T15:19:36.610Z (11 months ago)
- Topics: dot, dot-notation, dot-notation-dict, dottify, dotty, javascript, nodejs, typescript
- Language: JavaScript
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dottify - The easiest way to flat a object

How to use it ?
```javascript
// Import it
const dottify = require('dottify')
// Example Object
let object = {
a : 1,
b : 'Hello',
c : true,
d : [0,1,2,false,'Dottify'],
e : {
a: {
b : {
c : 'This is an inner value',
d : () => console.log(0)
}
}
},
f : undefined,
g : null
}
// Flat & save it
// The second parameter is optional... the default separator is the dot.
let flatted = dottify(object,'.')
//Print the result
console.log(flatted)
/*
The Output
{
a: 1,
b: 'Hello',
c: true,
'd.0': 0,
'd.1': 1,
'd.2': 2,
'd.3': false,
'd.4': 'Dottify',
'e.a.b.c': 'This is an inner value',
'e.a.b.d': [Function: d],
f: undefined,
g: null
}
*/
```